Commit 2f019b2b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

cleanup rake tasks since no gitolite required

parent 0d4502812e40
namespace :gitlab do
namespace :cleanup do
desc "GITLAB | Cleanup | Clean gitolite config"
task :config => :environment do
warn_user_is_not_gitlab
real_repos = Project.all.map(&:path_with_namespace)
real_repos << "gitolite-admin"
real_repos << "@all"
remove_flag = ENV['REMOVE']
puts "Looking for repositories to remove... "
Gitlab::GitoliteConfig.new.apply do |config|
all_repos = []
garbage_repos = []
all_repos = config.conf.repos.keys
garbage_repos = all_repos - real_repos
garbage_repos.each do |repo_name|
if remove_flag
config.conf.rm_repo(repo_name)
print "to remove...".red
end
puts repo_name.red
end
end
unless remove_flag
puts "To cleanup repositories run this command with REMOVE=true".yellow
end
end
desc "GITLAB | Cleanup | Clean namespaces"
task :dirs => :environment do
warn_user_is_not_gitlab
......
namespace :gitlab do
desc "GITLAB | Enable auto merge"
task :enable_automerge => :environment 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
next
return
end
puts ""
......@@ -33,9 +39,4 @@ namespace :gitlab do
end
end
end
namespace :satellites do
desc "GITLAB | Create satellite repos"
task create: 'gitlab:enable_automerge'
end
end
namespace :gitlab do
namespace :gitolite do
desc "GITLAB | Rebuild each project in Gitolite config"
task :update_repos => :environment do
warn_user_is_not_gitlab
puts "Rebuilding projects ... "
Project.find_each(:batch_size => 100) do |project|
puts "#{project.name_with_namespace.yellow} ... "
project.update_repository
puts "... #{"done".green}"
end
end
desc "GITLAB | Rebuild each user key in Gitolite config"
task :update_keys => :environment do
warn_user_is_not_gitlab
puts "Rebuilding keys ... "
Key.find_each(:batch_size => 100) do |key|
puts "#{key.identifier.yellow} ... "
Gitlab::Gitolite.new.set_key(key.identifier, key.key, key.projects)
puts "... #{"done".green}"
end
end
end
end
......@@ -14,7 +14,6 @@ namespace :gitlab do
Rake::Task["db:setup"].invoke
Rake::Task["db:seed_fu"].invoke
Rake::Task["gitlab:enable_automerge"].invoke
rescue Gitlab::TaskAbortedByUserError
puts "Quitting...".red
exit 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment