Module: ChefStash::OS

Defined in:
lib/chef_stash/os.rb

Overview

Finds out the current Operating System.

Class Method Summary collapse

Class Method Details

.linux?Boolean

Returns:

  • (Boolean)


40
41
42
43
# File 'lib/chef_stash/os.rb', line 40

def self.linux?
  linux = /linux/i
  (RbConfig::CONFIG['host_os'] =~ linux) != nil
end

.mac?Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/chef_stash/os.rb', line 30

def self.mac?
  mac = /darwin|mac os/i
  (RbConfig::CONFIG['host_os'] =~ mac) != nil
end

.unix?Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/chef_stash/os.rb', line 35

def self.unix?
  unix = /solaris|bsd/i
  (RbConfig::CONFIG['host_os'] =~ unix) != nil
end

.windows?Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/chef_stash/os.rb', line 25

def self.windows?
  windows = /cygwin|mswin|mingw|bccwin|wince|emx/i
  (RbConfig::CONFIG['host_os'] =~ windows) != nil
end