Class: Datacenter::OS

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

Instance Method Summary collapse

Constructor Details

#initialize(shell = nil) ⇒ OS

Returns a new instance of OS.



4
5
6
# File 'lib/datacenter/os.rb', line 4

def initialize(shell=nil)
  @shell = shell || Shell::Localhost.new
end

Instance Method Details

#distribution ⇒ Object



12
13
14
# File 'lib/datacenter/os.rb', line 12

def distribution
  shell.run('lsb_release -i').split(':')[1].strip
end

#kernel ⇒ Object



20
21
22
# File 'lib/datacenter/os.rb', line 20

def kernel
  shell.run 'uname -r'
end

#name ⇒ Object



8
9
10
# File 'lib/datacenter/os.rb', line 8

def name
  shell.run 'uname -o'
end

#platform ⇒ Object



24
25
26
# File 'lib/datacenter/os.rb', line 24

def platform
  shell.run 'uname -i'
end

#version ⇒ Object



16
17
18
# File 'lib/datacenter/os.rb', line 16

def version
  shell.run('lsb_release -r').split(':')[1].strip
end