Class: Train::Extras::OSCommon

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

Constant Summary collapse

OS =

rubocop:disable Style/MutableConstant

{ # rubocop:disable Style/MutableConstant
  'redhat' => REDHAT_FAMILY,
  'debian' => DEBIAN_FAMILY,
  'suse' => SUSE_FAMILY,
  'fedora' => %w{fedora},
  'bsd' => %w{
    freebsd netbsd openbsd darwin
  },
  'solaris' => %w{
    solaris smartos omnios openindiana opensolaris nexentacore
  },
  'windows' => %w{
    windows
  },
  'aix' => %w{
    aix
  },
  'hpux' => %w{
    hpux
  },
  'esx' => %w{
    esx
  },
  'darwin' => %w{
    darwin
  },
}

Constants included from DetectLinux

DetectLinux::DEBIAN_FAMILY, DetectLinux::REDHAT_FAMILY, DetectLinux::SUSE_FAMILY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DetectEsx

#detect_esx

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_arch, #detect_linux_via_config, #family_for_platform, #fetch_os_release, #parse_os_release_info, #redhatish_platform, #redhatish_version

Methods included from Uname

#uname_m, #uname_r, #uname_s

Methods included from LinuxLSB

#detect_linux_via_lsb, #lsb, #lsb_config, #lsb_release

Methods included from DetectDarwin

#detect_darwin, #detect_darwin_arch

Constructor Details

#initialize(backend, platform = nil) ⇒ OSCommon

Returns a new instance of OSCommon.



26
27
28
29
30
# File 'lib/train/extras/os_common.rb', line 26

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

Instance Attribute Details

#backendObject

Returns the value of attribute backend.



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

def backend
  @backend
end

Instance Method Details

#[](key) ⇒ Object



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

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

#to_hashObject



36
37
38
# File 'lib/train/extras/os_common.rb', line 36

def to_hash
  @platform
end