Dont't warn reline called from irb, reline is already declared at irb gemspec

This commit is contained in:
Hiroshi SHIBATA 2024-09-13 13:19:31 +09:00
Родитель 6ae05584bd
Коммит 3146cbbbc4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
2 изменённых файлов: 9 добавлений и 0 удалений

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

@ -133,6 +133,11 @@ module Gem::BUNDLED_GEMS
# 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.

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

@ -59,3 +59,7 @@ echo
echo "* Show warning with bootsnap and some gem in Gemfile"
ruby test_warn_bootsnap_and_gem.rb
echo
echo "* Don't show warning for reline when using irb from standard library"
bundle exec ruby -rirb -e ''
echo