Mitchell Hashimoto 67855be77b Add the Environment#machine method
This will eventually replace the Environment#vms method. Because of the
introduction of providers, the environment doesn't know what the backing
of the machines will be (and they're _machines_ now, not _vms_).
Instead, users of Environment will now call `#machine` on the
environment to retrieve a machine with the given backing provider as it
needs it.
2012-11-07 21:45:09 -08:00

42 lines
982 B
Ruby

require 'optparse'
require "vagrant"
require File.expand_path("../start_mixins", __FILE__)
module VagrantPlugins
module CommandUp
class Command < Vagrant.plugin("2", :command)
include StartMixins
def execute
options = {}
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant up [vm-name] [--[no-]provision] [--provider provider] [-h]"
o.separator ""
build_start_options(o, options)
o.on("--provider provider", String,
"Back the machine with a specific provider.") do |provider|
options["provider"] = provider
end
end
# Parse the options
argv = parse_options(opts)
return if !argv
# Go over each VM and bring it up
@logger.debug("'Up' each target VM...")
with_target_vms(argv) do |machine|
machine.action(:up)
end
# Success, exit status 0
0
end
end
end
end