Merge pull request #2194 from jojosch/rake-info-task

add rake task to gather system information
This commit is contained in:
Riyad Preukschas 2012-12-06 07:39:42 -08:00
commit f2c89c7c90
2 changed files with 78 additions and 0 deletions

View file

@ -11,6 +11,36 @@ bundle exec rake gitlab:app:setup
```
### Gather Information about GitLab Installation
This command gathers information about your GitLab installation. These can be used in issue reports.
```
bundle exec rake gitlab:app:info
```
Example output:
```
Gitlab information
Version: 4.0.0pre
Resivion: 8022628
System information
System: Debian6.0.6
Home: /home/gitlab
User: gitlab
Ruby: ruby-1.9.3-p286
Gems: 1.8.24
Gitolite information
Version: v3.04-4-g4524f01
Admin URI: git@localhost:gitolite-admin
Base Path: /home/git/repositories/
Hook Path: /home/git/.gitolite/hooks/
Git: /usr/bin/git
```
### Check GitLab installation status
[Trouble-Shooting-Guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide)

View file

@ -0,0 +1,48 @@
namespace :gitlab do
namespace :app do
desc "GITLAB | Get Information about this installation"
task :info => :environment do
puts ""
puts "Gitlab information".yellow
puts "Version:\t#{Gitlab::Version}"
puts "Resivion:\t#{Gitlab::Revision}"
# check which os is running
if Kernel.system('lsb_release > /dev/null 2>&1')
os_name = `lsb_release -irs`
elsif File.exists?('/etc/system-release') && File.readable?('/etc/system-release')
os_name = File.read('/etc/system-release')
elsif File.exists?('/etc/debian_version') && File.readable?('/etc/debian_version')
debian_version = File.read('/etc/debian_version')
os_name = "Debian #{debian_version}"
end
os_name = os_name.gsub(/\n/, '')
# check gitolite version
gitolite_version_file = "#{Gitlab.config.git_base_path}/../gitolite/src/VERSION"
if File.exists?(gitolite_version_file) && File.readable?(gitolite_version_file)
gitolite_version = File.read(gitolite_version_file)
else
gitolite_version = 'unknown'
end
puts ""
puts "System information".yellow
puts "System:\t\t#{os_name}"
puts "Home:\t\t#{ENV['HOME']}"
puts "User:\t\t#{ENV['LOGNAME']}"
puts "Ruby:\t\t#{ENV['RUBY_VERSION']}"
puts "Gems:\t\t#{`gem --version`}"
puts ""
puts "Gitolite information".yellow
puts "Version:\t#{gitolite_version}"
puts "Admin URI:\t#{Gitlab.config.git_host.admin_uri}"
puts "Base Path:\t#{Gitlab.config.git_base_path}"
puts "Hook Path:\t#{Gitlab.config.git_hooks_path}"
puts "Git:\t\t#{Gitlab.config.git.path}"
end
end
end