mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Fix to detect gem name logic. It's mistake to migrate bundled_gems.rb from rubygems_integration.rb
https://github.com/ioquatix/bake/pull/15#issuecomment-1777985097
This commit is contained in:
parent
7523ede7ba
commit
e10f7c9d5b
1 changed files with 4 additions and 1 deletions
|
@ -96,7 +96,10 @@ module Gem::BUNDLED_GEMS
|
||||||
|
|
||||||
if defined?(Bundler)
|
if defined?(Bundler)
|
||||||
msg += " Add #{gem} to your Gemfile or gemspec."
|
msg += " Add #{gem} to your Gemfile or gemspec."
|
||||||
location = caller_locations(2,2)[0]&.path
|
# We detect the gem name from caller_locations. We need to skip 2 frames like:
|
||||||
|
# lib/ruby/3.3.0+0/bundled_gems.rb:90:in `warning?'",
|
||||||
|
# lib/ruby/3.3.0+0/bundler/rubygems_integration.rb:247:in `block (2 levels) in replace_require'",
|
||||||
|
location = caller_locations(3,3)[0]&.path
|
||||||
if File.file?(location) && !location.start_with?(Gem::BUNDLED_GEMS::LIBDIR)
|
if File.file?(location) && !location.start_with?(Gem::BUNDLED_GEMS::LIBDIR)
|
||||||
caller_gem = nil
|
caller_gem = nil
|
||||||
Gem.path.each do |path|
|
Gem.path.each do |path|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue