Class: Bundler::Source::Rubygems::Remote
- Inherits:
-
Object
- Object
- Bundler::Source::Rubygems::Remote
- Defined in:
- lib/bundler/source/rubygems/remote.rb
Instance Attribute Summary collapse
-
#anonymized_uri ⇒ Object
readonly
Returns the value of attribute anonymized_uri.
-
#original_uri ⇒ Object
readonly
Returns the value of attribute original_uri.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#cache_slug ⇒ String
A slug suitable for use as a cache key for this remote.
-
#initialize(uri) ⇒ Remote
constructor
A new instance of Remote.
Constructor Details
#initialize(uri) ⇒ Remote
Returns a new instance of Remote.
8 9 10 11 12 13 14 15 16 |
# File 'lib/bundler/source/rubygems/remote.rb', line 8 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 |
Instance Attribute Details
#anonymized_uri ⇒ Object (readonly)
Returns the value of attribute anonymized_uri.
6 7 8 |
# File 'lib/bundler/source/rubygems/remote.rb', line 6 def anonymized_uri @anonymized_uri end |
#original_uri ⇒ Object (readonly)
Returns the value of attribute original_uri.
6 7 8 |
# File 'lib/bundler/source/rubygems/remote.rb', line 6 def original_uri @original_uri end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
6 7 8 |
# File 'lib/bundler/source/rubygems/remote.rb', line 6 def uri @uri end |
Instance Method Details
#cache_slug ⇒ String
Returns A slug suitable for use as a cache key for this remote.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bundler/source/rubygems/remote.rb', line 21 def cache_slug @cache_slug ||= begin cache_uri = original_uri || uri uri_parts = [cache_uri.host, cache_uri.user, cache_uri.port, cache_uri.path] uri_digest = Digest::MD5.hexdigest(uri_parts.compact.join(".")) uri_parts[-1] = uri_digest uri_parts.compact.join(".") end end |