From 16bcdfd7c9a34644edb1849c67144750c894ff52 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 16 Jan 2015 19:25:44 -0800 Subject: Return true if no action was needed during create_hooks. Log to logger actions taken. --- lib/gitlab_projects.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.1