gitlab rake tasks refactored
This commit is contained in:
parent
c40c627a3b
commit
43f5df21a3
15 changed files with 152 additions and 120 deletions
25
lib/tasks/gitlab/gitolite_rebuild.rake
Normal file
25
lib/tasks/gitlab/gitolite_rebuild.rake
Normal file
|
@ -0,0 +1,25 @@
|
|||
namespace :gitlab do
|
||||
namespace :gitolite do
|
||||
desc "GITLAB | Rebuild each project at gitolite config"
|
||||
task :update_repos => :environment do
|
||||
puts "Starting Projects"
|
||||
Project.find_each(:batch_size => 100) do |project|
|
||||
puts
|
||||
puts "=== #{project.name}"
|
||||
project.update_repository
|
||||
puts
|
||||
end
|
||||
puts "Done with projects"
|
||||
end
|
||||
|
||||
desc "GITLAB | Rebuild each key at gitolite config"
|
||||
task :update_keys => :environment do
|
||||
puts "Starting Key"
|
||||
Key.find_each(:batch_size => 100) do |key|
|
||||
key.update_repository
|
||||
print '.'
|
||||
end
|
||||
puts "Done with keys"
|
||||
end
|
||||
end
|
||||
end
|
7
lib/tasks/gitlab/setup.rake
Normal file
7
lib/tasks/gitlab/setup.rake
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace :gitlab do
|
||||
namespace :app do
|
||||
desc "GITLAB | Setup production application"
|
||||
task :setup => ['db:setup', 'db:seed_fu']
|
||||
end
|
||||
end
|
||||
|
62
lib/tasks/gitlab/status.rake
Normal file
62
lib/tasks/gitlab/status.rake
Normal file
|
@ -0,0 +1,62 @@
|
|||
namespace :gitlab do
|
||||
namespace :app do
|
||||
desc "GITLAB | Check gitlab installation status"
|
||||
task :status => :environment do
|
||||
puts "Starting diagnostic"
|
||||
|
||||
print "config/database.yml............"
|
||||
if File.exists?(File.join Rails.root, "config", "database.yml")
|
||||
puts "exists".green
|
||||
else
|
||||
puts "missing".red
|
||||
return
|
||||
end
|
||||
|
||||
print "config/gitlab.yml............"
|
||||
if File.exists?(File.join Rails.root, "config", "gitlab.yml")
|
||||
puts "exists".green
|
||||
else
|
||||
puts "missing".red
|
||||
return
|
||||
end
|
||||
|
||||
GIT_HOST = YAML.load_file("#{Rails.root}/config/gitlab.yml")["git_host"]
|
||||
print "/home/git/repositories/............"
|
||||
if File.exists?(GIT_HOST['base_path'])
|
||||
puts "exists".green
|
||||
else
|
||||
puts "missing".red
|
||||
return
|
||||
end
|
||||
|
||||
print "/home/git/repositories/ is writable?............"
|
||||
if File.stat(GIT_HOST['base_path']).writable?
|
||||
puts "YES".green
|
||||
else
|
||||
puts "NO".red
|
||||
return
|
||||
end
|
||||
|
||||
begin
|
||||
`git clone #{GIT_HOST["admin_uri"]} /tmp/gitolite_gitlab_test`
|
||||
FileUtils.rm_rf("/tmp/gitolite_gitlab_test")
|
||||
print "Can clone gitolite-admin?............"
|
||||
puts "YES".green
|
||||
rescue
|
||||
print "Can clone gitolite-admin?............"
|
||||
puts "NO".red
|
||||
return
|
||||
end
|
||||
|
||||
print "UMASK for .gitolite.rc is 0007? ............"
|
||||
unless open("#{GIT_HOST['base_path']}/../.gitolite.rc").grep(/REPO_UMASK = 0007/).empty?
|
||||
puts "YES".green
|
||||
else
|
||||
puts "NO".red
|
||||
return
|
||||
end
|
||||
|
||||
puts "\nFinished"
|
||||
end
|
||||
end
|
||||
end
|
19
lib/tasks/gitlab/update_hooks.rake
Normal file
19
lib/tasks/gitlab/update_hooks.rake
Normal file
|
@ -0,0 +1,19 @@
|
|||
namespace :gitlab do
|
||||
namespace :gitolite do
|
||||
desc "GITLAB | Rewrite hooks for repos"
|
||||
task :update_hooks => :environment do
|
||||
puts "Starting Projects"
|
||||
Project.find_each(:batch_size => 100) do |project|
|
||||
begin
|
||||
if project.commit
|
||||
project.write_hooks
|
||||
print ".".green
|
||||
end
|
||||
rescue Exception => e
|
||||
print e.message.red
|
||||
end
|
||||
end
|
||||
puts "\nDone with projects"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue