gitlab-org--gitlab-foss/lib/tasks/gitlab/enable_automerge.rake

43 lines
893 B
Ruby
Raw Normal View History

2012-04-21 05:45:43 -04:00
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} ... "
2012-04-21 05:45:43 -04:00
unless project.repo_exists?
puts "skipping, because the repo is empty".magenta
next
end
if project.satellite.exists?
puts "exists already".green
else
puts ""
project.satellite.create
print "... "
if $?.success?
puts "created".green
else
puts "error".red
end
2012-04-22 08:19:09 -04:00
end
2012-04-21 05:45:43 -04:00
end
end
end