Sha256: 454553e7761fbb6184d8534024f4d2ab093acc80dd1e28963fcb519082d12f8a

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

class ProconBypassMan::BootMessage
  def initialize
    @table = {}
    @table[:ruby_version] = RUBY_VERSION
    @table[:pbm_version] = ProconBypassMan::VERSION
    @table[:pid] = $$
    @table[:root_path] = ProconBypassMan.root
    @table[:pid_path] = ProconBypassMan.pid_path
    @table[:setting_path] = ProconBypassMan::ButtonsSettingConfiguration.instance.setting_path
    @table[:uptime_from_boot] = ProconBypassMan::Uptime.from_boot
    @table[:use_pbmenv] = !(!!`which pbmenv`.empty?)
    @table[:session_id] = ProconBypassMan.session_id
    @table[:device_id] = ProconBypassMan.device_id

    # 開発中の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

  # @return [String]
  def to_s
    booted_message = <<~EOF
      ----
      RUBY_VERSION: #{@table[:ruby_version]}
      ProconBypassMan::VERSION: #{@table[:pbm_version]}
      pid: #{@table[:pid]}
      root: #{@table[:root_path]}
      pid_path: #{@table[:pid_path]}
      setting_path: #{@table[:setting_path]}
      uptime from boot: #{@table[:uptime_from_boot]} sec
      use_pbmenv: #{@table[:use_pbmenv]}
      session_id: #{ProconBypassMan.session_id}
      device_id: #{ProconBypassMan.device_id}
      ----
    EOF
  end

  # @return [Hash]
  def to_hash
    @table
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
procon_bypass_man-0.1.15 lib/procon_bypass_man/boot_message.rb
procon_bypass_man-0.1.14 lib/procon_bypass_man/boot_message.rb