def specs(gem_names, source)
index = Index.new
if !gem_names || @remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint
Bundler.ui.info "Fetching source index from #{strip_user_pass_from_uri(@remote_uri)}"
specs = fetch_all_remote_specs
else
Bundler.ui.info "Fetching gem metadata from #{strip_user_pass_from_uri(@remote_uri)}", Bundler.ui.debug?
begin
specs = fetch_remote_specs(gem_names)
rescue HTTPError, TypeError => e
Bundler.ui.info "" unless Bundler.ui.debug?
if @remote_uri.to_s.include?("rubygems.org")
Bundler.ui.info "Error #{e.class} during request to dependency API"
end
Bundler.ui.debug e.message
Bundler.ui.debug e.backtrace
Bundler.ui.info "Fetching full source index from #{strip_user_pass_from_uri(@remote_uri)}"
specs = fetch_all_remote_specs
else
Bundler.ui.info "" unless Bundler.ui.debug?
end
end
specs[@remote_uri].each do |name, version, platform, dependencies|
next if name == 'bundler'
spec = nil
if dependencies
spec = EndpointSpecification.new(name, version, platform, dependencies)
else
spec = RemoteSpecification.new(name, version, platform, self)
end
spec.source = source
@@spec_fetch_map[spec.full_name] = [spec, @remote_uri]
index << spec
end
index
rescue LoadError => e
if e.message.include?("cannot load such file -- openssl")
raise InstallError,
"\nCould not load OpenSSL." \
"\nYou must recompile Ruby with OpenSSL support or change the sources in your" \
"\nGemfile from 'https' to 'http'. Instructions for compiling with OpenSSL" \
"\nusing RVM are available at rvm.io/packages/openssl."
else
raise e
end
end