[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
|
require name
|
||||||
get_constant(name)
|
get_constant(name)
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
|
if name == "irb"
|
||||||
require "irb"
|
Bundler.ui.error "#{name} is not available"
|
||||||
get_constant("irb")
|
exit 1
|
||||||
|
else
|
||||||
|
Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
|
||||||
|
name = "irb"
|
||||||
|
retry
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_constant(name)
|
def get_constant(name)
|
||||||
|
@ -119,6 +119,17 @@ RSpec.describe "bundle console", readline: true do
|
|||||||
expect(out).to include("(irb)")
|
expect(out).to include("(irb)")
|
||||||
end
|
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
|
it "doesn't load any other groups" do
|
||||||
bundle "console" do |input, _, _|
|
bundle "console" do |input, _, _|
|
||||||
input.puts("puts ACTIVESUPPORT")
|
input.puts("puts ACTIVESUPPORT")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user