Class: Central::Cli::Master::Vagrant::RestartCommand

Inherits:
Clamp::Command
  • Object
show all
Includes:
Common
Defined in:
lib/central/cli/master/vagrant/restart_command.rb

Instance Method Summary collapse

Methods included from Common

#access_token=, #add_master, #api_url, #api_url=, #clear_current_stack, #client, #current_master, #current_master=, #current_master_index, #current_stack, #current_stack=, #ensure_custom_ssl_ca, #require_api_url, #require_current_stack, #require_token, #reset_client, #save_settings, #settings, #settings_filename

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/central/cli/master/vagrant/restart_command.rb', line 5

def execute
  require 'central/machine/vagrant'
  vagrant_path = "#{Dir.home}/.central/vagrant_master"
  abort('Cannot find Vagrant central-machine'.colorize(:red)) unless Dir.exist?(vagrant_path)
  Dir.chdir(vagrant_path) do
    ShellSpinner 'Restarting Vagrant central-machine ' do
      Open3.popen2('vagrant reload') do |_stdin, output, _wait|
        while o = output.gets
          print o if ENV['DEBUG']
        end
      end
    end
  end
end