Class: Train::Extras::OSCommon

Inherits:
Object
  • Object
show all
Includes:
DetectDarwin, DetectLinux, DetectUnix, DetectWindows
Defined in:
lib/train/extras/os_common.rb

Constant Summary collapse

OS =

rubocop:disable Style/MutableConstant

{ # rubocop:disable Style/MutableConstant
  'redhat' => %w{
    redhat oracle centos fedora amazon scientific xenserver wrlinux
  },
  'debian' => %w{
    debian ubuntu linuxmint raspbian
  },
  'suse' => %w{
    suse opensuse
  },
  'bsd' => %w{
    freebsd netbsd openbsd darwin
  },
  'solaris' => %w{
    solaris smartos omnios openindiana opensolaris nexentacore
  },
  'windows' => %w{
    windows
  },
  'aix' => %w{
    aix
  },
}

Instance Method Summary collapse

Methods included from DetectWindows

#detect_windows, #read_wmic

Methods included from DetectUnix

#detect_solaris, #detect_via_uname

Methods included from DetectLinux

#detect_linux, #detect_linux_via_config, #fetch_os_release, #parse_os_release_info, #redhatish_platform, #redhatish_version, #uname_r, #uname_s

Methods included from LinuxLSB

#detect_linux_via_lsb, #lsb, #lsb_config, #lsb_release

Methods included from DetectDarwin

#detect_darwin

Constructor Details

#initialize(backend, platform = nil) ⇒ OSCommon

Returns a new instance of OSCommon.



23
24
25
26
27
# File 'lib/train/extras/os_common.rb', line 23

def initialize(backend, platform = nil)
  @backend = backend
  @platform = platform || {}
  detect_family
end

Instance Method Details

#[](key) ⇒ Object



29
30
31
# File 'lib/train/extras/os_common.rb', line 29

def [](key)
  @platform[key]
end

#to_hashObject



33
34
35
# File 'lib/train/extras/os_common.rb', line 33

def to_hash
  @platform
end