Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Blessing committed Nov 4, 2014
1 parent 99d2643 commit 72e21a4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/gitlab_custom_hook.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
class GitlabCustomHook
def hook_file(hook_type, repo_path)
hook_path = repo_path.gsub(/hooks$/, 'custom_hooks')
hook_file = "#{custom_hook_path}/#{hook_type}"
return hook_file if File.exist?(hook_file)
end

def pre_receive(old_value, new_value, ref_name, repo_path)
hook = hook_file('pre-receive', repo_path.strip)
return false if hook.nil?
Expand All @@ -23,4 +17,12 @@ def update(ref_name, old_value, new_value, repo_path)
return false if hook.nil?
return false unless system(*hook, ref_name, old_value, new_value)
end

private

def hook_file(hook_type, repo_path)
hook_path = repo_path.gsub(/hooks$/, 'custom_hooks')
hook_file = "#{hook_path}/#{hook_type}"
return hook_file if File.exist?(hook_file)
end
end

0 comments on commit 72e21a4

Please sign in to comment.