module GitHooks

Constants

HOOKS
HOOK_SAMPLE_FILE
VERSION

Attributes

configurations[W]

Public Class Methods

base_path() click to toggle source
# File lib/git-hooks.rb, line 38
def base_path
  File.expand_path('../..', __FILE__)
end
configurations() click to toggle source
# File lib/git-hooks.rb, line 34
def configurations
  @configurations ||= Configurations.new
end
execute_pre_commits() click to toggle source
# File lib/git-hooks.rb, line 26
def execute_pre_commits
  configurations.pre_commits.each do |pre_commit, options|
    puts "Executing #{pre_commit}"
    pre_commit_checker = GitHooks::PreCommit.const_get(pre_commit)
    pre_commit_checker.validate(options)
  end
end
validate_hooks!() click to toggle source
# File lib/git-hooks.rb, line 42
def validate_hooks!
  fail Exceptions::MissingHook, PRE_COMMIT unless valid_pre_commit_hook?
end

Private Class Methods

real_hook_template_path() click to toggle source
# File lib/git-hooks.rb, line 53
def real_hook_template_path
  File.join(base_path, HOOK_SAMPLE_FILE)
end
valid_pre_commit_hook?() click to toggle source
# File lib/git-hooks.rb, line 48
def valid_pre_commit_hook?
  configurations.pre_commits.empty? ||
    Installer.new(PRE_COMMIT).installed?
end