module Bundler::CLI::Common
def self.select_spec(name, regex_match = nil)
def self.select_spec(name, regex_match = nil) specs = [] regexp = Regexp.new(name) if regex_match Bundler.definition.specs.each do |spec| return spec if spec.name == name specs << spec if regexp && spec.name =~ regexp end case specs.count when 0 raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies) when 1 specs.first else ask_for_spec_from(specs) end rescue RegexpError raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies) end