module Ohai::Mixin::OS

Public Class Methods

collect_os() click to toggle source

Using ruby configuration determine the OS we're running on

@return [String] the OS

# File lib/ohai/mixin/os.rb, line 29
def collect_os
  case ::RbConfig::CONFIG["host_os"]
  when /aix(.+)$/
    "aix"
  when /darwin(.+)$/
    "darwin"
  when /linux/
    "linux"
  when /freebsd(.+)$/
    "freebsd"
  when /openbsd(.+)$/
    "openbsd"
  when /netbsd(.*)$/
    "netbsd"
  when /dragonfly(.*)$/
    "dragonflybsd"
  when /solaris2/
    "solaris2"
  when /mswin|mingw32|windows/
    # After long discussion in IRC the "powers that be" have come to a consensus
    # that no Windows platform exists that was not based on the
    # Windows_NT kernel, so we herby decree that "windows" will refer to all
    # platforms built upon the Windows_NT kernel and have access to win32 or win64
    # subsystems.
    "windows"
  else
    ::RbConfig::CONFIG["host_os"]
  end
end

Private Instance Methods

collect_os() click to toggle source

Using ruby configuration determine the OS we're running on

@return [String] the OS

# File lib/ohai/mixin/os.rb, line 29
def collect_os
  case ::RbConfig::CONFIG["host_os"]
  when /aix(.+)$/
    "aix"
  when /darwin(.+)$/
    "darwin"
  when /linux/
    "linux"
  when /freebsd(.+)$/
    "freebsd"
  when /openbsd(.+)$/
    "openbsd"
  when /netbsd(.*)$/
    "netbsd"
  when /dragonfly(.*)$/
    "dragonflybsd"
  when /solaris2/
    "solaris2"
  when /mswin|mingw32|windows/
    # After long discussion in IRC the "powers that be" have come to a consensus
    # that no Windows platform exists that was not based on the
    # Windows_NT kernel, so we herby decree that "windows" will refer to all
    # platforms built upon the Windows_NT kernel and have access to win32 or win64
    # subsystems.
    "windows"
  else
    ::RbConfig::CONFIG["host_os"]
  end
end