зеркало из https://github.com/github/ruby.git
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:
Родитель
2335768437
Коммит
38b07a7fee
39
prelude.rb
39
prelude.rb
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче