Commit aded7056fd3a9830215f41233ef609c0f9a3b862

Authored by Dmitriy Zaporozhets
2 parents aa708ed9 ffdda12f

Merge pull request #1313 from LeonB/master

Fixed some hardcoded paths based on issue #1272
config/gitlab.yml.example
@@ -33,6 +33,7 @@ app: @@ -33,6 +33,7 @@ app:
33 git_host: 33 git_host:
34 admin_uri: git@localhost:gitolite-admin 34 admin_uri: git@localhost:gitolite-admin
35 base_path: /home/git/repositories/ 35 base_path: /home/git/repositories/
  36 + # hooks_path: /var/lib/gitolite/.gitolite/hooks/ # only needed when gitolite is not installed according the manual
36 # host: localhost 37 # host: localhost
37 git_user: git 38 git_user: git
38 upload_pack: true 39 upload_pack: true
config/initializers/1_settings.rb
@@ -66,6 +66,10 @@ class Settings < Settingslogic @@ -66,6 +66,10 @@ class Settings < Settingslogic
66 git_host['base_path'] || '/home/git/repositories/' 66 git_host['base_path'] || '/home/git/repositories/'
67 end 67 end
68 68
  69 + def git_hooks_path
  70 + git_host['hooks_path'] || '/home/git/share/gitolite/hooks/'
  71 + end
  72 +
69 def git_upload_pack 73 def git_upload_pack
70 if git_host['upload_pack'] != false 74 if git_host['upload_pack'] != false
71 true 75 true
lib/tasks/gitlab/backup.rake
@@ -144,7 +144,7 @@ namespace :gitlab do @@ -144,7 +144,7 @@ namespace :gitlab do
144 if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1") 144 if Kernel.system("cd #{File.dirname(project.second)} > /dev/null 2>&1 && git clone --bare #{backup_path_repo}/#{project.first}.bundle #{project.first}.git > /dev/null 2>&1")
145 permission_commands = [ 145 permission_commands = [
146 "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}", 146 "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}",
147 - "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}", 147 + "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}"
148 ] 148 ]
149 permission_commands.each { |command| Kernel.system(command) } 149 permission_commands.each { |command| Kernel.system(command) }
150 puts "[DONE]".green 150 puts "[DONE]".green
lib/tasks/gitlab/status.rake
@@ -56,7 +56,7 @@ namespace :gitlab do @@ -56,7 +56,7 @@ namespace :gitlab do
56 return 56 return
57 end 57 end
58 58
59 - gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") 59 + gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
60 gitlab_hook_files = ['post-receive'] 60 gitlab_hook_files = ['post-receive']
61 gitlab_hook_files.each do |file_name| 61 gitlab_hook_files.each do |file_name|
62 dest = File.join(gitolite_hooks_path, file_name) 62 dest = File.join(gitolite_hooks_path, file_name)
lib/tasks/gitlab/write_hook.rake
@@ -2,7 +2,7 @@ namespace :gitlab do @@ -2,7 +2,7 @@ namespace :gitlab do
2 namespace :gitolite do 2 namespace :gitolite do
3 desc "GITLAB | Write GITLAB hook for gitolite" 3 desc "GITLAB | Write GITLAB hook for gitolite"
4 task :write_hooks => :environment do 4 task :write_hooks => :environment do
5 - gitolite_hooks_path = File.join("/home", Gitlab.config.ssh_user, "share", "gitolite", "hooks", "common") 5 + gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
6 gitlab_hooks_path = Rails.root.join("lib", "hooks") 6 gitlab_hooks_path = Rails.root.join("lib", "hooks")
7 7
8 gitlab_hook_files = ['post-receive'] 8 gitlab_hook_files = ['post-receive']