diff options
author | Drew Blessing <drew.blessing@me.com> | 2014-10-29 22:21:10 -0500 |
---|---|---|
committer | Drew Blessing <drew.blessing@me.com> | 2014-11-05 15:16:43 -0600 |
commit | 3ef7cdf9f94035da5640a585b8c49b0693af2090 (patch) | |
tree | 5ad3dbaa118504d185071a5f4e36f8a8cbc3e3dd /hooks | |
parent | 00b3d2cb7095af3859734c88a7797182e598f047 (diff) | |
download | gitlab-shell-3ef7cdf9f94035da5640a585b8c49b0693af2090.tar.gz |
Support for custom hooks
Diffstat (limited to 'hooks')
-rwxr-xr-x | hooks/post-receive | 7 | ||||
-rwxr-xr-x | hooks/pre-receive | 5 | ||||
-rwxr-xr-x | hooks/update | 17 |
3 files changed, 24 insertions, 5 deletions
diff --git a/hooks/post-receive b/hooks/post-receive index d85ad42..301f639 100755 --- a/hooks/post-receive +++ b/hooks/post-receive @@ -2,15 +2,16 @@ # This file was placed here by GitLab. It makes sure that your pushed commits # will be processed properly. -# You can add your own hooks to this file, but be careful when updating gitlab-shell! -changes = ARGF.read +refs = ARGF.read key_id = ENV['GL_ID'] repo_path = Dir.pwd +require_relative '../lib/gitlab_custom_hook' require_relative '../lib/gitlab_post_receive' -if GitlabPostReceive.new(repo_path, key_id, changes).exec +if GitlabPostReceive.new(repo_path, key_id, refs).exec && + GitlabCustomHook.new.post_receive(refs, repo_path) exit 0 else exit 1 diff --git a/hooks/pre-receive b/hooks/pre-receive index 2b979fa..7f9c0c0 100755 --- a/hooks/pre-receive +++ b/hooks/pre-receive @@ -2,15 +2,16 @@ # This file was placed here by GitLab. It makes sure that your pushed commits # will be processed properly. -# You can add your own hooks to this file, but be careful when updating gitlab-shell! refs = ARGF.read key_id = ENV['GL_ID'] repo_path = Dir.pwd +require_relative '../lib/gitlab_custom_hook' require_relative '../lib/gitlab_access' -if GitlabAccess.new(repo_path, key_id, refs).exec +if GitlabAccess.new(repo_path, key_id, refs).exec && + GitlabCustomHook.new.pre_receive(refs, repo_path) exit 0 else exit 1 diff --git a/hooks/update b/hooks/update new file mode 100755 index 0000000..f1ac8e7 --- /dev/null +++ b/hooks/update @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +# This file was placed here by GitLab. It makes sure that your pushed commits +# will be processed properly. + +ref_name = ARGV[0] +old_value = ARGV[1] +new_value = ARGV[2] +repo_path = Dir.pwd + +require_relative '../lib/gitlab_custom_hook' + +if GitlabCustomHook.new.update(ref_name, old_value, new_value, repo_path) + exit 0 +else + exit 1 +end |