2012-04-21 11:45:43 +02:00
|
|
|
namespace :gitlab do
|
2012-12-20 19:38:44 +01:00
|
|
|
desc "GITLAB | Enable auto merge"
|
|
|
|
task :enable_automerge => :environment do
|
2012-12-23 21:14:30 +01:00
|
|
|
warn_user_is_not_gitlab
|
|
|
|
|
|
|
|
puts "Updating repo permissions ..."
|
2012-12-20 19:38:44 +01:00
|
|
|
Gitlab::Gitolite.new.enable_automerge
|
2012-12-23 21:14:30 +01:00
|
|
|
puts "... #{"done".green}"
|
|
|
|
puts ""
|
|
|
|
|
|
|
|
print "Creating satellites for ..."
|
|
|
|
unless Project.count > 0
|
|
|
|
puts "skipping, because you have no projects".magenta
|
2012-12-25 07:43:50 +01:00
|
|
|
next
|
2012-12-23 21:14:30 +01:00
|
|
|
end
|
|
|
|
puts ""
|
|
|
|
|
|
|
|
Project.find_each(batch_size: 100) do |project|
|
|
|
|
print "#{project.name_with_namespace.yellow} ... "
|
2012-04-21 11:45:43 +02:00
|
|
|
|
2012-12-23 21:14:30 +01: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 ""
|
2012-12-20 19:38:44 +01:00
|
|
|
project.satellite.create
|
2012-12-23 21:14:30 +01:00
|
|
|
|
|
|
|
print "... "
|
|
|
|
if $?.success?
|
|
|
|
puts "created".green
|
|
|
|
else
|
|
|
|
puts "error".red
|
|
|
|
end
|
2012-04-22 14:19:09 +02:00
|
|
|
end
|
2012-04-21 11:45:43 +02:00
|
|
|
end
|
|
|
|
end
|
2012-12-20 21:52:26 +01:00
|
|
|
|
|
|
|
namespace :satellites do
|
|
|
|
desc "GITLAB | Create satellite repos"
|
|
|
|
task create: 'gitlab:enable_automerge'
|
|
|
|
end
|
2012-04-21 11:45:43 +02:00
|
|
|
end
|