Commit d64090b8a9065746c6d532057228c079a1d57013

Authored by Dmitriy Zaporozhets
1 parent 8e0b58d7

No gitolite in project any more

CHANGELOG
1 1 v 5.0.0
2   - - replaced gitolite with gitlab-shell
  2 + - Replaced gitolite with gitlab-shell
3 3  
4 4 v 4.2.0
  5 + - Teams
5 6 - User show page. Via /u/username
6 7 - Show help contents on pages for better navigation
7 8  
... ...
app/controllers/admin/projects_controller.rb
... ... @@ -41,9 +41,7 @@ class Admin::ProjectsController < Admin::ApplicationController
41 41 end
42 42  
43 43 def destroy
44   - # Delete team first in order to prevent multiple gitolite calls
45 44 @project.team.truncate
46   -
47 45 @project.destroy
48 46  
49 47 redirect_to admin_projects_path, notice: 'Project was successfully deleted.'
... ...
app/controllers/errors_controller.rb
1 1 class ErrorsController < ApplicationController
2   - def githost
3   - render "errors/gitolite"
4   - end
5 2 end
... ...
app/controllers/projects_controller.rb
... ... @@ -93,9 +93,7 @@ class ProjectsController &lt; ProjectResourceController
93 93 def destroy
94 94 return access_denied! unless can?(current_user, :remove_project, project)
95 95  
96   - # Delete team first in order to prevent multiple gitolite calls
97 96 project.team.truncate
98   -
99 97 project.destroy
100 98  
101 99 respond_to do |format|
... ...
app/models/namespace.rb
... ... @@ -31,8 +31,6 @@ class Namespace &lt; ActiveRecord::Base
31 31  
32 32 scope :root, where('type IS NULL')
33 33  
34   - attr_accessor :require_update_gitolite
35   -
36 34 def self.search query
37 35 where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
38 36 end
... ... @@ -60,13 +58,13 @@ class Namespace &lt; ActiveRecord::Base
60 58 end
61 59  
62 60 def namespace_full_path
63   - @namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path)
  61 + @namespace_full_path ||= File.join(Gitlab.config.gitlab_shell.repos_path, path)
64 62 end
65 63  
66 64 def move_dir
67 65 if path_changed?
68   - old_path = File.join(Gitlab.config.gitolite.repos_path, path_was)
69   - new_path = File.join(Gitlab.config.gitolite.repos_path, path)
  66 + old_path = File.join(Gitlab.config.gitlab_shell.repos_path, path_was)
  67 + new_path = File.join(Gitlab.config.gitlab_shell.repos_path, path)
70 68 if File.exists?(new_path)
71 69 raise "Already exists"
72 70 end
... ... @@ -81,7 +79,6 @@ class Namespace &lt; ActiveRecord::Base
81 79  
82 80 FileUtils.mv( old_path, new_path )
83 81 send_update_instructions
84   - @require_update_gitolite = true
85 82 rescue Exception => e
86 83 raise "Namespace move error #{old_path} #{new_path}"
87 84 end
... ... @@ -89,7 +86,7 @@ class Namespace &lt; ActiveRecord::Base
89 86 end
90 87  
91 88 def rm_dir
92   - dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
  89 + dir_path = File.join(Gitlab.config.gitlab_shell.repos_path, path)
93 90 FileUtils.rm_r( dir_path, force: true )
94 91 end
95 92  
... ...
app/models/project.rb
... ... @@ -140,10 +140,6 @@ class Project &lt; ActiveRecord::Base
140 140 nil
141 141 end
142 142  
143   - def git_error?
144   - error_code == :gitolite
145   - end
146   -
147 143 def saved?
148 144 id && valid?
149 145 end
... ... @@ -157,7 +153,7 @@ class Project &lt; ActiveRecord::Base
157 153 end
158 154  
159 155 def repo_name
160   - denied_paths = %w(gitolite-admin admin dashboard groups help profile projects search)
  156 + denied_paths = %w(admin dashboard groups help profile projects search)
161 157  
162 158 if denied_paths.include?(path)
163 159 errors.add(:path, "like #{path} is not allowed")
... ... @@ -450,7 +446,7 @@ class Project &lt; ActiveRecord::Base
450 446 end
451 447  
452 448 def url_to_repo
453   - gitolite.url_to_repo(path_with_namespace)
  449 + gitlab_shell.url_to_repo(path_with_namespace)
454 450 end
455 451  
456 452 def namespace_dir
... ...
app/models/repository.rb
... ... @@ -25,7 +25,7 @@ class Repository
25 25 end
26 26  
27 27 def path_to_repo
28   - @path_to_repo ||= File.join(Gitlab.config.gitolite.repos_path, "#{path_with_namespace}.git")
  28 + @path_to_repo ||= File.join(Gitlab.config.gitlab_shell.repos_path, "#{path_with_namespace}.git")
29 29 end
30 30  
31 31 def repo
... ...
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.gitolite.repos_path, @group.path)
  25 + %span.monospace= File.join(Gitlab.config.gitlab_shell.repos_path, @group.path)
26 26 %tr
27 27 %td
28 28 %b
... ...
app/views/errors/gitolite.html.haml
... ... @@ -1,25 +0,0 @@
1   -%h1.http_status_code 500
2   -%h3.page_title GitLab was unable to access your Gitolite system.
3   -%hr
4   -
5   -.git_error_tips
6   - %h4 Tips for Administrator:
7   - %ol
8   - %li
9   - %p
10   - Check git logs in admin area
11   - %li
12   - %p
13   - Check config/gitlab.yml for correct settings.
14   - %li
15   - %p
16   - Diagnostic tool:
17   - %pre
18   - bundle exec rake gitlab:check RAILS_ENV=production
19   - %li
20   - %p
21   - Permissions:
22   - %pre
23   - = preserve do
24   - sudo chown -R git:git #{Gitlab.config.gitolite.repos_path}
25   - sudo chmod -R ug+rwXs #{Gitlab.config.gitolite.repos_path}
app/workers/gitlab_shell_worker.rb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +class GitoliteWorker
  2 + include Sidekiq::Worker
  3 + include Gitolited
  4 +
  5 + sidekiq_options queue: :gitlab_shell
  6 +
  7 + def perform(action, *arg)
  8 + gitlab_shell.send(action, *arg)
  9 + end
  10 +end
... ...
app/workers/gitolite_worker.rb
... ... @@ -1,10 +0,0 @@
1   -class GitoliteWorker
2   - include Sidekiq::Worker
3   - include Gitolited
4   -
5   - sidekiq_options queue: :gitolite
6   -
7   - def perform(action, *arg)
8   - gitolite.send(action, *arg)
9   - end
10   -end
app/workers/post_receive.rb
... ... @@ -5,10 +5,10 @@ class PostReceive
5 5  
6 6 def perform(repo_path, oldrev, newrev, ref, identifier)
7 7  
8   - if repo_path.start_with?(Gitlab.config.gitolite.repos_path.to_s)
9   - repo_path.gsub!(Gitlab.config.gitolite.repos_path.to_s, "")
  8 + if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s)
  9 + repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "")
10 10 else
11   - Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitolite.repos_path variable. \"#{Gitlab.config.gitolite.repos_path}\" does not match \"#{repo_path}\"")
  11 + Gitlab::GitLogger.error("POST-RECEIVE: Check gitlab.yml config for correct gitlab_shell.repos_path variable. \"#{Gitlab.config.gitlab_shell.repos_path}\" does not match \"#{repo_path}\"")
12 12 end
13 13  
14 14 repo_path.gsub!(/.git$/, "")
... ... @@ -22,7 +22,8 @@ class PostReceive
22 22 end
23 23  
24 24 # Ignore push from non-gitlab users
25   - user = if identifier.eql? Gitlab.config.gitolite.admin_key
  25 + user = if identifier.nil?
  26 + raise identifier.inspect
26 27 email = project.repository.commit(newrev).author.email rescue nil
27 28 User.find_by_email(email) if email
28 29 elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier)
... ...
config/gitlab.yml.example
... ... @@ -5,8 +5,7 @@
5 5 # How to use:
6 6 # 1. copy file as gitlab.yml
7 7 # 2. Replace gitlab -> host with your domain
8   -# 3. Replace gitolite -> ssh_host with your domain
9   -# 4. Replace gitlab -> email_from
  8 +# 3. Replace gitlab -> email_from
10 9  
11 10 #
12 11 # 1. GitLab app settings
... ... @@ -22,8 +21,8 @@ gitlab:
22 21 # Note that ENV['RAILS_RELATIVE_URL_ROOT'] in config/unicorn.rb may need to be changed
23 22 # relative_url_root: /gitlab
24 23  
25   - # Uncomment and customize if you can't use the default user to run GitLab (default: 'gitlab')
26   - # user: user123
  24 + # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
  25 + # user: git
27 26  
28 27 ## Email settings
29 28 # Email address used in the "From" field in mails sent by GitLab
... ... @@ -103,21 +102,18 @@ backup:
103 102 path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
104 103 # keep_time: 604800 # default: 0 (forever) (in seconds)
105 104  
106   -## Gitolite settings
107   -gitolite:
  105 +## GitLab Shell settings
  106 +gitlab_shell:
108 107 # REPOS_PATH MUST NOT BE A SYMLINK!!!
109 108 repos_path: /home/git/repositories/
110 109 hooks_path: /home/git/gitlab-shell/hooks/
111   - admin_key: gitlab
  110 +
  111 + # Git over HTTP
112 112 upload_pack: true
113 113 receive_pack: true
114   - ssh_user: git
115   - ssh_host: localhost
116   - # ssh_port: 22
117   - # config_file: gitolite.conf
118 114  
119   - # Uncomment and customize if you can't use the default group to own the repositories and run Gitolite (default: same as the 'ssh_user' above)
120   - # owner_group: group123
  115 + # If you use non-standart ssh port you need to specify it
  116 + # ssh_port: 22
121 117  
122 118 ## Git settings
123 119 # CAUTION!
... ...
config/initializers/1_settings.rb
... ... @@ -8,11 +8,11 @@ class Settings &lt; Settingslogic
8 8  
9 9 private
10 10  
11   - def build_gitolite_ssh_path_prefix
12   - if gitolite.ssh_port != 22
13   - "ssh://#{gitolite.ssh_user}@#{gitolite.ssh_host}:#{gitolite.ssh_port}/"
  11 + def build_gitlab_shell_ssh_path_prefix
  12 + if gitlab_shell.ssh_port != 22
  13 + "ssh://#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:#{gitlab_shell.ssh_port}/"
14 14 else
15   - "#{gitolite.ssh_user}@#{gitolite.ssh_host}:"
  15 + "#{gitlab_shell.ssh_user}@#{gitlab_shell.ssh_host}:"
16 16 end
17 17 end
18 18  
... ... @@ -41,6 +41,9 @@ Settings[&#39;omniauth&#39;] ||= Settingslogic.new({})
41 41 Settings.omniauth['enabled'] = false if Settings.omniauth['enabled'].nil?
42 42 Settings.omniauth['providers'] ||= []
43 43  
  44 +#
  45 +# GitLab
  46 +#
44 47 Settings['gitlab'] ||= Settingslogic.new({})
45 48 Settings.gitlab['default_projects_limit'] ||= 10
46 49 Settings.gitlab['host'] ||= 'localhost'
... ... @@ -54,29 +57,38 @@ Settings.gitlab[&#39;url&#39;] ||= Settings.send(:build_gitlab_url)
54 57 Settings.gitlab['user'] ||= 'git'
55 58 Settings.gitlab['signup_enabled'] ||= false
56 59  
  60 +#
  61 +# Gravatar
  62 +#
57 63 Settings['gravatar'] ||= Settingslogic.new({})
58 64 Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil?
59 65 Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
60 66 Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
61 67  
62   -Settings['gitolite'] ||= Settingslogic.new({})
63   -Settings.gitolite['admin_key'] ||= 'gitlab'
64   -Settings.gitolite['admin_uri'] ||= 'git@localhost:gitolite-admin'
65   -Settings.gitolite['config_file'] ||= 'gitolite.conf'
66   -Settings.gitolite['hooks_path'] ||= '/home/git/share/gitolite/hooks/'
67   -Settings.gitolite['receive_pack'] = true if Settings.gitolite['receive_pack'].nil?
68   -Settings.gitolite['upload_pack'] = true if Settings.gitolite['upload_pack'].nil?
69   -Settings.gitolite['repos_path'] ||= '/home/git/repositories/'
70   -Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
71   -Settings.gitolite['ssh_port'] ||= 22
72   -Settings.gitolite['ssh_user'] ||= 'git'
73   -Settings.gitolite['owner_group'] ||= Settings.gitolite.ssh_user
74   -Settings.gitolite['ssh_path_prefix'] ||= Settings.send(:build_gitolite_ssh_path_prefix)
  68 +#
  69 +# GitLab Shell
  70 +#
  71 +Settings['gitlab_shell'] ||= Settingslogic.new({})
  72 +Settings.gitlab_shell['hooks_path'] ||= '/home/git/gitlab-shell/hooks/'
  73 +Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil?
  74 +Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil?
  75 +Settings.gitlab_shell['repos_path'] ||= '/home/git/repositories/'
  76 +Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
  77 +Settings.gitlab_shell['ssh_port'] ||= 22
  78 +Settings.gitlab_shell['ssh_user'] ||= Settings.gitlab.user
  79 +Settings.gitlab_shell['owner_group'] ||= Settings.gitlab.user
  80 +Settings.gitlab_shell['ssh_path_prefix'] ||= Settings.send(:build_gitlab_shell_ssh_path_prefix)
75 81  
  82 +#
  83 +# Backup
  84 +#
76 85 Settings['backup'] ||= Settingslogic.new({})
77 86 Settings.backup['keep_time'] ||= 0
78 87 Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root)
79 88  
  89 +#
  90 +# Git
  91 +#
80 92 Settings['git'] ||= Settingslogic.new({})
81 93 Settings.git['max_size'] ||= 5242880 # 5.megabytes
82 94 Settings.git['bin_path'] ||= '/usr/bin/git'
... ...
config/routes.rb
... ... @@ -18,9 +18,9 @@ Gitlab::Application.routes.draw do
18 18 # Enable Grack support
19 19 mount Grack::Bundle.new({
20 20 git_path: Gitlab.config.git.bin_path,
21   - project_root: Gitlab.config.gitolite.repos_path,
22   - upload_pack: Gitlab.config.gitolite.upload_pack,
23   - receive_pack: Gitlab.config.gitolite.receive_pack
  21 + project_root: Gitlab.config.gitlab_shell.repos_path,
  22 + upload_pack: Gitlab.config.gitlab_shell.upload_pack,
  23 + receive_pack: Gitlab.config.gitlab_shell.receive_pack
24 24 }), at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }
25 25  
26 26 #
... ...
features/support/env.rb
... ... @@ -31,9 +31,9 @@ DatabaseCleaner.strategy = :truncation
31 31  
32 32 Spinach.hooks.before_scenario do
33 33 # Use tmp dir for FS manipulations
34   - Gitlab.config.gitolite.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
35   - FileUtils.rm_rf Gitlab.config.gitolite.repos_path
36   - FileUtils.mkdir_p Gitlab.config.gitolite.repos_path
  34 + Gitlab.config.gitlab_shell.stub(repos_path: Rails.root.join('tmp', 'test-git-base-path'))
  35 + FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path
  36 + FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path
37 37 end
38 38  
39 39 Spinach.hooks.after_scenario do
... ...
lib/gitlab/backend/shell.rb
... ... @@ -44,7 +44,7 @@ module Gitlab
44 44  
45 45  
46 46 def url_to_repo path
47   - Gitlab.config.gitolite.ssh_path_prefix + "#{path}.git"
  47 + Gitlab.config.gitlab_shell.ssh_path_prefix + "#{path}.git"
48 48 end
49 49 end
50 50 end
... ...
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.gitolite.repos_path, new_dir)
  18 + new_dir_path = File.join(Gitlab.config.gitlab_shell.repos_path, new_dir)
19 19 FileUtils.mkdir( new_dir_path, mode: 0770 ) unless File.exists?(new_dir_path)
20 20  
21   - old_path = File.join(Gitlab.config.gitolite.repos_path, old_dir, "#{project.path}.git")
  21 + old_path = File.join(Gitlab.config.gitlab_shell.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/gitolited.rb
1 1 # == Gitolited mixin
2 2 #
3   -# Provide a shortcut to Gitlab::Gitolite instance by gitolite
  3 +# Provide a shortcut to Gitlab::Shell instance by gitlab_shell
4 4 #
5 5 # Used by Project, UsersProject, etc
6 6 #
7 7 module Gitolited
8   - def gitolite
  8 + def gitlab_shell
9 9 Gitlab::Shell.new
10 10 end
11 11 end
... ...
lib/tasks/gitlab/backup.rake
... ... @@ -144,7 +144,7 @@ namespace :gitlab do
144 144  
145 145 task :restore => :environment do
146 146 backup_path_repo = File.join(Gitlab.config.backup.path, "repositories")
147   - repos_path = Gitlab.config.gitolite.repos_path
  147 + repos_path = Gitlab.config.gitlab_shell.repos_path
148 148  
149 149 puts "Restoring repositories ... "
150 150  
... ...
lib/tasks/gitlab/check.rake
1 1 namespace :gitlab do
2 2 desc "GITLAB | Check the configuration of GitLab and its environment"
3 3 task check: %w{gitlab:env:check
4   - gitlab:gitolite:check
  4 + gitlab:gitlab_shell:check
5 5 gitlab:sidekiq:check
6 6 gitlab:app:check}
7 7  
... ... @@ -296,10 +296,10 @@ namespace :gitlab do
296 296  
297 297 # see https://github.com/gitlabhq/gitlabhq/issues/1059
298 298 def check_issue_1059_shell_profile_error
299   - gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
300   - print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
  299 + gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
  300 + print "Has no \"-e\" in ~#{gitlab_shell_ssh_user}/.profile ... "
301 301  
302   - profile_file = File.join(gitolite_user_home, ".profile")
  302 + profile_file = File.join(gitlab_shell_user_home, ".profile")
303 303  
304 304 unless File.read(profile_file) =~ /^-e PATH/
305 305 puts "yes".green
... ... @@ -367,7 +367,7 @@ namespace :gitlab do
367 367  
368 368  
369 369  
370   - namespace :gitolite do
  370 + namespace :gitlab_shell do
371 371 desc "GITLAB | Check the configuration of Gitolite"
372 372 task check: :environment do
373 373 warn_user_is_not_gitlab
... ... @@ -392,25 +392,25 @@ namespace :gitlab do
392 392 print "post-receive hook up-to-date? ... "
393 393  
394 394 hook_file = "post-receive"
395   - gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
396   - gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
397   - gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
  395 + gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
  396 + gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
  397 + gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
398 398  
399   - unless File.exists?(gitolite_hook_file)
  399 + unless File.exists?(gitlab_shell_hook_file)
400 400 puts "can't check because of previous errors".magenta
401 401 return
402 402 end
403 403  
404   - gitolite_hook_content = File.read(gitolite_hook_file)
  404 + gitlab_shell_hook_content = File.read(gitlab_shell_hook_file)
405 405 gitlab_hook_file = Rails.root.join.join("lib", "hooks", hook_file)
406 406 gitlab_hook_content = File.read(gitlab_hook_file)
407 407  
408   - if gitolite_hook_content == gitlab_hook_content
  408 + if gitlab_shell_hook_content == gitlab_hook_content
409 409 puts "yes".green
410 410 else
411 411 puts "no".red
412 412 try_fixing_it(
413   - "sudo -u #{gitolite_ssh_user} cp #{gitlab_hook_file} #{gitolite_hook_file}"
  413 + "sudo -u #{gitlab_shell_ssh_user} cp #{gitlab_hook_file} #{gitlab_shell_hook_file}"
414 414 )
415 415 for_more_information(
416 416 see_installation_guide_section "Setup GitLab Hooks"
... ... @@ -422,7 +422,7 @@ namespace :gitlab do
422 422 def check_repo_base_exists
423 423 print "Repo base directory exists? ... "
424 424  
425   - repo_base_path = Gitlab.config.gitolite.repos_path
  425 + repo_base_path = Gitlab.config.gitlab_shell.repos_path
426 426  
427 427 if File.exists?(repo_base_path)
428 428 puts "yes".green
... ... @@ -444,7 +444,7 @@ namespace :gitlab do
444 444 def check_repo_base_is_not_symlink
445 445 print "Repo base directory is a symlink? ... "
446 446  
447   - repo_base_path = Gitlab.config.gitolite.repos_path
  447 + repo_base_path = Gitlab.config.gitlab_shell.repos_path
448 448 unless File.exists?(repo_base_path)
449 449 puts "can't check because of previous errors".magenta
450 450 return
... ... @@ -464,7 +464,7 @@ namespace :gitlab do
464 464 def check_repo_base_permissions
465 465 print "Repo base access is drwxrws---? ... "
466 466  
467   - repo_base_path = Gitlab.config.gitolite.repos_path
  467 + repo_base_path = Gitlab.config.gitlab_shell.repos_path
468 468 unless File.exists?(repo_base_path)
469 469 puts "can't check because of previous errors".magenta
470 470 return
... ... @@ -487,23 +487,23 @@ namespace :gitlab do
487 487 end
488 488  
489 489 def check_repo_base_user_and_group
490   - gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
491   - gitolite_owner_group = Gitlab.config.gitolite.owner_group
492   - print "Repo base owned by #{gitolite_ssh_user}:#{gitolite_owner_group}? ... "
  490 + gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
  491 + gitlab_shell_owner_group = Gitlab.config.gitlab_shell.owner_group
  492 + print "Repo base owned by #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group}? ... "
493 493  
494   - repo_base_path = Gitlab.config.gitolite.repos_path
  494 + repo_base_path = Gitlab.config.gitlab_shell.repos_path
495 495 unless File.exists?(repo_base_path)
496 496 puts "can't check because of previous errors".magenta
497 497 return
498 498 end
499 499  
500   - if File.stat(repo_base_path).uid == uid_for(gitolite_ssh_user) &&
501   - File.stat(repo_base_path).gid == gid_for(gitolite_owner_group)
  500 + if File.stat(repo_base_path).uid == uid_for(gitlab_shell_ssh_user) &&
  501 + File.stat(repo_base_path).gid == gid_for(gitlab_shell_owner_group)
502 502 puts "yes".green
503 503 else
504 504 puts "no".red
505 505 try_fixing_it(
506   - "sudo chown -R #{gitolite_ssh_user}:#{gitolite_owner_group} #{repo_base_path}"
  506 + "sudo chown -R #{gitlab_shell_ssh_user}:#{gitlab_shell_owner_group} #{repo_base_path}"
507 507 )
508 508 for_more_information(
509 509 see_installation_guide_section "Gitolite"
... ... @@ -516,11 +516,11 @@ namespace :gitlab do
516 516 print "post-receive hooks in repos are links: ... "
517 517  
518 518 hook_file = "post-receive"
519   - gitolite_hooks_path = File.join(Gitlab.config.gitolite.hooks_path, "common")
520   - gitolite_hook_file = File.join(gitolite_hooks_path, hook_file)
521   - gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
  519 + gitlab_shell_hooks_path = File.join(Gitlab.config.gitlab_shell.hooks_path, "common")
  520 + gitlab_shell_hook_file = File.join(gitlab_shell_hooks_path, hook_file)
  521 + gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user
522 522  
523   - unless File.exists?(gitolite_hook_file)
  523 + unless File.exists?(gitlab_shell_hook_file)
524 524 puts "can't check because of previous errors".magenta
525 525 return
526 526 end
... ... @@ -542,7 +542,7 @@ namespace :gitlab do
542 542 unless File.exists?(project_hook_file)
543 543 puts "missing".red
544 544 try_fixing_it(
545   - "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
  545 + "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
546 546 )
547 547 for_more_information(
548 548 "lib/support/rewrite-hooks.sh"
... ... @@ -552,12 +552,12 @@ namespace :gitlab do
552 552 end
553 553  
554 554 if File.lstat(project_hook_file).symlink? &&
555   - File.realpath(project_hook_file) == File.realpath(gitolite_hook_file)
  555 + File.realpath(project_hook_file) == File.realpath(gitlab_shell_hook_file)
556 556 puts "ok".green
557 557 else
558 558 puts "not a link to Gitolite's hook".red
559 559 try_fixing_it(
560   - "sudo -u #{gitolite_ssh_user} ln -sf #{gitolite_hook_file} #{project_hook_file}"
  560 + "sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
561 561 )
562 562 for_more_information(
563 563 "lib/support/rewrite-hooks.sh"
... ... @@ -572,19 +572,19 @@ namespace :gitlab do
572 572 # Helper methods
573 573 ########################
574 574  
575   - def gitolite_user_home
576   - File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
  575 + def gitlab_shell_user_home
  576 + File.expand_path("~#{Gitlab.config.gitlab_shell.ssh_user}")
577 577 end
578 578  
579   - def gitolite_version
580   - gitolite_version_file = "#{gitolite_user_home}/gitolite/src/VERSION"
581   - if File.readable?(gitolite_version_file)
582   - File.read(gitolite_version_file)
  579 + def gitlab_shell_version
  580 + gitlab_shell_version_file = "#{gitlab_shell_user_home}/gitlab_shell/src/VERSION"
  581 + if File.readable?(gitlab_shell_version_file)
  582 + File.read(gitlab_shell_version_file)
583 583 end
584 584 end
585 585  
586   - def has_gitolite3?
587   - gitolite_version.try(:start_with?, "v3.")
  586 + def has_gitlab_shell3?
  587 + gitlab_shell_version.try(:start_with?, "v3.")
588 588 end
589 589 end
590 590  
... ...
lib/tasks/gitlab/cleanup.rake
... ... @@ -7,7 +7,7 @@ namespace :gitlab do
7 7  
8 8  
9 9 namespaces = Namespace.pluck(:path)
10   - git_base_path = Gitlab.config.gitolite.repos_path
  10 + git_base_path = Gitlab.config.gitlab_shell.repos_path
11 11 all_dirs = Dir.glob(git_base_path + '/*')
12 12  
13 13 puts git_base_path.yellow
... ... @@ -48,7 +48,7 @@ namespace :gitlab do
48 48 warn_user_is_not_gitlab
49 49 remove_flag = ENV['REMOVE']
50 50  
51   - git_base_path = Gitlab.config.gitolite.repos_path
  51 + git_base_path = Gitlab.config.gitlab_shell.repos_path
52 52 all_dirs = Dir.glob(git_base_path + '/*')
53 53  
54 54 global_projects = Project.where(namespace_id: nil).pluck(:path)
... ... @@ -68,13 +68,6 @@ namespace :gitlab do
68 68 global_projects.include?(path)
69 69 end
70 70  
71   - # skip gitolite admin
72   - all_dirs.reject! do |dir|
73   - repo_name = File.basename dir
74   - repo_name == 'gitolite-admin.git'
75   - end
76   -
77   -
78 71 all_dirs.each do |dir_path|
79 72 if remove_flag
80 73 if FileUtils.rm_rf dir_path
... ...
lib/tasks/gitlab/enable_namespaces.rake
... ... @@ -6,11 +6,6 @@ namespace :gitlab do
6 6 migrate_user_namespaces
7 7 migrate_groups
8 8 migrate_projects
9   -
10   - puts "Rebuild Gitolite ... "
11   - gitolite = Gitlab::Gitolite.new
12   - gitolite.update_repositories(Project.where('namespace_id IS NOT NULL'))
13   - puts "... #{"done".green}"
14 9 end
15 10  
16 11 def migrate_user_namespaces
... ... @@ -80,7 +75,7 @@ namespace :gitlab do
80 75 end
81 76  
82 77 def migrate_projects
83   - git_path = Gitlab.config.gitolite.repos_path
  78 + git_path = Gitlab.config.gitlab_shell.repos_path
84 79 puts "\nMove projects in groups into respective directories ... ".blue
85 80 Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
86 81 next unless project.group
... ...
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.gitolite.repos_path
  15 + git_base_path = Gitlab.config.gitlab_shell.repos_path
16 16 repos_to_import = Dir.glob(git_base_path + '/*')
17 17  
18 18 namespaces = Namespace.pluck(:path)
... ... @@ -26,7 +26,6 @@ namespace :gitlab do
26 26 # skip if not git repo
27 27 next unless repo_name =~ /.git$/
28 28  
29   - # skip gitolite admin
30 29 next if repo_name == 'gitolite-admin.git'
31 30  
32 31 path = repo_name.sub(/\.git$/, '')
... ...
lib/tasks/gitlab/info.rake
... ... @@ -54,16 +54,16 @@ namespace :gitlab do
54 54  
55 55  
56 56 # check Gitolite version
57   - gitolite_version_file = "#{Gitlab.config.gitolite.repos_path}/../gitlab-shell/VERSION"
58   - if File.readable?(gitolite_version_file)
59   - gitolite_version = File.read(gitolite_version_file)
  57 + gitlab_shell_version_file = "#{Gitlab.config.gitlab_shell.repos_path}/../gitlab-shell/VERSION"
  58 + if File.readable?(gitlab_shell_version_file)
  59 + gitlab_shell_version = File.read(gitlab_shell_version_file)
60 60 end
61 61  
62 62 puts ""
63 63 puts "GitLab Shell".yellow
64   - puts "Version:\t#{gitolite_version || "unknown".red}"
65   - puts "Repositories:\t#{Gitlab.config.gitolite.repos_path}"
66   - puts "Hooks:\t\t#{Gitlab.config.gitolite.hooks_path}"
  64 + puts "Version:\t#{gitlab_shell_version || "unknown".red}"
  65 + puts "Repositories:\t#{Gitlab.config.gitlab_shell.repos_path}"
  66 + puts "Hooks:\t\t#{Gitlab.config.gitlab_shell.hooks_path}"
67 67 puts "Git:\t\t#{Gitlab.config.git.bin_path}"
68 68  
69 69 end
... ...
lib/tasks/gitlab/shell.rake
... ... @@ -8,7 +8,7 @@ namespace :gitlab do
8 8 desc "GITLAB | Build missing projects"
9 9 task build_missing_projects: :environment do
10 10 Project.find_each(batch_size: 1000) do |project|
11   - path_to_repo = File.join(Gitlab.config.gitolite.repos_path, "#{project.path_with_namespace}.git")
  11 + path_to_repo = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
12 12 if File.exists?(path_to_repo)
13 13 print '-'
14 14 else
... ...
lib/tasks/sidekiq.rake
... ... @@ -6,7 +6,7 @@ namespace :sidekiq do
6 6  
7 7 desc "GITLAB | Start sidekiq"
8 8 task :start do
9   - run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitolite,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
  9 + run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &"
10 10 end
11 11  
12 12 def pidfile
... ...
spec/spec_helper.rb
... ... @@ -35,7 +35,7 @@ RSpec.configure do |config|
35 35 config.before do
36 36 # Use tmp dir for FS manipulations
37 37 temp_repos_path = Rails.root.join('tmp', 'test-git-base-path')
38   - Gitlab.config.gitolite.stub(repos_path: temp_repos_path)
  38 + Gitlab.config.gitlab_shell.stub(repos_path: temp_repos_path)
39 39 FileUtils.rm_rf temp_repos_path
40 40 FileUtils.mkdir_p temp_repos_path
41 41 end
... ...