2012-12-05 12:27:54 -05:00
|
|
|
namespace :gitlab do
|
2012-12-06 15:16:48 -05:00
|
|
|
namespace :env do
|
2015-06-23 10:52:40 -04:00
|
|
|
desc "GitLab | Show information about GitLab and its environment"
|
2012-12-07 10:42:09 -05:00
|
|
|
task info: :environment do
|
2012-12-05 12:27:54 -05:00
|
|
|
|
2012-12-06 15:16:48 -05:00
|
|
|
# check if there is an RVM environment
|
2014-02-25 06:12:09 -05:00
|
|
|
rvm_version = run_and_match(%W(rvm --version), /[\d\.]+/).try(:to_s)
|
2012-12-10 16:53:33 -05:00
|
|
|
# check Ruby version
|
2014-02-25 06:12:09 -05:00
|
|
|
ruby_version = run_and_match(%W(ruby --version), /[\d\.p]+/).try(:to_s)
|
2012-12-07 10:42:09 -05:00
|
|
|
# check Gem version
|
2014-02-25 06:12:09 -05:00
|
|
|
gem_version = run(%W(gem --version))
|
2012-12-06 15:16:48 -05:00
|
|
|
# check Bundler version
|
2014-02-25 06:12:09 -05:00
|
|
|
bunder_version = run_and_match(%W(bundle --version), /[\d\.]+/).try(:to_s)
|
2012-12-06 15:16:48 -05:00
|
|
|
# check Bundler version
|
2014-02-25 06:12:09 -05:00
|
|
|
rake_version = run_and_match(%W(rake --version), /[\d\.]+/).try(:to_s)
|
2012-12-06 15:16:48 -05:00
|
|
|
|
|
|
|
puts ""
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "System information".color(:yellow)
|
|
|
|
puts "System:\t\t#{os_name || "unknown".color(:red)}"
|
2014-02-25 06:12:09 -05:00
|
|
|
puts "Current User:\t#{run(%W(whoami))}"
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "Using RVM:\t#{rvm_version.present? ? "yes".color(:green) : "no"}"
|
2012-12-06 15:16:48 -05:00
|
|
|
puts "RVM Version:\t#{rvm_version}" if rvm_version.present?
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "Ruby Version:\t#{ruby_version || "unknown".color(:red)}"
|
|
|
|
puts "Gem Version:\t#{gem_version || "unknown".color(:red)}"
|
|
|
|
puts "Bundler Version:#{bunder_version || "unknown".color(:red)}"
|
|
|
|
puts "Rake Version:\t#{rake_version || "unknown".color(:red)}"
|
2014-04-01 10:05:26 -04:00
|
|
|
puts "Sidekiq Version:#{Sidekiq::VERSION}"
|
2012-12-06 15:16:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
# check database adapter
|
|
|
|
database_adapter = ActiveRecord::Base.connection.adapter_name.downcase
|
|
|
|
|
2015-08-17 06:41:47 -04:00
|
|
|
project = Group.new(path: "some-group").projects.build(path: "some-project")
|
2012-12-06 15:16:48 -05:00
|
|
|
# construct clone URLs
|
|
|
|
http_clone_url = project.http_url_to_repo
|
|
|
|
ssh_clone_url = project.ssh_url_to_repo
|
|
|
|
|
2012-12-14 19:16:25 -05:00
|
|
|
omniauth_providers = Gitlab.config.omniauth.providers
|
2012-12-10 16:53:33 -05:00
|
|
|
omniauth_providers.map! { |provider| provider['name'] }
|
|
|
|
|
2012-12-06 15:16:48 -05:00
|
|
|
puts ""
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "GitLab information".color(:yellow)
|
2013-02-16 07:42:22 -05:00
|
|
|
puts "Version:\t#{Gitlab::VERSION}"
|
|
|
|
puts "Revision:\t#{Gitlab::REVISION}"
|
2012-12-06 15:16:48 -05:00
|
|
|
puts "Directory:\t#{Rails.root}"
|
|
|
|
puts "DB Adapter:\t#{database_adapter}"
|
2012-12-14 19:16:25 -05:00
|
|
|
puts "URL:\t\t#{Gitlab.config.gitlab.url}"
|
2012-12-06 15:16:48 -05:00
|
|
|
puts "HTTP Clone URL:\t#{http_clone_url}"
|
|
|
|
puts "SSH Clone URL:\t#{ssh_clone_url}"
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "Using LDAP:\t#{Gitlab.config.ldap.enabled ? "yes".color(:green) : "no"}"
|
|
|
|
puts "Using Omniauth:\t#{Gitlab.config.omniauth.enabled ? "yes".color(:green) : "no"}"
|
|
|
|
puts "Omniauth Providers: #{omniauth_providers.join(', ')}" if Gitlab.config.omniauth.enabled
|
2012-12-06 15:16:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check Gitolite version
|
2013-08-22 14:10:18 -04:00
|
|
|
gitlab_shell_version_file = "#{Gitlab.config.gitlab_shell.hooks_path}/../VERSION"
|
2013-02-11 12:16:59 -05:00
|
|
|
if File.readable?(gitlab_shell_version_file)
|
|
|
|
gitlab_shell_version = File.read(gitlab_shell_version_file)
|
2012-12-05 12:27:54 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
puts ""
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "GitLab Shell".color(:yellow)
|
|
|
|
puts "Version:\t#{gitlab_shell_version || "unknown".color(:red)}"
|
2013-02-11 12:16:59 -05:00
|
|
|
puts "Repositories:\t#{Gitlab.config.gitlab_shell.repos_path}"
|
|
|
|
puts "Hooks:\t\t#{Gitlab.config.gitlab_shell.hooks_path}"
|
2012-12-14 19:16:25 -05:00
|
|
|
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
|
2012-12-05 12:27:54 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|