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

#distributionObject



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

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

#kernelObject



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

def kernel
  shell.run 'uname -r'
end

#nameObject



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

def name
  shell.run 'uname -o'
end

#platformObject



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

def platform
  shell.run 'uname -i'
end

#versionObject



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

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