aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-12-07 21:35:47 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-08 15:55:15 +0900
commit64e985333f4fa7e4ba06454ef50c41e56a22768d (patch)
tree6dffc1ba9031394c72e9fff69508d2a008f8fc4e /lib
parenta530dfef2be3934decd975100585e3978ef49173 (diff)
downloadruby-64e985333f4fa7e4ba06454ef50c41e56a22768d.tar.gz
Improve bundled gems warnings for subfeatures
Before, when requiring "bigdecimal/math" in a Bundler context: > /Users/deivid/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/bigdecimal/math.rb:2: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. After: > foo.rb:1: warning: bigdecimal/math is found in bigdecimal, which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
Diffstat (limited to 'lib')
-rw-r--r--lib/bundled_gems.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb
index 6b13adf91d..3967511cd1 100644
--- a/lib/bundled_gems.rb
+++ b/lib/bundled_gems.rb
@@ -89,10 +89,10 @@ module Gem::BUNDLED_GEMS
end
def self.warning?(name, specs: nil)
- name = File.path(name) # name can be a feature name or a file path with String or Pathname
- return if specs.to_a.map(&:name).include?(name.sub(LIBEXT, ""))
- name = name.tr("/", "-")
- _t, path = $:.resolve_feature_path(name)
+ feature = File.path(name) # name can be a feature name or a file path with String or Pathname
+ return if specs.to_a.map(&:name).include?(feature.sub(LIBEXT, ""))
+ _t, path = $:.resolve_feature_path(feature)
+ name = feature.tr("/", "-")
if gem = find_gem(path)
caller = caller_locations(3, 3).find {|c| c&.absolute_path}
return if find_gem(caller&.absolute_path)
@@ -106,11 +106,11 @@ module Gem::BUNDLED_GEMS
WARNED[name] = true
if gem == true
gem = name
- "#{name} was loaded from the standard library, but"
+ "#{feature} was loaded from the standard library, but"
elsif gem
return if WARNED[gem]
WARNED[gem] = true
- "#{name} is found in #{gem}, which"
+ "#{feature} is found in #{gem}, which"
else
return
end + build_message(gem)