2012-08-21 19:14:06 +02:00
|
|
|
namespace :gitlab do
|
|
|
|
namespace :gitolite do
|
|
|
|
desc "GITLAB | Write GITLAB hook for gitolite"
|
|
|
|
task :write_hooks => :environment do
|
2012-08-28 10:57:23 +02:00
|
|
|
gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
|
2012-08-21 19:14:06 +02:00
|
|
|
gitlab_hooks_path = Rails.root.join("lib", "hooks")
|
|
|
|
|
|
|
|
gitlab_hook_files = ['post-receive']
|
|
|
|
|
|
|
|
gitlab_hook_files.each do |file_name|
|
|
|
|
source = File.join(gitlab_hooks_path, file_name)
|
|
|
|
dest = File.join(gitolite_hooks_path, file_name)
|
|
|
|
|
|
|
|
puts "sudo -u root cp #{source} #{dest}".yellow
|
|
|
|
`sudo -u root cp #{source} #{dest}`
|
|
|
|
|
|
|
|
puts "sudo -u root chown git:git #{dest}".yellow
|
|
|
|
`sudo -u root chown git:git #{dest}`
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|