lib/vagrant/box_collection.rb in vagrant-unbundled-2.2.19.0 vs lib/vagrant/box_collection.rb in vagrant-unbundled-2.3.2.0

- old
+ new

@@ -15,10 +15,12 @@ class BoxCollection TEMP_PREFIX = "vagrant-box-add-temp-".freeze VAGRANT_SLASH = "-VAGRANTSLASH-".freeze VAGRANT_COLON = "-VAGRANTCOLON-".freeze + autoload :Remote, "vagrant/box_collection/remote" + # The directory where the boxes in this collection are stored. # # A box collection matches a very specific folder structure that Vagrant # expects in order to easily manage and modify boxes. The folder structure # is the following: @@ -272,10 +274,15 @@ def find(name, providers, version) providers = Array(providers) # Build up the requirements we have requirements = version.to_s.split(",").map do |v| - Gem::Requirement.new(v.strip) + begin + Gem::Requirement.new(v.strip) + rescue Gem::Requirement::BadRequirementError + raise Errors::BoxVersionInvalid, + version: v.strip + end end with_collection_lock do box_directory = @directory.join(dir_name(name)) if !box_directory.directory?