Commit 16bcdfd7 authored by Marin Jankovski's avatar Marin Jankovski

Return true if no action was needed during create_hooks. Log to logger actions taken.

parent 00230264
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment