cleanup rake tasks since no gitolite required
This commit is contained in:
parent
ff76e05271
commit
2f019b2b4c
4 changed files with 9 additions and 69 deletions
|
@ -1,38 +1,5 @@
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue