Module: Bake::Utils::OS

Defined in:
lib/common/utils.rb

Overview

Simple helper query the operating system we are running in

Class Method Summary collapse

Class Method Details

.nameObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/common/utils.rb', line 69

def OS.name
  @os ||= (
    host_os = RbConfig::CONFIG['host_os']
    case host_os
    when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
      "Windows"
    when /darwin|mac os/
      "Mac"
    when /linux/
      "Linux"
    when /solaris|bsd/
      "Unix"
    else
      Bake.formatter.printError("Unknown OS: #{host_os.inspect}")
      ExitHelper.exit(1)
    end
  )
end

.windows?Boolean

Is it windows

Returns:

  • (Boolean)


65
66
67
# File 'lib/common/utils.rb', line 65

def OS.windows?
  (RUBY_PLATFORM =~ /cygwin|mswin|msys|mingw|bccwin|wince|emx|emc/) != nil
end