Module: GitHooks

Defined in:
lib/githooks/version.rb,
lib/githooks.rb,
lib/githooks/cli.rb,
lib/githooks/hook.rb,
lib/githooks/error.rb,
lib/githooks/action.rb,
lib/githooks/runner.rb,
lib/githooks/section.rb,
lib/githooks/cli/config.rb,
lib/githooks/repository.rb,
lib/githooks/system_utils.rb,
lib/githooks/repository/file.rb,
lib/githooks/repository/config.rb,
lib/githooks/repository/limiter.rb,
lib/githooks/repository/diff_index_entry.rb

Overview

Copyright © 2013 Carl P. Corliss

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Defined Under Namespace

Modules: CLI, SystemUtils Classes: Action, Error, Hook, Repository, Runner, Section

Constant Summary collapse

SUCCESS_SYMBOL =
''.color_success!
FAILURE_SYMBOL =
'X'.color_failure!
UNKNOWN_SYMBOL =
'?'.color_unknown!
WARNING_SYMBOL =
'W'.color_warning!
SKIPPED_SYMBOL =
'S'.color_skipped!
LIB_PATH =
Pathname.new(__FILE__).dirname.realpath
GEM_PATH =
LIB_PATH.parent
BIN_PATH =
GEM_PATH.join('bin')
SCRIPT_PATH =
Pathname.new($0)
SCRIPT_NAME =
SCRIPT_PATH.basename.to_s
HOOK_NAME =
SCRIPT_NAME.to_s
VERSION =
'1.6.2'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.debugObject

Returns the value of attribute debug.



36
37
38
# File 'lib/githooks.rb', line 36

def debug
  @debug
end

.hooks_rootObject

Returns the value of attribute hooks_root.



36
37
38
# File 'lib/githooks.rb', line 36

def hooks_root
  @hooks_root
end

.ignore_scriptObject

Returns the value of attribute ignore_script.



36
37
38
# File 'lib/githooks.rb', line 36

def ignore_script
  @ignore_script
end

.verboseObject

Returns the value of attribute verbose.



36
37
38
# File 'lib/githooks.rb', line 36

def verbose
  @verbose
end

Class Method Details

.debug?Boolean

Returns:

  • (Boolean)


46
47
48
49
50
51
# File 'lib/githooks.rb', line 46

def debug?
  return true if ENV['GITHOOKS_DEBUG']
  return true if ARGV.include?('--debug')
  return true if ARGV.include?('-d')
  debug
end

.hook_nameObject



72
73
74
75
76
77
# File 'lib/githooks.rb', line 72

def hook_name
  case GitHooks::HOOK_NAME.to_s
    when 'githooks', 'irb', '', nil then 'pre-commit'
    else GitHooks::HOOK_NAME
  end
end

.quietedObject



38
39
40
41
42
43
44
# File 'lib/githooks.rb', line 38

def quieted
  od, ov = @debug, @verbose
  @debug, @verbose = false, false
  yield
ensure
  @debug, @verbose = od, ov
end

.verbose?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
# File 'lib/githooks.rb', line 57

def verbose?
  return true if ENV['GITHOOKS_VERBOSE']
  return true if ARGV.include?('--verbose')
  return true if ARGV.include?('-v')
  verbose
end