`vagrant package` checks for output file existing [closes GH-100]
This commit is contained in:
parent
499340aa03
commit
e4b13ea758
|
@ -10,6 +10,8 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepare
|
def prepare
|
||||||
|
raise ActionException.new(:box_file_exists, :output_file => tar_path) if File.exist?(tar_path)
|
||||||
|
|
||||||
# Verify the existance of all the additional files, if any
|
# Verify the existance of all the additional files, if any
|
||||||
include_files.each do |file|
|
include_files.each do |file|
|
||||||
raise ActionException.new(:package_include_file_doesnt_exist, :filename => file) unless File.exists?(file)
|
raise ActionException.new(:package_include_file_doesnt_exist, :filename => file) unless File.exists?(file)
|
||||||
|
|
|
@ -70,6 +70,12 @@
|
||||||
A box with the name '<%= box_name %>' already exists, please use another name or use `vagrant box remove <%= box_name %>`
|
A box with the name '<%= box_name %>' already exists, please use another name or use `vagrant box remove <%= box_name %>`
|
||||||
:box_download_unknown_type: |-
|
:box_download_unknown_type: |-
|
||||||
Unknown URI type for box download.
|
Unknown URI type for box download.
|
||||||
|
:box_file_exists: |-
|
||||||
|
The specified output file for packaging already exists. Please move
|
||||||
|
the file or modify the output filename parameter then try to package
|
||||||
|
again.
|
||||||
|
|
||||||
|
Specified output file: <%= output_file %>
|
||||||
:box_remove_doesnt_exist: |-
|
:box_remove_doesnt_exist: |-
|
||||||
The box you're attempting to remove does not exist!
|
The box you're attempting to remove does not exist!
|
||||||
:box_specified_doesnt_exist: |-
|
:box_specified_doesnt_exist: |-
|
||||||
|
|
|
@ -226,6 +226,11 @@ class PackageActionTest < Test::Unit::TestCase
|
||||||
@action.prepare
|
@action.prepare
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "raise an exception if the output file already exists" do
|
||||||
|
File.expects(:exist?).with(@action.tar_path).returns(false)
|
||||||
|
assert_raises(Vagrant::Actions::ActionException) { @action.prepare }
|
||||||
|
end
|
||||||
|
|
||||||
should "raise an exception when an include file does not exist" do
|
should "raise an exception when an include file does not exist" do
|
||||||
File.expects(:exists?).once.returns(false)
|
File.expects(:exists?).once.returns(false)
|
||||||
assert_raises(Vagrant::Actions::ActionException) { @action.prepare }
|
assert_raises(Vagrant::Actions::ActionException) { @action.prepare }
|
||||||
|
|
|
@ -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.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["Mitchell Hashimoto", "John Bender"]
|
s.authors = ["Mitchell Hashimoto", "John Bender"]
|
||||||
s.date = %q{2010-06-24}
|
s.date = %q{2010-06-29}
|
||||||
s.default_executable = %q{vagrant}
|
s.default_executable = %q{vagrant}
|
||||||
s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.}
|
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"]
|
s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"]
|
||||||
|
|
Loading…
Reference in New Issue