Sha256: bdaccd7e1053626f14ee412499ccca8c08cba344a82f99571e33d102f2a6b4c3
Contents?: true
Size: 790 Bytes
Versions: 7
Compression:
Stored size: 790 Bytes
Contents
require "English" module VagrantHelpers extend self class VagrantSSHCommandError < RuntimeError; end at_exit do if ENV["KEEP_RUNNING"] puts "Vagrant vm will be left up because KEEP_RUNNING is set." puts "Rerun without KEEP_RUNNING set to cleanup the vm." else vagrant_cli_command("destroy -f") end end def vagrant_cli_command(command) puts "[vagrant] #{command}" Dir.chdir(VAGRANT_ROOT) do `#{VAGRANT_BIN} #{command} 2>&1`.split("\n").each do |line| puts "[vagrant] #{line}" end end $CHILD_STATUS end def run_vagrant_command(command) status = vagrant_cli_command("ssh -c #{command.inspect}") return true if status.success? raise VagrantSSHCommandError, status end end World(VagrantHelpers)
Version data entries
7 entries across 7 versions & 1 rubygems