summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/common.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/cli/common.rb')
-rw-r--r--lib/bundler/cli/common.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index d654406f65..7ef6deb2cf 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -54,9 +54,12 @@ module Bundler
Bundler.definition.specs.each do |spec|
return spec if spec.name == name
- specs << spec if regexp && spec.name =~ regexp
+ specs << spec if regexp && spec.name.match?(regexp)
end
+ default_spec = default_gem_spec(name)
+ specs << default_spec if default_spec
+
case specs.count
when 0
dep_in_other_group = Bundler.definition.current_dependencies.find {|dep|dep.name == name }
@@ -75,6 +78,11 @@ module Bundler
raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
end
+ def self.default_gem_spec(name)
+ gem_spec = Gem::Specification.find_all_by_name(name).last
+ gem_spec if gem_spec&.default_gem?
+ end
+
def self.ask_for_spec_from(specs)
specs.each_with_index do |spec, index|
Bundler.ui.info "#{index.succ} : #{spec.name}", true