In Files

  • bundler/source/rubygems/remote.rb

Parent

Class/Module Index [+]

Quicksearch

Bundler::Source::Rubygems::Remote

Attributes

anonymized_uri[R]
original_uri[R]
uri[R]

Public Class Methods

new(uri) click to toggle source
 
               # File bundler/source/rubygems/remote.rb, line 9
def initialize(uri)
  orig_uri = uri
  uri = Bundler.settings.mirror_for(uri)
  @original_uri = orig_uri if orig_uri != uri
  fallback_auth = Bundler.settings.credentials_for(uri)

  @uri = apply_auth(uri, fallback_auth).freeze
  @anonymized_uri = remove_auth(@uri).freeze
end
            

Public Instance Methods

cache_slug() click to toggle source

@return [String] A slug suitable for use as a cache key for this

remote.
 
               # File bundler/source/rubygems/remote.rb, line 22
def cache_slug
  @cache_slug ||= begin
    return nil unless SharedHelpers.md5_available?

    cache_uri = original_uri || uri

    # URI::File of Ruby 2.6 returns empty string when given "file://".
    host = defined?(URI::File) && cache_uri.is_a?(URI::File) ? nil : cache_uri.host

    uri_parts = [host, cache_uri.user, cache_uri.port, cache_uri.path]
    uri_digest = SharedHelpers.digest(:MD5).hexdigest(uri_parts.compact.join("."))

    uri_parts[-1] = uri_digest
    uri_parts.compact.join(".")
  end
end
            
to_s() click to toggle source
 
               # File bundler/source/rubygems/remote.rb, line 39
def to_s
  "rubygems remote at #{anonymized_uri}"
end