Method: VMC::Micro::Switcher::Base#initialize

Defined in:
lib/vmc/micro/switcher/base.rb

#initialize(config) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vmc/micro/switcher/base.rb', line 7

def initialize(config)
  @config = config

  @vmrun = VMC::Micro::VMrun.new(config)
  unless @vmrun.running?
    if ask("Micro Cloud Foundry VM is not running. Do you want to start it?", :choices => ['y', 'n']) == 'y'
      display "Starting Micro Cloud Foundry VM: ", false
      @vmrun.start
      say "done".green
    else
      err "Micro Cloud Foundry VM needs to be running."
    end
  end

  err "Micro Cloud Foundry VM initial setup needs to be completed before using 'vmc micro'" unless @vmrun.ready?
end