From 072e71df8a2d9c663bc51ef8bffbd833e4b372a1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 7 Jul 2010 09:15:30 -0700 Subject: [PATCH] Customize uses the proper VM object --- lib/vagrant/action/vm/customize.rb | 4 ++-- test/vagrant/action/vm/customize_test.rb | 9 ++++++--- vagrant.gemspec | 8 +++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/vagrant/action/vm/customize.rb b/lib/vagrant/action/vm/customize.rb index f74568337..505dd665a 100644 --- a/lib/vagrant/action/vm/customize.rb +++ b/lib/vagrant/action/vm/customize.rb @@ -9,8 +9,8 @@ module Vagrant def call(env) if !env.env.config.vm.proc_stack.empty? env.logger.info "Running any VM customizations..." - env.env.config.vm.run_procs!(env["vm"]) - env["vm"].save + env.env.config.vm.run_procs!(env["vm"].vm) + env["vm"].vm.save end @app.call(env) diff --git a/test/vagrant/action/vm/customize_test.rb b/test/vagrant/action/vm/customize_test.rb index 8777e2ea9..d2cefcdaa 100644 --- a/test/vagrant/action/vm/customize_test.rb +++ b/test/vagrant/action/vm/customize_test.rb @@ -8,18 +8,21 @@ class CustomizeVMActionTest < Test::Unit::TestCase @vm = mock("vm") @env["vm"] = @vm + + @internal_vm = mock("internal") + @vm.stubs(:vm).returns(@internal_vm) end should "not run anything if no customize blocks exist" do - @vm.expects(:save).never + @internal_vm.expects(:save).never @app.expects(:call).with(@env).once @instance.call(@env) end should "run the VM customization procs then save the VM" do @env.env.config.vm.customize { |vm| } - @env.env.config.vm.expects(:run_procs!).with(@vm) - @vm.expects(:save).once + @env.env.config.vm.expects(:run_procs!).with(@internal_vm) + @internal_vm.expects(:save).once @app.expects(:call).with(@env).once @instance.call(@env) end diff --git a/vagrant.gemspec b/vagrant.gemspec index d0263a1f2..4ad27f5b1 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["Mitchell Hashimoto", "John Bender"] - s.date = %q{2010-07-06} + s.date = %q{2010-07-07} s.default_executable = %q{vagrant} s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.} s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"] @@ -50,7 +50,9 @@ Gem::Specification.new do |s| "lib/vagrant/action/vm/network.rb", "lib/vagrant/action/vm/persist.rb", "lib/vagrant/action/vm/provision.rb", + "lib/vagrant/action/vm/resume.rb", "lib/vagrant/action/vm/share_folders.rb", + "lib/vagrant/action/vm/suspend.rb", "lib/vagrant/actions/base.rb", "lib/vagrant/actions/box/add.rb", "lib/vagrant/actions/box/destroy.rb", @@ -146,7 +148,9 @@ Gem::Specification.new do |s| "test/vagrant/action/vm/network_test.rb", "test/vagrant/action/vm/persist_test.rb", "test/vagrant/action/vm/provision_test.rb", + "test/vagrant/action/vm/resume_test.rb", "test/vagrant/action/vm/share_folders_test.rb", + "test/vagrant/action/vm/suspend_test.rb", "test/vagrant/action_test.rb", "test/vagrant/actions/base_test.rb", "test/vagrant/actions/box/add_test.rb", @@ -240,7 +244,9 @@ Gem::Specification.new do |s| "test/vagrant/action/vm/network_test.rb", "test/vagrant/action/vm/persist_test.rb", "test/vagrant/action/vm/provision_test.rb", + "test/vagrant/action/vm/resume_test.rb", "test/vagrant/action/vm/share_folders_test.rb", + "test/vagrant/action/vm/suspend_test.rb", "test/vagrant/action_test.rb", "test/vagrant/actions/base_test.rb", "test/vagrant/actions/box/add_test.rb",