2012-04-04 00:02:54 +02:00
|
|
|
namespace :gitlab do
|
|
|
|
namespace :app do
|
2012-09-26 13:18:10 +02:00
|
|
|
desc "GITLAB | Check GitLab installation status"
|
2012-04-04 00:02:54 +02:00
|
|
|
task :status => :environment do
|
2012-09-26 13:18:10 +02:00
|
|
|
puts "Starting diagnostics".yellow
|
2012-07-02 20:51:48 +02:00
|
|
|
git_base_path = Gitlab.config.git_base_path
|
2012-04-04 00:02:54 +02:00
|
|
|
|
|
|
|
print "config/database.yml............"
|
2012-09-26 13:18:10 +02:00
|
|
|
if File.exists?(Rails.root.join "config", "database.yml")
|
2012-04-04 00:02:54 +02:00
|
|
|
puts "exists".green
|
2012-09-26 13:18:10 +02:00
|
|
|
else
|
2012-04-04 00:02:54 +02:00
|
|
|
puts "missing".red
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
print "config/gitlab.yml............"
|
2012-09-26 13:18:10 +02:00
|
|
|
if File.exists?(Rails.root.join "config", "gitlab.yml")
|
|
|
|
puts "exists".green
|
2012-04-04 00:02:54 +02:00
|
|
|
else
|
|
|
|
puts "missing".red
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2012-07-02 20:51:48 +02:00
|
|
|
print "#{git_base_path}............"
|
2012-09-26 13:18:10 +02:00
|
|
|
if File.exists?(git_base_path)
|
|
|
|
puts "exists".green
|
|
|
|
else
|
2012-04-04 00:02:54 +02:00
|
|
|
puts "missing".red
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2012-07-02 20:51:48 +02:00
|
|
|
print "#{git_base_path} is writable?............"
|
|
|
|
if File.stat(git_base_path).writable?
|
2012-09-26 13:18:10 +02:00
|
|
|
puts "YES".green
|
2012-04-04 00:02:54 +02:00
|
|
|
else
|
|
|
|
puts "NO".red
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
begin
|
2012-07-02 20:51:48 +02:00
|
|
|
`git clone #{Gitlab.config.gitolite_admin_uri} /tmp/gitolite_gitlab_test`
|
2012-04-04 00:02:54 +02:00
|
|
|
FileUtils.rm_rf("/tmp/gitolite_gitlab_test")
|
|
|
|
print "Can clone gitolite-admin?............"
|
2012-09-26 13:18:10 +02:00
|
|
|
puts "YES".green
|
|
|
|
rescue
|
2012-04-04 00:02:54 +02:00
|
|
|
print "Can clone gitolite-admin?............"
|
|
|
|
puts "NO".red
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
print "UMASK for .gitolite.rc is 0007? ............"
|
2012-10-27 16:12:01 +02:00
|
|
|
if open(File.absolute_path("#{git_base_path}/../.gitolite.rc")).grep(/UMASK([ \t]*)=([ \t>]*)0007/).any?
|
2012-09-26 13:18:10 +02:00
|
|
|
puts "YES".green
|
2012-04-04 00:02:54 +02:00
|
|
|
else
|
|
|
|
puts "NO".red
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2012-08-28 10:57:23 +02:00
|
|
|
gitolite_hooks_path = File.join(Gitlab.config.git_hooks_path, "common")
|
2012-08-21 21:44:49 +02:00
|
|
|
gitlab_hook_files = ['post-receive']
|
|
|
|
gitlab_hook_files.each do |file_name|
|
|
|
|
dest = File.join(gitolite_hooks_path, file_name)
|
|
|
|
print "#{dest} exists? ............"
|
|
|
|
if File.exists?(dest)
|
|
|
|
puts "YES".green
|
|
|
|
else
|
|
|
|
puts "NO".red
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-26 13:18:10 +02:00
|
|
|
if Project.count > 0
|
2012-07-26 15:14:34 +02:00
|
|
|
puts "Validating projects repositories:".yellow
|
|
|
|
Project.find_each(:batch_size => 100) do |project|
|
|
|
|
print "#{project.name}....."
|
2012-09-26 13:18:10 +02:00
|
|
|
hook_file = File.join(project.path_to_repo, 'hooks', 'post-receive')
|
2012-07-26 15:14:34 +02:00
|
|
|
|
|
|
|
unless File.exists?(hook_file)
|
2012-09-26 13:18:10 +02:00
|
|
|
puts "post-receive file missing".red
|
|
|
|
return
|
2012-07-26 15:14:34 +02:00
|
|
|
end
|
|
|
|
|
2012-08-28 12:09:10 +02:00
|
|
|
puts "post-receive file ok".green
|
2012-07-26 15:14:34 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
puts "\nFinished".blue
|
2012-04-04 00:02:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|