Class: Ukiryu::Models::RunEnvironment

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ukiryu/models/run_environment.rb

Overview

Run environment information

Class Method Summary collapse

Class Method Details

.collectRunEnvironment

Collect all environment information

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ukiryu/models/run_environment.rb', line 39

def self.collect
  runtime = ::Ukiryu::Runtime.instance
  begin
    ::Ukiryu::Shell.detect
  rescue ::Ukiryu::Errors::UnknownShellError
    'unknown'
  end

  # Determine if shell was overridden
  shell_override = !::Ukiryu::Config.shell.nil?
  actual_shell = runtime.shell.to_s

  new(
    hostname: Socket.gethostname,
    platform: RUBY_PLATFORM,
    os_version: os_version_string,
    shell: actual_shell,
    shell_override: shell_override,
    shell_version: detect_shell_version_for(actual_shell),
    ruby_version: RUBY_VERSION,
    ukiryu_version: Ukiryu::VERSION,
    cpu_count: Etc.nprocessors,
    total_memory: detect_total_memory,
    working_directory: Dir.pwd
  )
end