Module: Computer

Defined in:
lib/computer.rb,
lib/computer/shell.rb,
lib/computer/version.rb

Overview

add some system info from/via rbconfig - why? why not?

Defined Under Namespace

Classes: Shell, ShellError

Constant Summary collapse

OS =
case RbConfig::CONFIG['host_os'].downcase
when /linux/
  "linux"
when /darwin/
  "darwin"
when /freebsd/
  "freebsd"
when /netbsd/
  "netbsd"
when /openbsd/
  "openbsd"
when /dragonfly/
  "dragonflybsd"
when /sunos|solaris/
  "solaris"
when /mingw|mswin/
  "windows"
else
  RbConfig::CONFIG['host_os'].downcase
end
CPU =

todo/check: always use downcase - why? why not?

RbConfig::CONFIG['host_cpu']
ARCH =
case CPU.downcase
when /amd64|x86_64|x64/
  "x86_64"
when /i?86|x86|i86pc/
  "i386"
when /ppc64|powerpc64/
  "powerpc64"
when /ppc|powerpc/
  "powerpc"
when /sparcv9|sparc64/
  "sparcv9"
when /arm64|aarch64/  # MacOS calls it "arm64", other operating systems "aarch64"
  "aarch64"
when /^arm/
  "arm"
else
  RbConfig::CONFIG['host_cpu']   ## todo/check: always use downcase - why? why not?
end
MAJOR =

todo: namespace inside version or something - why? why not??

0
MINOR =
1
PATCH =
1
VERSION =
[MAJOR,MINOR,PATCH].join('.')

Class Method Summary collapse

Class Method Details

.archObject



72
# File 'lib/computer.rb', line 72

def self.arch() ARCH; end


12
13
14
# File 'lib/computer/version.rb', line 12

def self.banner
  "computer/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.cpuObject



71
# File 'lib/computer.rb', line 71

def self.cpu()  CPU;  end

.osObject



70
# File 'lib/computer.rb', line 70

def self.os()   OS;   end

.rootObject



16
17
18
# File 'lib/computer/version.rb', line 16

def self.root
  File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
end

.versionObject



8
9
10
# File 'lib/computer/version.rb', line 8

def self.version
  VERSION
end