irb and reline are now bundled gems, we don't need to skip workaround for them

This commit is contained in:
Hiroshi SHIBATA 2025-01-23 17:29:03 +09:00
parent 750e619504
commit 68095ffc16
Notes: git 2025-01-24 06:47:06 +00:00
2 changed files with 1 additions and 15 deletions

View File

@ -127,11 +127,6 @@ module Gem::BUNDLED_GEMS # :nodoc:
# name can be a feature name or a file path with String or Pathname
feature = File.path(name)
# irb already has reline as a dependency on gemspec, so we don't want to warn about it.
# We should update this with a more general solution when we have another case.
# ex: Gem.loaded_specs[called_gem].dependencies.any? {|d| d.name == feature }
return false if feature.start_with?("reline") && caller_locations(2, 1)[0].to_s.include?("irb")
# The actual checks needed to properly identify the gem being required
# are costly (see [Bug #20641]), so we first do a much cheaper check
# to exclude the vast majority of candidates.

View File

@ -64,7 +64,7 @@ RSpec.describe "bundled_gems.rb" do
Gem::BUNDLED_GEMS.send(:remove_const, :PREFIXED)
Gem::BUNDLED_GEMS.const_set(:LIBDIR, File.expand_path(File.join(__dir__, "../../..", "lib")) + "/")
Gem::BUNDLED_GEMS.const_set(:ARCHDIR, File.expand_path($LOAD_PATH.find{|path| path.include?(".ext/common") }) + "/")
Gem::BUNDLED_GEMS.const_set(:SINCE, { "openssl" => RUBY_VERSION, "fileutils" => RUBY_VERSION, "irb" => "3.5.0", "csv" => "3.4.0", "net-smtp" => "3.1.0" })
Gem::BUNDLED_GEMS.const_set(:SINCE, { "openssl" => RUBY_VERSION, "fileutils" => RUBY_VERSION, "csv" => "3.4.0", "net-smtp" => "3.1.0" })
Gem::BUNDLED_GEMS.const_set(:SINCE_FAST_PATH, Gem::BUNDLED_GEMS::SINCE.transform_keys { |g| g.sub(/\A.*\-/, "") } )
Gem::BUNDLED_GEMS.const_set(:PREFIXED, { "openssl" => true })
STUB
@ -365,13 +365,4 @@ RSpec.describe "bundled_gems.rb" do
expect(err).to be_empty
end
it "Don't show warning for reline when using irb from standard library" do
create_file("stub.rb", stub_code)
create_file("Gemfile", "source 'https://rubygems.org'")
bundle "exec ruby -r./stub -rirb -e ''"
expect(err).to include(/irb was loaded from (.*) from Ruby 3.5.0/)
expect(err).to_not include(/reline was loaded from (.*) from Ruby 3.5.0/)
end
end