Commit 430d3ad45b524943fb3b62890c5a3cdc72e70325
1 parent
224da711
Exists in
master
and in
4 other branches
Update output of gitlab:enable_automerge
Showing
1 changed file
with
31 additions
and
5 deletions
Show diff stats
lib/tasks/gitlab/enable_automerge.rake
| 1 | 1 | namespace :gitlab do |
| 2 | 2 | desc "GITLAB | Enable auto merge" |
| 3 | 3 | task :enable_automerge => :environment do |
| 4 | + warn_user_is_not_gitlab | |
| 5 | + | |
| 6 | + puts "Updating repo permissions ..." | |
| 4 | 7 | Gitlab::Gitolite.new.enable_automerge |
| 8 | + puts "... #{"done".green}" | |
| 9 | + puts "" | |
| 10 | + | |
| 11 | + print "Creating satellites for ..." | |
| 12 | + unless Project.count > 0 | |
| 13 | + puts "skipping, because you have no projects".magenta | |
| 14 | + return | |
| 15 | + end | |
| 16 | + puts "" | |
| 17 | + | |
| 18 | + Project.find_each(batch_size: 100) do |project| | |
| 19 | + print "#{project.name_with_namespace.yellow} ... " | |
| 5 | 20 | |
| 6 | - Project.find_each do |project| | |
| 7 | - if project.repo_exists? && !project.satellite.exists? | |
| 8 | - puts "Creating satellite for #{project.name}...".green | |
| 21 | + unless project.repo_exists? | |
| 22 | + puts "skipping, because the repo is empty".magenta | |
| 23 | + next | |
| 24 | + end | |
| 25 | + | |
| 26 | + if project.satellite.exists? | |
| 27 | + puts "exists already".green | |
| 28 | + else | |
| 29 | + puts "" | |
| 9 | 30 | project.satellite.create |
| 31 | + | |
| 32 | + print "... " | |
| 33 | + if $?.success? | |
| 34 | + puts "created".green | |
| 35 | + else | |
| 36 | + puts "error".red | |
| 37 | + end | |
| 10 | 38 | end |
| 11 | 39 | end |
| 12 | - | |
| 13 | - puts "Done!".green | |
| 14 | 40 | end |
| 15 | 41 | |
| 16 | 42 | namespace :satellites do | ... | ... |