Welcome to mirror list, hosted at ThFree Co, Russian Federation.

write_hook.rake « gitlab « tasks « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e9fc8eb3d1f7b427cf3eb20ba268acf917cedf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
namespace :gitlab do
  namespace :gitolite do
    desc "GITLAB | Write GitLab hook for gitolite"
    task :write_hooks => :environment  do
      gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
      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