Class: DevSystem::Shell

Inherits:
Liza::Controller show all
Defined in:
lib/dev_system/sub/shell/shell.rb

Class Method Summary collapse

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Class Method Details

.cruby?Boolean

Check if the current Ruby engine is MRI

Returns:

  • (Boolean)


44
45
46
# File 'lib/dev_system/sub/shell/shell.rb', line 44

def self.cruby?
  @ruby || RUBY_ENGINE == "ruby"
end

.engineObject

Return the current Ruby engine as a symbol



32
33
34
35
36
# File 'lib/dev_system/sub/shell/shell.rb', line 32

def self.engine
  return :jruby if jruby?
  return :cruby if cruby?
  :unknown
end

.jruby?Boolean

Check if the current Ruby engine is JRuby

Returns:

  • (Boolean)


39
40
41
# File 'lib/dev_system/sub/shell/shell.rb', line 39

def self.jruby?
  @jruby || RUBY_ENGINE == "jruby"
end

.linux?Boolean

Check if the current platform is Linux

Returns:

  • (Boolean)


14
15
16
# File 'lib/dev_system/sub/shell/shell.rb', line 14

def self.linux?
  @linux || (unix? && RbConfig::CONFIG['host_os'].include?("linux"))
end

.mac?Boolean

Check if the current platform is Mac OS

Returns:

  • (Boolean)


19
20
21
# File 'lib/dev_system/sub/shell/shell.rb', line 19

def self.mac?
  @mac || (unix? && RbConfig::CONFIG['host_os'].include?("darwin"))
end

.osObject

Return the current operating system as a symbol



24
25
26
27
28
29
# File 'lib/dev_system/sub/shell/shell.rb', line 24

def self.os
  return :windows if windows?
  return :linux   if linux?
  return :mac     if mac?
  :unix
end

.ruby_versionObject

Return the current Ruby version as a Gem::Version



49
50
51
# File 'lib/dev_system/sub/shell/shell.rb', line 49

def self.ruby_version
  Lizarb.ruby_version
end

.unix?Boolean

Check if the current platform is Unix or Unix-like

Returns:

  • (Boolean)


9
10
11
# File 'lib/dev_system/sub/shell/shell.rb', line 9

def self.unix?
  @unix || !windows?
end

.windows?Boolean

Check if the current platform is Windows

Returns:

  • (Boolean)


4
5
6
# File 'lib/dev_system/sub/shell/shell.rb', line 4

def self.windows?
  @windows || Gem.win_platform?
end