Class: OS

Inherits:
Object
  • Object
show all
Defined in:
lib/os.rb

Overview

– Copyleft shura. [ [email protected] ]

This file is part of launchcraft.

launchcraft is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

launchcraft is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with launchcraft. If not, see <www.gnu.org/licenses/>. ++

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.linux?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/os.rb', line 66

def linux?
  parse == :linux
end

.macos?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/os.rb', line 58

def macos?
  parse == :macos
end

.solaris?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/os.rb', line 62

def solaris?
  parse == :solaris
end

.windows?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/os.rb', line 54

def windows?
  parse == :windows
end

Instance Method Details

#parse(what = RUBY_PLATFORM) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/os.rb', line 23

def parse (what=Java::java.lang.System.getProperty('os.name'))
  case what.downcase
  when /win/
    :windows
  when /mac/
    :macos
  when /solaris|sunos/
    :solaris
  when /linux|unix/
    :linux
  else
    :unknown
  end
end