diff --git a/config/default.rb b/config/default.rb index 125af28a1..415034291 100644 --- a/config/default.rb +++ b/config/default.rb @@ -44,6 +44,5 @@ Vagrant::Config.run do |config| # config.vm.sync_script = "/tmp/sync" # config.vm.sync_crontab_entry_file = "/tmp/crontab-entry" - config.package.name = 'vagrant' - config.package.extension = '.box' + config.package.name = 'package.box' end diff --git a/lib/vagrant/action/vm/package.rb b/lib/vagrant/action/vm/package.rb index afb338386..c7e951b77 100644 --- a/lib/vagrant/action/vm/package.rb +++ b/lib/vagrant/action/vm/package.rb @@ -7,7 +7,7 @@ module Vagrant def initialize(app, env) @app = app @env = env - @env["package.output"] ||= "package" + @env["package.output"] ||= env["config"].package.name @env["package.include"] ||= [] env.error!(:box_file_exists, :output_file => tar_path) if File.exist?(tar_path) @@ -91,7 +91,7 @@ module Vagrant # Path to the final box output file def tar_path - File.join(FileUtils.pwd, "#{@env["package.output"]}#{@env.env.config.package.extension}") + File.join(FileUtils.pwd, @env["package.output"]) end end end diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index 0e74cdab3..1d03aae71 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -192,7 +192,6 @@ module Vagrant class PackageConfig < Base attr_accessor :name - attr_accessor :extension end class VagrantConfig < Base diff --git a/test/test_helper.rb b/test/test_helper.rb index 49b5a8653..090c92fe2 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -42,8 +42,7 @@ class Test::Unit::TestCase config.vm.system = :linux config.vm.share_folder("v-root", "/vagrant", ".") - config.package.name = 'vagrant' - config.package.extension = '.box' + config.package.name = 'package' # Unison config.unison.folder_suffix = ".sync" diff --git a/test/vagrant/action/vm/package_test.rb b/test/vagrant/action/vm/package_test.rb index ea780abb8..97b3ff52c 100644 --- a/test/vagrant/action/vm/package_test.rb +++ b/test/vagrant/action/vm/package_test.rb @@ -31,9 +31,9 @@ class PackageVMActionTest < Test::Unit::TestCase assert_equal :box_file_exists, @env.error.first end - should "set the output path to 'package' by default" do + should "set the output path to configured by default" do @klass.new(@app, @env) - assert_equal "package", @env["package.output"] + assert_equal @env["config"].package.name, @env["package.output"] end should "not set the output path if it is already set" do @@ -258,5 +258,10 @@ class PackageVMActionTest < Test::Unit::TestCase end end + context "tar path" do + should "return proper path" do + assert_equal File.join(FileUtils.pwd, @env["package.output"]), @instance.tar_path + end + end end end