Sha256: 0b772e3d42380736f9aba49057186e5ba98c6a599f631b071dc1d0171e6a3d06

Contents?: true

Size: 871 Bytes

Versions: 24

Compression:

Stored size: 871 Bytes

Contents

require 'chef/mixin/shell_out'

include Chef::Mixin::ShellOut

def ruby_19?
  !!(RUBY_VERSION =~ /^1.9/)
end

def ruby_18?
  !!(RUBY_VERSION =~ /^1.8/)
end

def windows?
  !!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
end

def windows_win2k3?
  return false unless windows?
  require 'ruby-wmi'

  host = WMI::Win32_OperatingSystem.find(:first)
  (host.version && host.version.start_with?("5.2"))
end

def mac_osx_106?
  if File.exists? "/usr/bin/sw_vers"
    result = shell_out("/usr/bin/sw_vers")
    result.stdout.each_line do |line|
      if line =~ /^ProductVersion:\s10.6.*$/
        return true
      end
    end
  end
  
  false
end

# def jruby?

def unix?
  !windows?
end

def os_x?
  !!(RUBY_PLATFORM =~ /darwin/)
end

def solaris?
  !!(RUBY_PLATFORM =~ /solaris/)
end

def freebsd?
  !!(RUBY_PLATFORM =~ /freebsd/)
end

DEV_NULL = windows? ? 'NUL' : '/dev/null'

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
chef-10.34.6-x86-mingw32 spec/support/platform_helpers.rb
chef-10.34.6 spec/support/platform_helpers.rb
chef-10.34.4 spec/support/platform_helpers.rb
chef-10.34.4-x86-mingw32 spec/support/platform_helpers.rb
chef-10.34.2-x86-mingw32 spec/support/platform_helpers.rb
chef-10.34.2 spec/support/platform_helpers.rb
chef-10.34.0-x86-mingw32 spec/support/platform_helpers.rb
chef-10.34.0 spec/support/platform_helpers.rb
chef-10.32.2-x86-mingw32 spec/support/platform_helpers.rb
chef-10.32.2 spec/support/platform_helpers.rb
chef-10.32.0.rc.0 spec/support/platform_helpers.rb
chef-10.32.0.rc.0-x86-mingw32 spec/support/platform_helpers.rb
chef-10.30.4 spec/support/platform_helpers.rb
chef-10.30.4-x86-mingw32 spec/support/platform_helpers.rb
chef-10.30.2 spec/support/platform_helpers.rb
chef-10.30.2-x86-mingw32 spec/support/platform_helpers.rb
chef-10.30.2.rc.0-x86-mingw32 spec/support/platform_helpers.rb
chef-10.30.2.rc.0 spec/support/platform_helpers.rb
chef-10.30.0.rc.2-x86-mingw32 spec/support/platform_helpers.rb
chef-10.30.0.rc.2 spec/support/platform_helpers.rb