Finds a gemspec
with the given name that lives at path.
# File lib/rubygems/request_set/gem_dependency_api.rb, line 242
def find_gemspec name, path # :nodoc:
glob = File.join path, "#{name}.gemspec"
spec_files = Dir[glob]
case spec_files.length
when 1 then
spec_file = spec_files.first
spec = Gem::Specification.load spec_file
return spec if spec
raise ArgumentError, "invalid gemspec #{spec_file}"
when 0 then
raise ArgumentError, "no gemspecs found at #{Dir.pwd}"
else
raise ArgumentError,
"found multiple gemspecs at #{Dir.pwd}, " +
"use the name: option to specify the one you want"
end
end