Commit 433f2dbceff3a597707d1375b519491737adf6e5

Authored by Dmitriy Zaporozhets
1 parent 2f0a75ab

task to build missing projects with gitlab-shell

Showing 1 changed file with 18 additions and 2 deletions   Show diff stats
lib/tasks/gitlab/shell.rake
1 1 namespace :gitlab do
2 2 namespace :shell do
3 3 desc "GITLAB | Setup gitlab-shell"
4   - task :setup => :environment do
  4 + task setup: :environment do
5 5 setup
6 6 end
  7 +
  8 + desc "GITLAB | Build missing projects"
  9 + task build_missing_projects: :environment do
  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")
  12 + if File.exists?(path_to_repo)
  13 + print '-'
  14 + else
  15 + if Gitlab::Shell.new.add_repository(project.path_with_namespace)
  16 + print '.'
  17 + else
  18 + print 'F'
  19 + end
  20 + end
  21 + end
  22 + end
7 23 end
8 24  
9 25 def setup
... ... @@ -16,7 +32,7 @@ namespace :gitlab do
16 32  
17 33 system("echo '# Managed by gitlab-shell' > /home/git/.ssh/authorized_keys")
18 34  
19   - Key.find_each(:batch_size => 1000) do |key|
  35 + Key.find_each(batch_size: 1000) do |key|
20 36 if Gitlab::Shell.new.add_key(key.shell_id, key.key)
21 37 print '.'
22 38 else
... ...