summaryrefslogtreecommitdiff
path: root/lib/gitlab_custom_hook.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab_custom_hook.rb')
-rw-r--r--lib/gitlab_custom_hook.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/gitlab_custom_hook.rb b/lib/gitlab_custom_hook.rb
index e84d702..0187e1e 100644
--- a/lib/gitlab_custom_hook.rb
+++ b/lib/gitlab_custom_hook.rb
@@ -5,26 +5,27 @@ require_relative 'gitlab_metrics'
class GitlabCustomHook
attr_reader :vars
- def initialize(key_id)
+ def initialize(repo_path, key_id)
+ @repo_path = repo_path
@vars = { 'GL_ID' => key_id }
end
- def pre_receive(changes, repo_path)
- hook = hook_file('pre-receive', repo_path)
+ def pre_receive(changes)
+ hook = hook_file('pre-receive', @repo_path)
return true if hook.nil?
GitlabMetrics.measure("pre-receive-hook") { call_receive_hook(hook, changes) }
end
- def post_receive(changes, repo_path)
- hook = hook_file('post-receive', repo_path)
+ def post_receive(changes)
+ hook = hook_file('post-receive', @repo_path)
return true if hook.nil?
GitlabMetrics.measure("post-receive-hook") { call_receive_hook(hook, changes) }
end
- def update(ref_name, old_value, new_value, repo_path)
- hook = hook_file('update', repo_path)
+ def update(ref_name, old_value, new_value)
+ hook = hook_file('update', @repo_path)
return true if hook.nil?
GitlabMetrics.measure("update-hook") { system(vars, hook, ref_name, old_value, new_value) }