diff options
Diffstat (limited to 'lib/gitlab/console.rb')
-rw-r--r-- | lib/gitlab/console.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/gitlab/console.rb b/lib/gitlab/console.rb new file mode 100644 index 00000000000..c3c34bb0f61 --- /dev/null +++ b/lib/gitlab/console.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +# rubocop:disable Rails/Output +module Gitlab + module Console + class << self + def welcome! + return unless Gitlab::Runtime.console? + + # note that this will not print out when using `spring` + justify = 15 + + puts '-' * 80 + puts " Ruby:".ljust(justify) + RUBY_DESCRIPTION + puts " GitLab:".ljust(justify) + "#{Gitlab::VERSION} (#{Gitlab.revision}) #{Gitlab.ee? ? 'EE' : 'FOSS'}" + puts " GitLab Shell:".ljust(justify) + "#{Gitlab::VersionInfo.parse(Gitlab::Shell.version)}" + + if ApplicationRecord.database.exists? + puts " #{ApplicationRecord.database.human_adapter_name}:".ljust(justify) + ApplicationRecord.database.version + + Gitlab.ee do + if Gitlab::Geo.connected? && Gitlab::Geo.enabled? + puts " Geo enabled:".ljust(justify) + 'yes' + puts " Geo server:".ljust(justify) + EE::GeoHelper.current_node_human_status + end + end + end + + if RUBY_PLATFORM.include?('darwin') + # Sorry, macOS users. The current implementation requires procfs. + puts '-' * 80 + else + boot_time_seconds = Gitlab::Metrics::BootTimeTracker.instance.startup_time + booted_in = "[ booted in %.2fs ]" % [boot_time_seconds] + puts '-' * (80 - booted_in.length) + booted_in + end + end + end + end +end +# rubocop:enable Rails/Output |