gitlab-org--gitlab-foss/lib/tasks/gitlab/enable_automerge.rake
Jacob Vosmaer bcfd9386f5 Fix popen bug in rake gitlab:satellites:create
The Satellite#create method no longer sets the `$?` global variable.
Instead, we can use the method return value to test if the satellite was
created successfully
2014-04-07 11:22:27 +02:00

39 lines
858 B
Ruby

namespace :gitlab do
namespace :satellites do
desc "GITLAB | Create satellite repos"
task create: :environment do
create_satellites
end
end
def create_satellites
warn_user_is_not_gitlab
print "Creating satellites for ..."
unless Project.count > 0
puts "skipping, because you have no projects".magenta
return
end
puts ""
Project.find_each(batch_size: 100) do |project|
print "#{project.name_with_namespace.yellow} ... "
unless project.repo_exists?
puts "skipping, because the repo is empty".magenta
next
end
if project.satellite.exists?
puts "exists already".green
else
print "\n... "
if project.satellite.create
puts "created".green
else
puts "error".red
end
end
end
end
end