Class: Bundler::Fetcher::Index
- Defined in:
- lib/bundler/fetcher/index.rb
Instance Attribute Summary
Attributes inherited from Base
#display_uri, #downloader, #remote
Instance Method Summary collapse
Methods inherited from Base
#api_fetcher?, #available?, #fetch_uri, #initialize, #remote_uri
Constructor Details
This class inherits a constructor from Bundler::Fetcher::Base
Instance Method Details
#fetch_spec(spec) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bundler/fetcher/index.rb', line 27 def fetch_spec(spec) spec -= [nil, "ruby", ""] spec_file_name = "#{spec.join "-"}.gemspec" uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz") if uri.scheme == "file" path = Bundler.rubygems.correct_for_windows_path(uri.path) Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path)) elsif cached_spec_path = gemspec_cached_path(spec_file_name) Bundler.load_gemspec(cached_spec_path) else Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body) end rescue MarshalError raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \ "Your network or your gem server is probably having issues right now." end |
#specs(_gem_names) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bundler/fetcher/index.rb', line 9 def specs(_gem_names) Bundler.rubygems.fetch_all_remote_specs(remote) rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e case e. when /certificate verify failed/ raise CertificateFailureError.new(display_uri) when /401/ raise BadAuthenticationError, remote_uri if remote_uri.userinfo raise AuthenticationRequiredError, remote_uri when /403/ raise BadAuthenticationError, remote_uri if remote_uri.userinfo raise AuthenticationRequiredError, remote_uri else Bundler.ui.trace e raise HTTPError, "Could not fetch specs from #{display_uri}" end end |