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

.allObject

Returns all descendants of Shell



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

def self.all
  @all ||= AppShell.classes.select { _1 <= self }
end

.cruby?Boolean

Check if the current Ruby engine is MRI

Returns:

  • (Boolean)


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

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

.engineObject

Return the current Ruby engine as a symbol



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

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)


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

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

.linux?Boolean

Check if the current platform is Linux

Returns:

  • (Boolean)


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

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

.mac?Boolean

Check if the current platform is Mac OS

Returns:

  • (Boolean)


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

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

.osObject

Return the current operating system as a symbol



29
30
31
32
33
34
# File 'lib/dev_system/sub/shell/shell.rb', line 29

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



54
55
56
# File 'lib/dev_system/sub/shell/shell.rb', line 54

def self.ruby_version
  Lizarb.ruby_version
end

.unix?Boolean

Check if the current platform is Unix or Unix-like

Returns:

  • (Boolean)


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

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

.windows?Boolean

Check if the current platform is Windows

Returns:

  • (Boolean)


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

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