summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/console.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/cli/console.rb')
-rw-r--r--lib/bundler/cli/console.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb
index 2ba5e69bde..2d1a2ce458 100644
--- a/lib/bundler/cli/console.rb
+++ b/lib/bundler/cli/console.rb
@@ -20,9 +20,19 @@ 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"
+ if defined?(Gem::BUNDLED_GEMS) && Gem::BUNDLED_GEMS.respond_to?(:force_activate)
+ Gem::BUNDLED_GEMS.force_activate "irb"
+ require name
+ return get_constant(name)
+ end
+ 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)
@@ -32,9 +42,6 @@ module Bundler
"irb" => :IRB,
}[name]
Object.const_get(const_name)
- rescue NameError
- Bundler.ui.error "Could not find constant #{const_name}"
- exit 1
end
end
end