module SProc::OSInfo

Public Class Methods

host_os() click to toggle source

return the current underlying operating system

# File lib/sproc/osinfo.rb, line 31
def self.host_os
  if [OS::WINDOWS, OS::MINGW, OS::CYGWIN].include?(os_context)
    OS::WINDOWS
  else
    os_context
  end
end
os_context() click to toggle source

returns the current execution environment

# File lib/sproc/osinfo.rb, line 18
def self.os_context
  case RbConfig::CONFIG['host_os']
  when /mswin/ then OS::WINDOWS
  when /mingw/ then OS::MINGW
  when /cygwin/ then OS::CYGWIN
  when /darwin/ then OS::OSX
  when /linux/ then OS::LINUX
  when /bsd/ then OS::BSD
  else OS::UNKNOWN
  end
end

Public Instance Methods

on_bsd?() click to toggle source
# File lib/sproc/osinfo.rb, line 47
def on_bsd?
  OSInfo.os_context == OS::BSD
end
on_linux?() click to toggle source
# File lib/sproc/osinfo.rb, line 43
def on_linux?
  OSInfo.os_context == OS::LINUX
end
on_osx?() click to toggle source
# File lib/sproc/osinfo.rb, line 51
def on_osx?
  OSInfo.os_context == OS::OSX
end
on_windows?() click to toggle source
# File lib/sproc/osinfo.rb, line 39
def on_windows?
  OSInfo.host_os == OS::WINDOWS
end