[rubygems/rubygems] Fix bundle console
unnecessarily trying to load IRB twice
https://github.com/rubygems/rubygems/commit/f9bf58573f
This commit is contained in:
parent
3cff46c521
commit
56e2ef2468
@ -20,9 +20,14 @@ module Bundler
|
||||
require name
|
||||
get_constant(name)
|
||||
rescue LoadError
|
||||
Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
|
||||
require "irb"
|
||||
get_constant("irb")
|
||||
if name == "irb"
|
||||
Bundler.ui.error "#{name} is not available"
|
||||
exit 1
|
||||
else
|
||||
Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
|
||||
name = "irb"
|
||||
retry
|
||||
end
|
||||
end
|
||||
|
||||
def get_constant(name)
|
||||
|
@ -119,6 +119,17 @@ RSpec.describe "bundle console", readline: true do
|
||||
expect(out).to include("(irb)")
|
||||
end
|
||||
|
||||
it "does not try IRB twice if no console is configured and IRB is not available" do
|
||||
create_file("irb.rb", "raise LoadError, 'irb is not available'")
|
||||
|
||||
bundle("console", env: { "RUBYOPT" => "-I#{bundled_app} #{ENV["RUBYOPT"]}" }, raise_on_error: false) do |input, _, _|
|
||||
input.puts("puts ACTIVESUPPORT")
|
||||
input.puts("exit")
|
||||
end
|
||||
expect(err).not_to include("falling back to irb")
|
||||
expect(err).to include("irb is not available")
|
||||
end
|
||||
|
||||
it "doesn't load any other groups" do
|
||||
bundle "console" do |input, _, _|
|
||||
input.puts("puts ACTIVESUPPORT")
|
||||
|
Loading…
x
Reference in New Issue
Block a user