module Os
Get the basic operating system name reliably, even in JRuby Useful for OS-contextual command line instructions.
E.g., 'C:Program Files (x86)Mozilla Firefoxfirefox –version' in Windows vs
'/Applications/Firefox.app/Contents/MacOS/firefox --version' in Mac vs 'firefox --version' in Unix
Public Class Methods
haiku?()
click to toggle source
# File lib/specs.rb, line 67 def self.haiku? raw =~ /haiku/ end
linux?()
click to toggle source
# File lib/specs.rb, line 72 def self.linux? self.unix? && !(self.mac? || self.haiku?) end
mac?()
click to toggle source
# File lib/specs.rb, line 57 def self.mac? raw =~ /darwin/ end
mingw?()
click to toggle source
# File lib/specs.rb, line 52 def self.mingw? raw =~ /cygwin|mingw/ end
os_name()
click to toggle source
# File lib/specs.rb, line 87 def self.os_name if self.windows? :windows elsif self.mac? :mac elsif self.linux? :linux elsif self.haiku? :haiku else :unix end end
raw()
click to toggle source
# File lib/specs.rb, line 38 def self.raw # Config deprecated in Ruby 1.9 RbConfig::CONFIG['host_os'] end
unix?()
click to toggle source
# File lib/specs.rb, line 62 def self.unix? !self.windows? end
windows?()
click to toggle source
# File lib/specs.rb, line 47 def self.windows? raw =~ /cygwin|mswin|mingw|bccwin|wince|emx/ end
x86?()
click to toggle source
# File lib/specs.rb, line 82 def self.x86? !self.x86_64? end
x86_64?()
click to toggle source
# File lib/specs.rb, line 77 def self.x86_64? RbConfig::CONFIG['arch'] =~ /64/ end