diff options
author | Andre Arko <andre@arko.net> | 2015-05-18 16:10:04 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-05-18 16:10:04 -0700 |
commit | 9ed9afd1c9b9bab12524d3f9044812b6759d935f (patch) | |
tree | 7a27bc85ff77aa33f7840a1dd98480dd0643efec | |
parent | dce2b59765f6b2c445bcc0e66100b2a0604ffafd (diff) | |
download | bundler-9ed9afd1c9b9bab12524d3f9044812b6759d935f.tar.gz |
completely backwards-compatible gemspec validation
-rw-r--r-- | lib/bundler.rb | 3 | ||||
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 13 |
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index ff29fcca51..067e66ff05 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -369,6 +369,9 @@ module Bundler Bundler.rubygems.validate(spec) if spec && validate spec end + rescue Gem::InvalidSpecificationException => e + raise InvalidOption, "The gemspec at #{file} is not valid. " \ + "The validation error was '#{e.message}'" end def clear_gemspec_cache diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index cf1edcb20f..27da9d0b8c 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -48,13 +48,7 @@ module Bundler end def validate(spec) - # This is overridden to do nothing on RubyGems < 1.7, because those - # versions of RubyGems raise validation exceptions for things that - # are only a warning in versions 1.7 and up. Bundler.ui.silence { spec.validate } - rescue Gem::InvalidSpecificationException => e - raise InvalidOption, "The gemspec at #{file} is not valid. " \ - "The validation error was '#{e.message}'" end def path(obj) @@ -468,6 +462,10 @@ module Bundler end def validate(spec) + # Missing summary is downgraded to a warning in later versions, + # so we set it to an empty string to prevent an exception here. + spec.summary ||= "" + super end end @@ -477,9 +475,6 @@ module Bundler super backport_segment_generation end - - def validate(spec) - end end # Rubygems 1.7 |