aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/source/path.rb
diff options
context:
space:
mode:
authorSamuel E. Giddins <segiddins@segiddins.me>2015-05-16 20:26:36 -0700
committerAndre Arko <andre@arko.net>2015-05-16 22:58:10 -0700
commit858afa5cfec914bd3c9d6242d1ae49cd6c227fa1 (patch)
tree8a10e014db248aa9900e12405c8c50d761d3ba87 /lib/bundler/source/path.rb
parent86c0b7775690f5b00fe3f3f73ae407b2fa6db875 (diff)
downloadbundler-858afa5cfec914bd3c9d6242d1ae49cd6c227fa1.tar.gz
[Path] Validate the gemspecs we find when globbing
Diffstat (limited to 'lib/bundler/source/path.rb')
-rw-r--r--lib/bundler/source/path.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 862fbcb9..6c2ed858 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -1,6 +1,5 @@
module Bundler
class Source
-
class Path < Source
autoload :Installer, 'bundler/source/path/installer'
@@ -132,8 +131,7 @@ module Bundler
if File.directory?(expanded_path)
# We sort depth-first since `<<` will override the earlier-found specs
Dir["#{expanded_path}/#{@glob}"].sort_by { |p| -p.split(File::SEPARATOR).size }.each do |file|
- spec = Bundler.load_gemspec(file)
- if spec
+ if spec = load_and_validate_gemspec(file)
spec.loaded_from = file.to_s
spec.source = self
index << spec
@@ -220,7 +218,16 @@ module Bundler
end
end
end
- end
+ def load_and_validate_gemspec(file)
+ spec = load_gemspec(file)
+ spec.validate
+ spec
+ rescue Gem::InvalidSpecificationException => e
+ raise InvalidOption, "The gemspec at #{file} is not valid. " \
+ "The validation error was '#{e.message}'"
+ end
+
+ end
end
end