diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 547102be41..296bcfff38 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -384,13 +384,13 @@ module Gem end end - remove_method :ignored? if new.respond_to?(:ignored?) + # Can be removed once RubyGems 3.5.22 support is dropped + unless new.respond_to?(:ignored?) + def ignored? + return @ignored unless @ignored.nil? - # Same as RubyGems, but without warnings, because Bundler prints its own warnings - def ignored? - return @ignored unless @ignored.nil? - - @ignored = missing_extensions? + @ignored = missing_extensions? + end end end diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb index 8c75fd41d4..a09e8ed0e1 100644 --- a/lib/rubygems/basic_specification.rb +++ b/lib/rubygems/basic_specification.rb @@ -71,7 +71,14 @@ class Gem::BasicSpecification # Return true if this spec can require +file+. def contains_requirable_file?(file) - return false if ignored? + if ignored? + if platform == Gem::Platform::RUBY || Gem::Platform.local === platform + warn "Ignoring #{full_name} because its extensions are not built. " \ + "Try: gem pristine #{name} --version #{version}" + end + + return false + end is_soext = file.end_with?(".so", ".o") @@ -89,14 +96,6 @@ class Gem::BasicSpecification return @ignored unless @ignored.nil? @ignored = missing_extensions? - return false unless @ignored - - if platform == Gem::Platform::RUBY || Gem::Platform.local === platform - warn "Ignoring #{full_name} because its extensions are not built. " \ - "Try: gem pristine #{name} --version #{version}" - end - - true end def default_gem?