diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-03-09 20:48:33 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-03-09 20:48:33 +0200 |
commit | 9988282e845f76733b43de15d303ef05d38c44ad (patch) | |
tree | fa6f9fa9d6e42d434ab1b5733e513ae58f7edcf3 | |
parent | 51f7d949917d46d17646c855944ee26a1e3a2cee (diff) | |
download | gitlab-ce-9988282e845f76733b43de15d303ef05d38c44ad.tar.gz |
Diasgnostic task for gitlab
-rw-r--r-- | lib/tasks/gitlab_status.rake | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/tasks/gitlab_status.rake b/lib/tasks/gitlab_status.rake new file mode 100644 index 00000000000..db4d1d36e7a --- /dev/null +++ b/lib/tasks/gitlab_status.rake @@ -0,0 +1,58 @@ +desc "Check gitlab installation status" +task :gitlab_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 |