diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-12-07 21:30:26 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-12-08 15:55:15 +0900 |
commit | a530dfef2be3934decd975100585e3978ef49173 (patch) | |
tree | c36d00812e69f3a1c3ec23ed300444576e0d01a0 | |
parent | d61af5c49a9cc65c7009b9d2036bf43a527e8036 (diff) | |
download | ruby-a530dfef2be3934decd975100585e3978ef49173.tar.gz |
Improve bundled gem warnings
Before, when requiring "bigdecimal" in a Bundler context:
> foo.rb:1: warning: bigdecimal which 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 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.
-rw-r--r-- | lib/bundled_gems.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 66e13cfece..6b13adf91d 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -106,17 +106,18 @@ module Gem::BUNDLED_GEMS WARNED[name] = true if gem == true gem = name + "#{name} was loaded from the standard library, but" elsif gem return if WARNED[gem] WARNED[gem] = true - "#{name} is found in #{gem}" + "#{name} is found in #{gem}, which" else return end + build_message(gem) end def self.build_message(gem) - msg = " which #{RUBY_VERSION < SINCE[gem] ? "will no longer be" : "is not"} part of the default gems since Ruby #{SINCE[gem]}." + msg = " #{RUBY_VERSION < SINCE[gem] ? "will no longer be" : "is not"} part of the default gems since Ruby #{SINCE[gem]}." if defined?(Bundler) msg += " Add #{gem} to your Gemfile or gemspec." |