summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2015-01-16 19:25:44 -0800
committerMarin Jankovski <maxlazio@gmail.com>2015-01-16 19:25:44 -0800
commit16bcdfd7c9a34644edb1849c67144750c894ff52 (patch)
tree85cef7296ff04245e9bc55dd72fd14ae067bf626 /lib
parent0023026411233b039ea91967be7ec15fe0251a71 (diff)
downloadgitlab-shell-16bcdfd7c9a34644edb1849c67144750c894ff52.tar.gz
Return true if no action was needed during create_hooks. Log to logger actions taken.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_projects.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index e9c9203..05ee211 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -21,9 +21,14 @@ class GitlabProjects
def self.create_hooks(path)
local_hooks_directory = File.join(path, 'hooks')
- unless File.realpath(local_hooks_directory) == File.realpath(GLOBAL_HOOKS_DIRECTORY)
+
+ if File.realpath(local_hooks_directory) != File.realpath(GLOBAL_HOOKS_DIRECTORY)
+ $logger.info "Moving existing hooks directory and simlinking global hooks directory for #{path}."
FileUtils.mv(local_hooks_directory, "#{local_hooks_directory}.old.#{Time.now.to_i}")
FileUtils.ln_s(GLOBAL_HOOKS_DIRECTORY, local_hooks_directory)
+ else
+ $logger.info "Hooks already exist for #{path}."
+ true
end
end