Class: Jupiter::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/jupiter/cli.rb,
lib/jupiter/cli/output.rb,
lib/jupiter/cli/colorizer.rb

Defined Under Namespace

Modules: Colorizer Classes: Output

Instance Method Summary collapse

Instance Method Details

#ipObject



18
19
20
21
22
# File 'lib/jupiter/cli.rb', line 18

def ip
  vmserver = Jupiter.host_by_name(options[:host])
  puts vmserver.guest_ip(options[:guest])
  vmserver.close_ssh
end

#manageObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/jupiter/cli.rb', line 29

def manage
  Screen.new.clear
  output = Jupiter::Cli::Output.new(self)
  output.draw_menu
  output.draw_new_line

  if options[:guest].nil?
    task = output.ask_which_task
  else
    task = '2'
  end

  if task == '1'
    targetvm = ''
    vmserver = Jupiter.host_by_name(options[:host])
    output.manage_host(vmserver, options)
  end

  if task == '2'
    vmserver = Jupiter.host_by_name(options[:host])
    output.manage_vm(vmserver, options)
  end
end

#registerObject



57
58
59
60
61
# File 'lib/jupiter/cli.rb', line 57

def register
  vmserver = Jupiter.host_by_name(options[:host])
  puts vmserver.register_vm(options[:guest])
  vmserver.close_ssh
end

#runtimeObject



75
76
77
78
79
# File 'lib/jupiter/cli.rb', line 75

def runtime
  # puts config
  require 'pry'
  pry
end

#stateObject



8
9
10
11
12
# File 'lib/jupiter/cli.rb', line 8

def state
  vmserver = Jupiter.host_by_name(options[:host])
  puts vmserver.vm_state(options[:guest])
  vmserver.close_ssh
end

#unregisterObject



67
68
69
70
71
# File 'lib/jupiter/cli.rb', line 67

def unregister
  vmserver = Jupiter.host_by_name(options[:host])
  puts vmserver.unregister_vm(options[:guest])
  vmserver.close_ssh
end