diff options
author | Thomas Marshall <[email protected]> | 2024-05-31 20:24:53 +0100 |
---|---|---|
committer | git <[email protected]> | 2024-06-25 14:32:19 +0000 |
commit | 39951293b492b3b392ccb7a168fe723b03257ac3 () | |
tree | dbffc66e12cc7b841d99d12b0f0cec849366a59e | |
parent | 9f420e2ba582a32a1f6f436c0407c344b6d92d4b (diff) |
[rubygems/rubygems] Add Specification#validate_for_resolution
This method validates only what is required for resolution, skipping any irrelevant metadata validation. This will be used by Bundler instead of doing a full validation, allowing gem authors to use `bundle` commands immediately in newly created gems without first having to fix invalid metafata fields in the default gemspec. https://.com/rubygems/rubygems/commit/da7704cfc0
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 17 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/specification_policy.rb | 18 | ||||
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 34 |
4 files changed, 69 insertions, 4 deletions
@@ -32,6 +32,9 @@ module Gem require "rubygems/specification" class Specification require_relative "match_metadata" require_relative "match_platform" @@ -131,6 +134,12 @@ module Gem !default_gem? && !File.directory?(full_gem_path) end private def dependencies_to_gemfile(dependencies, group = nil) @@ -150,6 +159,14 @@ module Gem end end module BetterPermissionError def data super @@ -2586,6 +2586,10 @@ class Gem::Specification < Gem::BasicSpecification @test_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) } end def validate_metadata Gem::SpecificationPolicy.new(self).validate_metadata end @@ -45,6 +45,7 @@ class Gem::SpecificationPolicy def validate(strict = false) validate_required! validate_optional(strict) if packaging || strict @@ -85,15 +86,17 @@ class Gem::SpecificationPolicy validate_authors_field - validate_metadata - validate_licenses_length - validate_lazy_metadata - validate_duplicate_dependencies end def validate_optional(strict) validate_licenses @@ -121,6 +124,13 @@ class Gem::SpecificationPolicy end ## # Implementation for Specification#validate_metadata def validate_metadata @@ -3951,6 +3951,40 @@ end assert_equal ["default-2.0.0.0"], Gem::Specification.map(&:full_name) end def util_setup_deps @gem = util_spec "awesome", "1.0" do |awesome| awesome.add_runtime_dependency "bonobo", [] |