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:
parent
2335768437
commit
38b07a7fee
39
prelude.rb
39
prelude.rb
@ -1,49 +1,12 @@
|
|||||||
class Binding
|
class Binding
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
def irb
|
def irb
|
||||||
begin
|
require 'irb'
|
||||||
require 'irb'
|
|
||||||
rescue LoadError, Gem::LoadError
|
|
||||||
force_activate 'irb'
|
|
||||||
retry
|
|
||||||
end
|
|
||||||
irb
|
irb
|
||||||
end
|
end
|
||||||
|
|
||||||
# suppress redefinition warning
|
# suppress redefinition warning
|
||||||
alias irb irb # :nodoc:
|
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
|
end
|
||||||
|
|
||||||
module Kernel
|
module Kernel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user