Module: Plat4m

Defined in:
lib/plat4m.rb,
lib/plat4m/pkgman.rb,
lib/plat4m/system.rb,
lib/plat4m/version.rb,
lib/plat4m/sniff/linux.rb,
lib/plat4m/sniff/darwin.rb,
lib/plat4m/sniff/freebsd.rb,
lib/plat4m/sniff/windows.rb

Overview

Plat4m provides methods and classes to scout the details of the computer system and support system management tasks.

Defined Under Namespace

Modules: Sniffer Classes: PkgManager, System

Constant Summary collapse

VERSION =

Current Plat4m version.

'1.1.4'

Class Method Summary collapse

Class Method Details

.currentObject

Returns System instance for current system.



144
145
146
# File 'lib/plat4m/system.rb', line 144

def current
  @current ||= detect_current
end

.detect_currentObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/plat4m/system.rb', line 153

def detect_current
  case RbConfig::CONFIG['target_os']
  when /linux/
    sniffers[:linux].detect_system
  when /darwin/
    sniffers[:darwin].detect_system
  when /freebsd/
    sniffers[:freebsd].detect_system
  else
    if ENV['OS'] =~ /windows/i
      sniffers[:windows].detect_system
    else
      raise "Unknown system!"
    end
  end
end

.sniffersObject

System sniffer registry.



149
150
151
# File 'lib/plat4m/system.rb', line 149

def sniffers
  @sniffers ||= {}
end