Revert force_activate feature. It's unnecessary for Ruby 3.4.

I will add this feature for Ruby 3.5 again.
This commit is contained in:
Hiroshi SHIBATA 2024-11-13 16:43:01 +09:00
Родитель 2335768437
Коммит 38b07a7fee
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
1 изменённых файлов: 1 добавлений и 38 удалений

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

@ -1,49 +1,12 @@
class Binding
# :nodoc:
def irb
begin
require 'irb'
rescue LoadError, Gem::LoadError
force_activate 'irb'
retry
end
require 'irb'
irb
end
# suppress redefinition warning
alias irb irb # :nodoc:
private def force_activate(gem)
Bundler.reset!
builder = Bundler::Dsl.new
if Bundler.definition.gemfiles.empty? # bundler/inline
Bundler.definition.locked_gems.specs.each{|spec| builder.gem spec.name, spec.version.to_s }
else
Bundler.definition.gemfiles.each{|gemfile| builder.eval_gemfile(gemfile) }
end
builder.gem gem
definition = builder.to_definition(nil, true)
definition.validate_runtime!
begin
orig_ui = Bundler.ui
orig_no_lock = Bundler::Definition.no_lock
ui = Bundler::UI::Shell.new
ui.level = "silent"
Bundler.ui = ui
Bundler::Definition.no_lock = true
Bundler::Runtime.new(nil, definition).setup
rescue Bundler::GemNotFound
warn "Failed to activate #{gem}, please install it with 'gem install #{gem}'"
ensure
Bundler.ui = orig_ui
Bundler::Definition.no_lock = orig_no_lock
end
end
end
module Kernel