Module: Gitlab::Console

Defined in:
lib/gitlab/console.rb

Class Method Summary collapse

Class Method Details

.welcome!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/gitlab/console.rb', line 7

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