Module: Hypercube::Backend::VirtualBox

Defined in:
lib/hypercube/backends/virtual_box.rb

Defined Under Namespace

Modules: Commands

Class Method Summary collapse

Class Method Details

.executableObject



27
28
29
# File 'lib/hypercube/backends/virtual_box.rb', line 27

def executable
  'VBoxManage'
end

.run(*command) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hypercube/backends/virtual_box.rb', line 6

def run *command
  command = command.flatten

  if command.first == 'set' then
    _, vm, attribute, value = command
    command = ["#{attribute}=", vm, value]
  end

  #raise NotImplementedError unless Commands.instance_methods(false).include?(command)

  status, stdout, stderr = systemu [executable, Commands.send(*command)].join(' ')

  raise stderr unless status.exitstatus == 0

  $last_status = status.exitstatus
  $last_out = stdout
  $last_error = stderr

  stdout
end