Class: ProconBypassMan::PrintBootMessageCommand::BootMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/commands/print_boot_message_command.rb

Instance Method Summary collapse

Constructor Details

#initializeBootMessage

Returns a new instance of BootMessage.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/procon_bypass_man/commands/print_boot_message_command.rb', line 3

def initialize
  @table = {}
  @table[:ruby_version] = RUBY_VERSION
  @table[:pbm_version] = ProconBypassMan::VERSION
  @table[:pbmenv_version] = Pbmenv::VERSION
  @table[:pid] = $$
  @table[:root_path] = ProconBypassMan.root
  @table[:pid_path] = ProconBypassMan.pid_path
  @table[:setting_path] = ProconBypassMan.buttons_setting_configuration.setting_path
  @table[:uptime_from_boot] = ProconBypassMan::Uptime.from_boot
  @table[:use_pbmenv] = ProconBypassMan.root.start_with?(Pbmenv::PBM_DIR)
  @table[:session_id] = ProconBypassMan.session_id
  @table[:device_id] = ProconBypassMan.device_id
  @table[:never_exit_accidentally] = ProconBypassMan.config.never_exit_accidentally
  @table[:uname] = `uname -a`.chomp

  # 開発中のHEADを取りたかったけど、Gem::Specification経由から取得する必要がありそう
  # build_version = `git rev-parse --short HEAD`.chomp
  # if build_version.empty?
  #   @table[:build_version] = 'release version'
  # else
  #   @table[:build_version] = build_version
  # end

  # build version: #{@table[:build_version]}
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


52
53
54
# File 'lib/procon_bypass_man/commands/print_boot_message_command.rb', line 52

def to_hash
  @table
end

#to_sString

Returns:

  • (String)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/procon_bypass_man/commands/print_boot_message_command.rb', line 31

def to_s
  booted_message = "  ----\n  ProconBypassMan::VERSION: \#{@table[:pbm_version]}\n  RUBY_VERSION: \#{@table[:ruby_version]}\n  Pbmenv::VERSION: \#{@table[:pbmenv_version]}\n  PBM-Cloud Integration: \#{ProconBypassMan::WebConnectivityChecker.new(ProconBypassMan.config.api_server, ProconBypassMan.config.current_ws_server_url)}\n  ExternalInput Integration: \#{ProconBypassMan::ExternalInput::BootMessage.new(channels: ProconBypassMan::ExternalInput.channels)}\n  pid: \#{@table[:pid]}\n  root: \#{@table[:root_path]}\n  pid_path: \#{@table[:pid_path]}\n  setting_path: \#{@table[:setting_path]}\n  uptime from boot: \#{@table[:uptime_from_boot]} sec\n  use_pbmenv: \#{@table[:use_pbmenv]}\n  session_id: \#{ProconBypassMan.session_id}\n  device_id: \#{ProconBypassMan.device_id.gsub(/.{25}$/, \"*\"*25)}\n  ----\n  EOF\nend\n"