[rubygems/rubygems] make bundled gemst list as constant under Gem namespace

https://github.com/rubygems/rubygems/commit/438eac5447
This commit is contained in:
Hiroshi SHIBATA 2023-07-20 11:02:15 +09:00 коммит произвёл git
Родитель cc2617ae3f
Коммит 2424b921b2
2 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -29,6 +29,12 @@ unless Gem.ruby_version.to_s == RUBY_VERSION || RUBY_PATCHLEVEL == -1
end end
module Gem module Gem
BUNDLED_GEMS = %w[
abbrev observer getoptlong resolv-replace rinda
nkf syslog drb mutex_m csv base64
]
class Specification class Specification
include ::Bundler::MatchMetadata include ::Bundler::MatchMetadata
include ::Bundler::MatchPlatform include ::Bundler::MatchPlatform

Просмотреть файл

@ -230,14 +230,10 @@ module Bundler
return if [kernel, ::Kernel].any?{|klass| klass.respond_to?(:no_warning_require)} return if [kernel, ::Kernel].any?{|klass| klass.respond_to?(:no_warning_require)}
bundled_gems = %w[
abbrev observer getoptlong resolv-replace rinda
nkf syslog drb mutex_m csv base64
]
[kernel, ::Kernel].each do |kernel_class| [kernel, ::Kernel].each do |kernel_class|
kernel_class.send(:alias_method, :no_warning_require, :require) kernel_class.send(:alias_method, :no_warning_require, :require)
kernel_class.send(:define_method, :require) do |file| kernel_class.send(:define_method, :require) do |file|
if bundled_gems.include?(file) if ::Gem::BUNDLED_GEMS.include?(file)
unless specs.to_a.map(&:name).include?(file) unless specs.to_a.map(&:name).include?(file)
target_file = begin target_file = begin
Bundler.default_gemfile.basename Bundler.default_gemfile.basename