Fix regression with `package` not working. [closes GH-132]

This commit is contained in:
Mitchell Hashimoto 2010-08-02 19:44:15 -07:00
parent 1ebfc49db4
commit 22a9e3fe3d
3 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
## 0.5.2 (unreleased) ## 0.5.2 (unreleased)
- Fix regression with `package` not working. [GH-132]
- Added ability to specify box url in `init`, which populates the - Added ability to specify box url in `init`, which populates the
Vagrantfile with the proper `config.vm.box_url`. Vagrantfile with the proper `config.vm.box_url`.

View File

@ -21,7 +21,7 @@ module Vagrant
# box. This Vagrantfile contains the MAC address so that the user doesn't # box. This Vagrantfile contains the MAC address so that the user doesn't
# have to worry about it. # have to worry about it.
def create_vagrantfile def create_vagrantfile
File.open(File.join(@env["package.directory"], "Vagrantfile"), "w") do |f| File.open(File.join(@env["export.temp_dir"], "Vagrantfile"), "w") do |f|
f.write(TemplateRenderer.render("package_Vagrantfile", { f.write(TemplateRenderer.render("package_Vagrantfile", {
:base_mac => @env["vm"].vm.network_adapters.first.mac_address :base_mac => @env["vm"].vm.network_adapters.first.mac_address
})) }))

View File

@ -7,7 +7,7 @@ class PackageVagrantfileVMActionTest < Test::Unit::TestCase
@vm = mock("vm") @vm = mock("vm")
@env["vm"] = @vm @env["vm"] = @vm
@env["package.directory"] = "foo" @env["export.temp_dir"] = "foo"
@internal_vm = mock("internal") @internal_vm = mock("internal")
@vm.stubs(:vm).returns(@internal_vm) @vm.stubs(:vm).returns(@internal_vm)
@ -34,7 +34,7 @@ class PackageVagrantfileVMActionTest < Test::Unit::TestCase
should "write the rendered vagrantfile to temp_path Vagrantfile" do should "write the rendered vagrantfile to temp_path Vagrantfile" do
f = mock("file") f = mock("file")
rendered = mock("rendered") rendered = mock("rendered")
File.expects(:open).with(File.join(@env["package.directory"], "Vagrantfile"), "w").yields(f) File.expects(:open).with(File.join(@env["export.temp_dir"], "Vagrantfile"), "w").yields(f)
Vagrant::Util::TemplateRenderer.expects(:render).returns(rendered).with("package_Vagrantfile", { Vagrant::Util::TemplateRenderer.expects(:render).returns(rendered).with("package_Vagrantfile", {
:base_mac => @internal_vm.network_adapters.first.mac_address :base_mac => @internal_vm.network_adapters.first.mac_address
}) })