vagrant/plugins/commands/up/command.rb

42 lines
1023 B
Ruby
Raw Normal View History

2012-04-19 20:59:48 +00:00
require 'optparse'
require "vagrant"
require File.expand_path("../start_mixins", __FILE__)
2012-04-19 20:59:48 +00:00
module VagrantPlugins
module CommandUp
2012-11-07 05:05:14 +00:00
class Command < Vagrant.plugin("2", :command)
2012-04-20 04:33:26 +00:00
include StartMixins
2012-04-19 20:59:48 +00:00
def execute
options = {}
2012-08-15 05:38:41 +00:00
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant up [vm-name] [--[no-]provision] [--provider provider] [-h]"
2012-08-15 05:38:41 +00:00
o.separator ""
2012-08-15 05:38:41 +00:00
build_start_options(o, options)
o.on("--provider provider", String,
"Back the machine with a specific provider.") do |provider|
options[:provider] = provider
end
2012-04-19 20:59:48 +00:00
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, :provider => options[:provider]) do |machine|
machine.action(:up, options)
2012-04-19 20:59:48 +00:00
end
# Success, exit status 0
0
2012-08-15 05:38:41 +00:00
end
2012-04-19 20:59:48 +00:00
end
end
end