Commit 19eb63741995e3be60781db74edab5d5ae896c6b

Authored by Riyad Preukschas
1 parent b2e46f44

Update uses of Gitolite.config.foo settings

app/controllers/admin/users_controller.rb
... ... @@ -30,7 +30,7 @@ class Admin::UsersController < AdminController
30 30  
31 31  
32 32 def new
33   - @admin_user = User.new({ projects_limit: Gitlab.config.default_projects_limit }, as: :admin)
  33 + @admin_user = User.new({ projects_limit: Gitlab.config.gitlab.default_projects_limit }, as: :admin)
34 34 end
35 35  
36 36 def edit
... ...
app/controllers/omniauth_callbacks_controller.rb
1 1 class OmniauthCallbacksController < Devise::OmniauthCallbacksController
2   - Gitlab.config.omniauth_providers.each do |provider|
  2 + Gitlab.config.omniauth.providers.each do |provider|
3 3 define_method provider['name'] do
4 4 handle_omniauth
5 5 end
... ...
app/helpers/application_helper.rb
... ... @@ -37,7 +37,7 @@ module ApplicationHelper
37 37 if Gitlab.config.disable_gravatar? || user_email.blank?
38 38 'no_avatar.png'
39 39 else
40   - gravatar_url = request.ssl? ? Gitlab.config.gravatar_ssl_url : Gitlab.config.gravatar_url
  40 + gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
41 41 user_email.strip!
42 42 sprintf(gravatar_url, {:hash => Digest::MD5.hexdigest(user_email.downcase), :email => URI.escape(user_email), :size => size})
43 43 end
... ... @@ -48,7 +48,7 @@ module ApplicationHelper
48 48 end
49 49  
50 50 def web_app_url
51   - "#{request_protocol}://#{Gitlab.config.web_host}/"
  51 + "#{request_protocol}://#{Gitlab.config.gitlab.host}/"
52 52 end
53 53  
54 54 def last_commit(project)
... ...
app/mailers/notify.rb
... ... @@ -3,11 +3,11 @@ class Notify &lt; ActionMailer::Base
3 3 add_template_helper ApplicationHelper
4 4 add_template_helper GitlabMarkdownHelper
5 5  
6   - default_url_options[:host] = Gitlab.config.web_host
7   - default_url_options[:protocol] = Gitlab.config.web_protocol
8   - default_url_options[:port] = Gitlab.config.web_port if Gitlab.config.web_custom_port?
  6 + default_url_options[:host] = Gitlab.config.gitlab.host
  7 + default_url_options[:protocol] = Gitlab.config.gitlab.protocol
  8 + default_url_options[:port] = Gitlab.config.gitlab.port if Gitlab.config.gitlab_on_non_standard_port?
9 9  
10   - default from: Gitlab.config.email_from
  10 + default from: Gitlab.config.gitlab.email_from
11 11  
12 12  
13 13  
... ...
app/models/namespace.rb
... ... @@ -48,14 +48,14 @@ class Namespace &lt; ActiveRecord::Base
48 48 end
49 49  
50 50 def ensure_dir_exist
51   - namespace_dir_path = File.join(Gitlab.config.git_base_path, path)
  51 + namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
52 52 system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path)
53 53 end
54 54  
55 55 def move_dir
56 56 if path_changed?
57   - old_path = File.join(Gitlab.config.git_base_path, path_was)
58   - new_path = File.join(Gitlab.config.git_base_path, path)
  57 + old_path = File.join(Gitlab.config.gitolite.repos_path, path_was)
  58 + new_path = File.join(Gitlab.config.gitolite.repos_path, path)
59 59 if File.exists?(new_path)
60 60 raise "Already exists"
61 61 end
... ... @@ -64,7 +64,7 @@ class Namespace &lt; ActiveRecord::Base
64 64 end
65 65  
66 66 def rm_dir
67   - dir_path = File.join(Gitlab.config.git_base_path, path)
  67 + dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
68 68 system("rm -rf #{dir_path}")
69 69 end
70 70 end
... ...
app/models/project.rb
... ... @@ -195,7 +195,7 @@ class Project &lt; ActiveRecord::Base
195 195 end
196 196  
197 197 def web_url
198   - [Gitlab.config.url, path_with_namespace].join("/")
  198 + [Gitlab.config.gitlab.url, path_with_namespace].join("/")
199 199 end
200 200  
201 201 def common_notes
... ...
app/roles/push_observer.rb
... ... @@ -114,7 +114,7 @@ module PushObserver
114 114 id: commit.id,
115 115 message: commit.safe_message,
116 116 timestamp: commit.date.xmlschema,
117   - url: "#{Gitlab.config.url}/#{path_with_namespace}/commit/#{commit.id}",
  117 + url: "#{Gitlab.config.gitlab.url}/#{path_with_namespace}/commit/#{commit.id}",
118 118 author: {
119 119 name: commit.author_name,
120 120 email: commit.author_email
... ...
app/roles/repository.rb
... ... @@ -97,7 +97,7 @@ module Repository
97 97 end
98 98  
99 99 def path_to_repo
100   - File.join(Gitlab.config.git_base_path, "#{path_with_namespace}.git")
  100 + File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git")
101 101 end
102 102  
103 103 def namespace_dir
... ... @@ -199,7 +199,7 @@ module Repository
199 199 end
200 200  
201 201 def http_url_to_repo
202   - http_url = [Gitlab.config.url, "/", path_with_namespace, ".git"].join('')
  202 + http_url = [Gitlab.config.gitlab.url, "/", path_with_namespace, ".git"].join('')
203 203 end
204 204  
205 205 # Check if current branch name is marked as protected in the system
... ...
app/views/admin/groups/show.html.haml
... ... @@ -22,7 +22,7 @@
22 22 %b
23 23 Path:
24 24 %td
25   - %span.monospace= File.join(Gitlab.config.git_base_path, @group.path)
  25 + %span.monospace= File.join(Gitlab.config.gitolite.repos_path, @group.path)
26 26 %tr
27 27 %td
28 28 %b
... ...
app/views/errors/gitolite.html.haml
... ... @@ -21,5 +21,5 @@
21 21 Permissions:
22 22 %pre
23 23 = preserve do
24   - sudo chown -R git:git #{Gitlab.config.git_base_path}
25   - sudo chmod -R ug+rwXs #{Gitlab.config.git_base_path}
  24 + sudo chown -R git:git #{Gitlab.config.gitolite.repos_path}
  25 + sudo chmod -R ug+rwXs #{Gitlab.config.gitolite.repos_path}
... ...
app/views/profiles/account.html.haml
1   -- if Gitlab.config.omniauth_enabled?
  1 +- if Gitlab.config.omniauth.enabled
2 2 %fieldset
3 3 %legend Social Accounts
4 4 .oauth_select_holder
... ...
app/views/profiles/show.html.haml
... ... @@ -37,7 +37,7 @@
37 37 %li
38 38 %p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"}
39 39  
40   - - if Gitlab.config.omniauth_enabled? && @user.provider?
  40 + - if Gitlab.config.omniauth.enabled && @user.provider?
41 41 %li
42 42 %p
43 43 You can login through #{@user.provider.titleize}!
... ...
app/views/shared/_clone_panel.html.haml
1 1 .input-prepend.project_clone_holder
2 2 %button{class: "btn active", :"data-clone" => @project.ssh_url_to_repo} SSH
3   - %button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.web_protocol.upcase
  3 + %button{class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.gitlab.protocol.upcase
4 4 = text_field_tag :project_clone, @project.url_to_repo, class: "one_click_select input-xxlarge"
... ...
app/workers/post_receive.rb
... ... @@ -2,7 +2,7 @@ class PostReceive
2 2 @queue = :post_receive
3 3  
4 4 def self.perform(repo_path, oldrev, newrev, ref, identifier)
5   - repo_path.gsub!(Gitlab.config.git_base_path.to_s, "")
  5 + repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
6 6 repo_path.gsub!(/.git$/, "")
7 7 repo_path.gsub!(/^\//, "")
8 8  
... ... @@ -10,7 +10,7 @@ class PostReceive
10 10 return false if project.nil?
11 11  
12 12 # Ignore push from non-gitlab users
13   - user = if identifier.eql? Gitlab.config.gitolite_admin_key
  13 + user = if identifier.eql? Gitlab.config.gitolite.admin_key
14 14 email = project.commit(newrev).author.email rescue nil
15 15 User.find_by_email(email) if email
16 16 elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
... ...
config/initializers/3_grit_ext.rb
1 1 require 'grit'
2 2 require 'pygments'
3 3  
4   -Grit::Git.git_timeout = Gitlab.config.git_timeout
5   -Grit::Git.git_max_size = Gitlab.config.git_max_size
  4 +Grit::Git.git_timeout = Gitlab.config.git.timeout
  5 +Grit::Git.git_max_size = Gitlab.config.git.max_size
6 6  
7 7 Grit::Blob.class_eval do
8 8 include Linguist::BlobHelper
... ...
config/initializers/devise.rb
... ... @@ -4,7 +4,7 @@ Devise.setup do |config|
4 4 # ==> Mailer Configuration
5 5 # Configure the e-mail address which will be shown in Devise::Mailer,
6 6 # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7   - config.mailer_sender = Gitlab.config.email_from
  7 + config.mailer_sender = Gitlab.config.gitlab.email_from
8 8  
9 9 # Configure the class responsible to send e-mails.
10 10 # config.mailer = "Devise::Mailer"
... ...
config/routes.rb
... ... @@ -14,10 +14,10 @@ Gitlab::Application.routes.draw do
14 14  
15 15 # Enable Grack support
16 16 mount Grack::Bundle.new({
17   - git_path: Gitlab.config.git_bin_path,
18   - project_root: Gitlab.config.git_base_path,
19   - upload_pack: Gitlab.config.git_upload_pack,
20   - receive_pack: Gitlab.config.git_receive_pack
  17 + git_path: Gitlab.config.git.bin_path,
  18 + project_root: Gitlab.config.gitolite.repos_path,
  19 + upload_pack: Gitlab.config.gitolite.upload_pack,
  20 + receive_pack: Gitlab.config.gitolite.receive_pack
21 21 }), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ }
22 22  
23 23 #
... ...
features/support/env.rb
... ... @@ -33,9 +33,9 @@ DatabaseCleaner.strategy = :truncation
33 33  
34 34 Spinach.hooks.before_scenario do
35 35 # Use tmp dir for FS manipulations
36   - Gitlab.config.stub(git_base_path: Rails.root.join('tmp', 'test-git-base-path'))
37   - FileUtils.rm_rf Gitlab.config.git_base_path
38   - FileUtils.mkdir_p Gitlab.config.git_base_path
  36 + Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
  37 + FileUtils.rm_rf Gitlab.config.gitolite.repos_path
  38 + FileUtils.mkdir_p Gitlab.config.gitolite.repos_path
39 39 end
40 40  
41 41 Spinach.hooks.after_scenario do
... ...
lib/gitlab/auth.rb
... ... @@ -38,7 +38,7 @@ module Gitlab
38 38 email: email,
39 39 password: password,
40 40 password_confirmation: password,
41   - projects_limit: Gitlab.config.default_projects_limit,
  41 + projects_limit: Gitlab.config.gitlab.default_projects_limit,
42 42 }, as: :admin)
43 43 if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
44 44 @user.blocked = true
... ...
lib/gitlab/backend/gitolite.rb
... ... @@ -38,7 +38,7 @@ module Gitlab
38 38 end
39 39  
40 40 def url_to_repo path
41   - Gitlab.config.ssh_path + "#{path}.git"
  41 + Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git"
42 42 end
43 43  
44 44 def enable_automerge
... ...
lib/gitlab/backend/gitolite_config.rb
... ... @@ -16,7 +16,7 @@ module Gitlab
16 16 def ga_repo
17 17 @ga_repo ||= ::Gitolite::GitoliteAdmin.new(
18 18 File.join(config_tmp_dir,'gitolite'),
19   - conf: Gitlab.config.gitolite_config_file
  19 + conf: Gitlab.config.gitolite.config_file
20 20 )
21 21 end
22 22  
... ... @@ -167,7 +167,7 @@ module Gitlab
167 167 # Enable access to all repos for gitolite admin.
168 168 # We use it for accept merge request feature
169 169 def admin_all_repo
170   - owner_name = Gitlab.config.gitolite_admin_key
  170 + owner_name = Gitlab.config.gitolite.admin_key
171 171  
172 172 # @ALL repos premission for gitolite owner
173 173 repo_name = "@all"
... ... @@ -189,7 +189,7 @@ module Gitlab
189 189  
190 190 def pull tmp_dir
191 191 Dir.mkdir tmp_dir
192   - `git clone #{Gitlab.config.gitolite_admin_uri} #{tmp_dir}/gitolite`
  192 + `git clone #{Gitlab.config.gitolite.admin_uri} #{tmp_dir}/gitolite`
193 193  
194 194 unless File.exists?(File.join(tmp_dir, 'gitolite', 'conf', 'gitolite.conf'))
195 195 raise PullError, "unable to clone gitolite-admin repo"
... ...
lib/gitlab/project_mover.rb
... ... @@ -15,10 +15,10 @@ module Gitlab
15 15  
16 16 def execute
17 17 # Create new dir if missing
18   - new_dir_path = File.join(Gitlab.config.git_base_path, new_dir)
  18 + new_dir_path = File.join(Gitlab.config.gitolite.repos_path, new_dir)
19 19 system("mkdir -m 770 #{new_dir_path}") unless File.exists?(new_dir_path)
20 20  
21   - old_path = File.join(Gitlab.config.git_base_path, old_dir, "#{project.path}.git")
  21 + old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git")
22 22 new_path = File.join(new_dir_path, "#{project.path}.git")
23 23  
24 24 if File.exists? new_path
... ...
lib/tasks/gitlab/activate_namespaces.rake
... ... @@ -27,7 +27,7 @@ namespace :gitlab do
27 27 end
28 28  
29 29 print "\n\nMove projects from groups under groups dirs:".yellow
30   - git_path = Gitlab.config.git_base_path
  30 + git_path = Gitlab.config.gitolite.repos_path
31 31  
32 32 Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
33 33 next unless project.group
... ...
lib/tasks/gitlab/backup.rake
... ... @@ -8,7 +8,7 @@ namespace :gitlab do
8 8 Rake::Task["gitlab:app:db_dump"].invoke
9 9 Rake::Task["gitlab:app:repo_dump"].invoke
10 10  
11   - Dir.chdir(Gitlab.config.backup_path)
  11 + Dir.chdir(Gitlab.config.backup.path)
12 12  
13 13 # saving additional informations
14 14 s = {}
... ... @@ -17,7 +17,7 @@ namespace :gitlab do
17 17 s[:gitlab_version] = %x{git rev-parse HEAD}.gsub(/\n/,"")
18 18 s[:tar_version] = %x{tar --version | head -1}.gsub(/\n/,"")
19 19  
20   - File.open("#{Gitlab.config.backup_path}/backup_information.yml", "w+") do |file|
  20 + File.open("#{Gitlab.config.backup.path}/backup_information.yml", "w+") do |file|
21 21 file << s.to_yaml.gsub(/^---\n/,'')
22 22 end
23 23  
... ... @@ -39,10 +39,10 @@ namespace :gitlab do
39 39  
40 40 # delete backups
41 41 print "Deleting old backups... "
42   - if Gitlab.config.backup_keep_time > 0
  42 + if Gitlab.config.backup.keep_time > 0
43 43 file_list = Dir.glob("*_gitlab_backup.tar").map { |f| f.split(/_/).first.to_i }
44 44 file_list.sort.each do |timestamp|
45   - if Time.at(timestamp) < (Time.now - Gitlab.config.backup_keep_time)
  45 + if Time.at(timestamp) < (Time.now - Gitlab.config.backup.keep_time)
46 46 %x{rm #{timestamp}_gitlab_backup.tar}
47 47 end
48 48 end
... ... @@ -55,7 +55,7 @@ namespace :gitlab do
55 55 # Restore backup of GitLab system
56 56 desc "GITLAB | Restore a previously created backup"
57 57 task :backup_restore => :environment do
58   - Dir.chdir(Gitlab.config.backup_path)
  58 + Dir.chdir(Gitlab.config.backup.path)
59 59  
60 60 # check for existing backups in the backup dir
61 61 file_list = Dir.glob("*_gitlab_backup.tar").each.map { |f| f.split(/_/).first.to_i }
... ... @@ -111,7 +111,7 @@ namespace :gitlab do
111 111 ################################# REPOSITORIES #################################
112 112  
113 113 task :repo_dump => :environment do
114   - backup_path_repo = File.join(Gitlab.config.backup_path, "repositories")
  114 + backup_path_repo = File.join(Gitlab.config.backup.path, "repositories")
115 115 FileUtils.mkdir_p(backup_path_repo) until Dir.exists?(backup_path_repo)
116 116 puts "Dumping repositories:"
117 117 project = Project.all.map { |n| [n.path, n.path_to_repo] }
... ... @@ -127,7 +127,7 @@ namespace :gitlab do
127 127 end
128 128  
129 129 task :repo_restore => :environment do
130   - backup_path_repo = File.join(Gitlab.config.backup_path, "repositories")
  130 + backup_path_repo = File.join(Gitlab.config.backup.path, "repositories")
131 131 puts "Restoring repositories:"
132 132 project = Project.all.map { |n| [n.path, n.path_to_repo] }
133 133 project << ["gitolite-admin.git", File.join(File.dirname(project.first.second), "gitolite-admin.git")]
... ... @@ -136,8 +136,8 @@ namespace :gitlab do
136 136 FileUtils.rm_rf(project.second) if File.dirname(project.second) # delete old stuff
137 137 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")
138 138 permission_commands = [
139   - "sudo chmod -R g+rwX #{Gitlab.config.git_base_path}",
140   - "sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}"
  139 + "sudo chmod -R g+rwX #{Gitlab.config.gitolite.repos_path}",
  140 + "sudo chown -R #{Gitlab.config.gitolite.ssh_user}:#{Gitlab.config.gitolite.ssh_user} #{Gitlab.config.gitolite.repos_path}"
141 141 ]
142 142 permission_commands.each { |command| Kernel.system(command) }
143 143 puts "[DONE]".green
... ... @@ -150,7 +150,7 @@ namespace :gitlab do
150 150 ###################################### DB ######################################
151 151  
152 152 task :db_dump => :environment do
153   - backup_path_db = File.join(Gitlab.config.backup_path, "db")
  153 + backup_path_db = File.join(Gitlab.config.backup.path, "db")
154 154 FileUtils.mkdir_p(backup_path_db) unless Dir.exists?(backup_path_db)
155 155  
156 156 puts "Dumping database tables:"
... ... @@ -170,7 +170,7 @@ namespace :gitlab do
170 170 end
171 171  
172 172 task :db_restore=> :environment do
173   - backup_path_db = File.join(Gitlab.config.backup_path, "db")
  173 + backup_path_db = File.join(Gitlab.config.backup.path, "db")
174 174  
175 175 puts "Restoring database tables:"
176 176 Rake::Task["db:reset"].invoke
... ...
lib/tasks/gitlab/check.rake
... ... @@ -268,7 +268,7 @@ namespace :gitlab do
268 268  
269 269 options = {
270 270 "user.name" => "GitLab",
271   - "user.email" => Gitlab.config.email_from
  271 + "user.email" => Gitlab.config.gitlab.email_from
272 272 }
273 273 correct_options = options.map do |name, value|
274 274 run("git config --global --get #{name}").try(:squish) == value
... ... @@ -290,7 +290,7 @@ namespace :gitlab do
290 290 end
291 291  
292 292 def check_gitlab_in_git_group
293   - gitolite_ssh_user = Gitlab.config.ssh_user
  293 + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
294 294 print "gitlab user is in #{gitolite_ssh_user} group? ... "
295 295  
296 296 if run_and_match("id -rnG", /\Wgit\W/)
... ... @@ -309,10 +309,10 @@ namespace :gitlab do
309 309  
310 310 # see https://github.com/gitlabhq/gitlabhq/issues/1059
311 311 def check_issue_1056_shell_profile_error
312   - gitolite_ssh_user = Gitlab.config.ssh_user
  312 + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
313 313 print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
314 314  
315   - profile_file = File.expand_path("~#{Gitlab.config.ssh_user}/.profile")
  315 + profile_file = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.profile")
316 316  
317 317 unless File.read(profile_file) =~ /^-e PATH/
318 318 puts "yes".green
... ... @@ -414,7 +414,7 @@ namespace :gitlab do
414 414  
415 415 test_path = "/tmp/gitlab_gitolite_admin_test"
416 416 FileUtils.rm_rf(test_path)
417   - `git clone -q #{Gitlab.config.gitolite_admin_uri} #{test_path}`
  417 + `git clone -q #{Gitlab.config.gitolite.admin_uri} #{test_path}`
418 418 raise unless $?.success?
419 419  
420 420 puts "yes".green
... ... @@ -423,7 +423,7 @@ namespace :gitlab do
423 423 try_fixing_it(
424 424 "Make sure the \"admin_uri\" is set correctly in config/gitlab.yml",
425 425 "Try cloning it yourself with:",
426   - " git clone -q #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite-admin",
  426 + " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin",
427 427 "Make sure Gitolite is installed correctly."
428 428 )
429 429 for_more_information(
... ... @@ -452,7 +452,7 @@ namespace :gitlab do
452 452 puts "no".red
453 453 try_fixing_it(
454 454 "Try committing to it yourself with:",
455   - " git clone -q #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite-admin",
  455 + " git clone -q #{Gitlab.config.gitolite.admin_uri} /tmp/gitolite-admin",
456 456 " touch foo",
457 457 " git add foo",
458 458 " git commit -m \"foo\"",
... ... @@ -469,7 +469,7 @@ namespace :gitlab do
469 469 def check_dot_gitolite_exists
470 470 print "Config directory exists? ... "
471 471  
472   - gitolite_config_path = File.expand_path("~#{Gitlab.config.ssh_user}/.gitolite")
  472 + gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite")
473 473  
474 474 if File.directory?(gitolite_config_path)
475 475 puts "yes".green
... ... @@ -490,7 +490,7 @@ namespace :gitlab do
490 490 def check_dot_gitolite_permissions
491 491 print "Config directory access is drwxr-x---? ... "
492 492  
493   - gitolite_config_path = File.expand_path("~#{Gitlab.config.ssh_user}/.gitolite")
  493 + gitolite_config_path = File.expand_path("~#{Gitlab.config.gitolite.ssh_user}/.gitolite")
494 494 unless File.exists?(gitolite_config_path)
495 495 puts "can't check because of previous errors".magenta
496 496 return
... ... @@ -512,7 +512,7 @@ namespace :gitlab do
512 512 end
513 513  
514 514 def check_dot_gitolite_user_and_group
515   - gitolite_ssh_user = Gitlab.config.ssh_user
  515 + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
516 516 print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_ssh_user} ... "
517 517  
518 518 gitolite_config_path = File.expand_path("~#{gitolite_ssh_user}/.gitolite")
... ... @@ -615,9 +615,9 @@ namespace :gitlab do
615 615 print "post-receive hook exists? ... "
616 616  
617 617 hook_file = "post-receive"
618   - gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
  618 + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
619 619 gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
620   - gitolite_ssh_user = Gitlab.config.ssh_user
  620 + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
621 621  
622 622 gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)
623 623  
... ... @@ -639,10 +639,10 @@ namespace :gitlab do
639 639 print "post-receive hook up-to-date? ... "
640 640  
641 641 hook_file = "post-receive"
642   - gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
  642 + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
643 643 gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
644 644 gitolite_hook_content = File.read(gitolite_hook_file)
645   - gitolite_ssh_user = Gitlab.config.ssh_user
  645 + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
646 646  
647 647 unless File.exists?(gitolite_hook_file)
648 648 puts "can't check because of previous errors".magenta
... ... @@ -669,7 +669,7 @@ namespace :gitlab do
669 669 def check_repo_base_exists
670 670 print "Repo base directory exists? ... "
671 671  
672   - repo_base_path = Gitlab.config.git_base_path
  672 + repo_base_path = Gitlab.config.gitolite.repos_path
673 673  
674 674 if File.exists?(repo_base_path)
675 675 puts "yes".green
... ... @@ -691,7 +691,7 @@ namespace :gitlab do
691 691 def check_repo_base_permissions
692 692 print "Repo base access is drwsrws---? ... "
693 693  
694   - repo_base_path = Gitlab.config.git_base_path
  694 + repo_base_path = Gitlab.config.gitolite.repos_path
695 695 unless File.exists?(repo_base_path)
696 696 puts "can't check because of previous errors".magenta
697 697 return
... ... @@ -713,10 +713,10 @@ namespace :gitlab do
713 713 end
714 714  
715 715 def check_repo_base_user_and_group
716   - gitolite_ssh_user = Gitlab.config.ssh_user
  716 + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
717 717 print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_ssh_user}? ... "
718 718  
719   - repo_base_path = Gitlab.config.git_base_path
  719 + repo_base_path = Gitlab.config.gitolite.repos_path
720 720 unless File.exists?(repo_base_path)
721 721 puts "can't check because of previous errors".magenta
722 722 return
... ... @@ -777,9 +777,9 @@ namespace :gitlab do
777 777 print "post-receive hooks in repos are links: ... "
778 778  
779 779 hook_file = "post-receive"
780   - gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
  780 + gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
781 781 gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
782   - gitolite_ssh_user = Gitlab.config.ssh_user
  782 + gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
783 783  
784 784 unless File.exists?(gitolite_hook_file)
785 785 puts "can't check because of previous errors".magenta
... ... @@ -828,7 +828,7 @@ namespace :gitlab do
828 828 ########################
829 829  
830 830 def gitolite_home
831   - File.expand_path("~#{Gitlab.config.ssh_user}")
  831 + File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
832 832 end
833 833  
834 834 def gitolite_version
... ...
lib/tasks/gitlab/import.rake
... ... @@ -12,7 +12,7 @@ namespace :gitlab do
12 12 desc "GITLAB | Import bare repositories from git_host -> base_path into GitLab project instance"
13 13 task :repos => :environment do
14 14  
15   - git_base_path = Gitlab.config.git_base_path
  15 + git_base_path = Gitlab.config.gitolite.repos_path
16 16 repos_to_import = Dir.glob(git_base_path + '/*')
17 17  
18 18 repos_to_import.each do |repo_path|
... ...
lib/tasks/gitlab/info.rake
... ... @@ -46,7 +46,7 @@ namespace :gitlab do
46 46 http_clone_url = project.http_url_to_repo
47 47 ssh_clone_url = project.ssh_url_to_repo
48 48  
49   - omniauth_providers = Gitlab.config.omniauth_providers
  49 + omniauth_providers = Gitlab.config.omniauth.providers
50 50 omniauth_providers.map! { |provider| provider['name'] }
51 51  
52 52 puts ""
... ... @@ -55,17 +55,17 @@ namespace :gitlab do
55 55 puts "Revision:\t#{Gitlab::Revision}"
56 56 puts "Directory:\t#{Rails.root}"
57 57 puts "DB Adapter:\t#{database_adapter}"
58   - puts "URL:\t\t#{Gitlab.config.url}"
  58 + puts "URL:\t\t#{Gitlab.config.gitlab.url}"
59 59 puts "HTTP Clone URL:\t#{http_clone_url}"
60 60 puts "SSH Clone URL:\t#{ssh_clone_url}"
61   - puts "Using LDAP:\t#{Gitlab.config.ldap_enabled? ? "yes".green : "no"}"
62   - puts "Using Omniauth:\t#{Gitlab.config.omniauth_enabled? ? "yes".green : "no"}"
63   - puts "Omniauth Providers: #{omniauth_providers.map(&:magenta).join(', ')}" if Gitlab.config.omniauth_enabled?
  61 + puts "Using LDAP:\t#{Gitlab.config.ldap.enabled ? "yes".green : "no"}"
  62 + puts "Using Omniauth:\t#{Gitlab.config.omniauth.enabled ? "yes".green : "no"}"
  63 + puts "Omniauth Providers: #{omniauth_providers.map(&:magenta).join(', ')}" if Gitlab.config.omniauth.enabled
64 64  
65 65  
66 66  
67 67 # check Gitolite version
68   - gitolite_version_file = "#{Gitlab.config.git_base_path}/../gitolite/src/VERSION"
  68 + gitolite_version_file = "#{Gitlab.config.gitolite.repos_path}/../gitolite/src/VERSION"
69 69 if File.exists?(gitolite_version_file) && File.readable?(gitolite_version_file)
70 70 gitolite_version = File.read(gitolite_version_file)
71 71 end
... ... @@ -73,11 +73,11 @@ namespace :gitlab do
73 73 puts ""
74 74 puts "Gitolite information".yellow
75 75 puts "Version:\t#{gitolite_version || "unknown".red}"
76   - puts "Admin URI:\t#{Gitlab.config.gitolite_admin_uri}"
77   - puts "Admin Key:\t#{Gitlab.config.gitolite_admin_key}"
78   - puts "Repositories:\t#{Gitlab.config.git_base_path}"
79   - puts "Hooks:\t\t#{Gitlab.config.git_hooks_path}"
80   - puts "Git:\t\t#{Gitlab.config.git.path}"
  76 + puts "Admin URI:\t#{Gitlab.config.gitolite.admin_uri}"
  77 + puts "Admin Key:\t#{Gitlab.config.gitolite.admin_key}"
  78 + puts "Repositories:\t#{Gitlab.config.gitolite.repos_path}"
  79 + puts "Hooks:\t\t#{Gitlab.config.gitolite.hooks_path}"
  80 + puts "Git:\t\t#{Gitlab.config.git.bin_path}"
81 81  
82 82 end
83 83  
... ...
spec/lib/gitolite_spec.rb
... ... @@ -16,7 +16,7 @@ describe Gitlab::Gitolite do
16 16 it { should respond_to :create_repository }
17 17 it { should respond_to :remove_repository }
18 18  
19   - it { gitolite.url_to_repo('diaspora').should == Gitlab.config.ssh_path + "diaspora.git" }
  19 + it { gitolite.url_to_repo('diaspora').should == Gitlab.config.gitolite.ssh_path_prefix + "diaspora.git" }
20 20  
21 21 it "should call config update" do
22 22 gitolite_config.should_receive(:update_project!)
... ...
spec/lib/project_mover_spec.rb
... ... @@ -6,7 +6,7 @@ describe Gitlab::ProjectMover do
6 6 before do
7 7 FileUtils.rm_rf base_path if File.exists? base_path
8 8  
9   - Gitlab.config.stub(git_base_path: base_path)
  9 + Gitlab.config.gitolite.stub(repos_path: base_path)
10 10  
11 11 @project = create(:project)
12 12 end
... ...
spec/models/project_hooks_spec.rb
... ... @@ -108,7 +108,7 @@ describe Project, &quot;Hooks&quot; do
108 108 it { should include(id: @commit.id) }
109 109 it { should include(message: @commit.safe_message) }
110 110 it { should include(timestamp: @commit.date.xmlschema) }
111   - it { should include(url: "#{Gitlab.config.url}/#{project.code}/commit/#{@commit.id}") }
  111 + it { should include(url: "#{Gitlab.config.gitlab.url}/#{project.code}/commit/#{@commit.id}") }
112 112  
113 113 context "with a author" do
114 114 subject { @data[:commits].first[:author] }
... ...
spec/models/project_spec.rb
... ... @@ -148,7 +148,7 @@ describe Project do
148 148  
149 149 it "should return valid url to repo" do
150 150 project = Project.new(path: "somewhere")
151   - project.url_to_repo.should == Gitlab.config.ssh_path + "somewhere.git"
  151 + project.url_to_repo.should == Gitlab.config.gitolite.ssh_path_prefix + "somewhere.git"
152 152 end
153 153  
154 154 it "should return path to repo" do
... ... @@ -158,7 +158,7 @@ describe Project do
158 158  
159 159 it "returns the full web URL for this repo" do
160 160 project = Project.new(path: "somewhere")
161   - project.web_url.should == "#{Gitlab.config.url}/somewhere"
  161 + project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere"
162 162 end
163 163  
164 164 describe "last_activity methods" do
... ...
spec/spec_helper.rb
... ... @@ -42,8 +42,8 @@ RSpec.configure do |config|
42 42 # ActiveRecord::Base.observers.enable(:all)
43 43  
44 44 # Use tmp dir for FS manipulations
45   - Gitlab.config.stub(git_base_path: Rails.root.join('tmp', 'test-git-base-path'))
46   - FileUtils.rm_rf Gitlab.config.git_base_path
47   - FileUtils.mkdir_p Gitlab.config.git_base_path
  45 + Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
  46 + FileUtils.rm_rf Gitlab.config.gitolite.repos_path
  47 + FileUtils.mkdir_p Gitlab.config.gitolite.repos_path
48 48 end
49 49 end
... ...
spec/workers/post_receive_spec.rb
... ... @@ -39,6 +39,6 @@ describe PostReceive do
39 39 end
40 40  
41 41 def pwd(project)
42   - File.join(Gitlab.config.git_base_path, project.path_with_namespace)
  42 + File.join(Gitlab.config.gitolite.repos_path, project.path_with_namespace)
43 43 end
44 44 end
... ...