lib/vagrant/commands/up.rb in vagrant-0.3.4 vs lib/vagrant/commands/up.rb in vagrant-0.4.0
- old
+ new
@@ -7,20 +7,39 @@
class Up < Base
Base.subcommand "up", self
description "Creates the vagrant environment"
def execute(args=[])
- if env.vm
- logger.info "VM already created. Starting VM if its not already running..."
- env.vm.start
+ all_or_single(args, :up)
+ end
+
+ def up_single(name)
+ vm = env.vms[name.to_sym]
+ if vm.nil?
+ error_and_exit(:unknown_vm, :vm => name)
+ return # for tests
+ end
+
+ if vm.created?
+ vm.env.logger.info "VM '#{name}' already created. Booting if its not already running..."
+ vm.start
else
- env.require_box
- env.create_vm.execute!(Actions::VM::Up)
+ vm.env.require_box
+
+ vm.env.logger.info "Creating VM '#{name}'"
+ vm.up
end
end
def options_spec(opts)
- opts.banner = "Usage: vagrant up"
+ opts.banner = "Usage: vagrant up [--no-provision]"
+
+ # Defaults
+ options[:provision] = true
+
+ opts.on("--no-provision", "Do not provision during this up.") do |v|
+ options[:provision] = false
+ end
end
end
end
-end
\ No newline at end of file
+end