diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-09 14:30:49 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-02-09 14:30:49 +0400 |
commit | 433f2dbceff3a597707d1375b519491737adf6e5 (patch) | |
tree | a927006ee7dcf262f851229a2a35797f2c141314 /lib | |
parent | 2f0a75ab77af430f682d67aa9bb865007d832795 (diff) |
task to build missing projects with gitlab-shell
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/gitlab/shell.rake | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 25713482ed8..c02fbad0214 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -1,9 +1,25 @@ namespace :gitlab do namespace :shell do desc "GITLAB | Setup gitlab-shell" - task :setup => :environment do + task setup: :environment do setup end + + desc "GITLAB | Build missing projects" + task build_missing_projects: :environment do + Project.find_each(batch_size: 1000) do |project| + path_to_repo = File.join(Gitlab.config.gitolite.repos_path, "#{project.path_with_namespace}.git") + if File.exists?(path_to_repo) + print '-' + else + if Gitlab::Shell.new.add_repository(project.path_with_namespace) + print '.' + else + print 'F' + end + end + end + end end def setup @@ -16,7 +32,7 @@ namespace :gitlab do system("echo '# Managed by gitlab-shell' > /home/git/.ssh/authorized_keys") - Key.find_each(:batch_size => 1000) do |key| + Key.find_each(batch_size: 1000) do |key| if Gitlab::Shell.new.add_key(key.shell_id, key.key) print '.' else |