summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe <glen@delfi.ee>2016-11-16 23:12:55 +0200
committerSean McGivern <sean@gitlab.com>2016-12-01 11:41:03 +0000
commit17691041ae723145f78a081a16809d0afb8136f1 (patch)
tree3c1658b372c31dd439e0aa89eef198cb883ac330
parent91ba63969a418583454b54879afb0f335e9e06c4 (diff)
downloadgitlab-shell-17691041ae723145f78a081a16809d0afb8136f1.tar.gz
move helpers to top
-rw-r--r--spec/gitlab_custom_hook_spec.rb58
1 files changed, 29 insertions, 29 deletions
diff --git a/spec/gitlab_custom_hook_spec.rb b/spec/gitlab_custom_hook_spec.rb
index 0718f16..69809b9 100644
--- a/spec/gitlab_custom_hook_spec.rb
+++ b/spec/gitlab_custom_hook_spec.rb
@@ -16,6 +16,35 @@ describe GitlabCustomHook do
let(:gitlab_custom_hook) { GitlabCustomHook.new(tmp_repo_path, 'key_1') }
+ def hook_path(repo_path, path)
+ File.join(repo_path, path.split('/'))
+ end
+
+ def create_hook(repo_path, path, which)
+ FileUtils.ln_sf(which, hook_path(repo_path, path))
+ end
+
+ # global hooks multiplexed
+ def create_global_hooks_d(path, which)
+ create_hook(path, 'hooks/pre-receive.d/hook', which)
+ create_hook(path, 'hooks/update.d/hook', which)
+ create_hook(path, 'hooks/post-receive.d/hook', which)
+ end
+
+ # repo hooks
+ def create_repo_hooks(path, which)
+ create_hook(path, 'custom_hooks/pre-receive', which)
+ create_hook(path, 'custom_hooks/update', which)
+ create_hook(path, 'custom_hooks/post-receive', which)
+ end
+
+ # repo hooks multiplexed
+ def create_repo_hooks_d(path, which)
+ create_hook(path, 'custom_hooks/pre-receive.d/hook', which)
+ create_hook(path, 'custom_hooks/update.d/hook', which)
+ create_hook(path, 'custom_hooks/post-receive.d/hook', which)
+ end
+
# setup paths
# <repository>.git/hooks/ - symlink to gitlab-shell/hooks global dir
# <repository>.git/hooks/<hook_name> - executed by git itself, this is gitlab-shell/hooks/<hook_name>
@@ -173,33 +202,4 @@ describe GitlabCustomHook do
gitlab_custom_hook.post_receive(changes)
end
end
-
- def hook_path(repo_path, path)
- File.join(repo_path, path.split('/'))
- end
-
- def create_hook(repo_path, path, which)
- FileUtils.ln_sf(which, hook_path(repo_path, path))
- end
-
- # global hooks multiplexed
- def create_global_hooks_d(path, which)
- create_hook(path, 'hooks/pre-receive.d/hook', which)
- create_hook(path, 'hooks/update.d/hook', which)
- create_hook(path, 'hooks/post-receive.d/hook', which)
- end
-
- # repo hooks
- def create_repo_hooks(path, which)
- create_hook(path, 'custom_hooks/pre-receive', which)
- create_hook(path, 'custom_hooks/update', which)
- create_hook(path, 'custom_hooks/post-receive', which)
- end
-
- # repo hooks multiplexed
- def create_repo_hooks_d(path, which)
- create_hook(path, 'custom_hooks/pre-receive.d/hook', which)
- create_hook(path, 'custom_hooks/update.d/hook', which)
- create_hook(path, 'custom_hooks/post-receive.d/hook', which)
- end
end