summaryrefslogtreecommitdiff
path: root/lib/bundler/source/rubygems/remote.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-22 23:08:05 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-22 23:08:05 +0000
commit7825e8363d4b2ccad8e2d3f5eeba9e26f6656911 (patch)
tree83cbcf419e0feeb2ab0fd063ed85e0776eb0081b /lib/bundler/source/rubygems/remote.rb
parent73bed0312895322e0fd18310e840356c8e6af812 (diff)
Postponing the Bundler merge.
I faced a big issue about Bundler with ruby core. I have no time to resolve it issue before 2.5 final release. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/bundler/source/rubygems/remote.rb')
-rw-r--r--lib/bundler/source/rubygems/remote.rb66
1 files changed, 0 insertions, 66 deletions
diff --git a/lib/bundler/source/rubygems/remote.rb b/lib/bundler/source/rubygems/remote.rb
deleted file mode 100644
index e73baaa992..0000000000
--- a/lib/bundler/source/rubygems/remote.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-# frozen_string_literal: true
-
-module Bundler
- class Source
- class Rubygems
- class Remote
- attr_reader :uri, :anonymized_uri, :original_uri
-
- 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
-
- # @return [String] A slug suitable for use as a cache key for this
- # remote.
- #
- def cache_slug
- @cache_slug ||= begin
- return nil unless SharedHelpers.md5_available?
-
- cache_uri = original_uri || uri
-
- uri_parts = [cache_uri.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
-
- def to_s
- "rubygems remote at #{anonymized_uri}"
- end
-
- private
-
- def apply_auth(uri, auth)
- if auth && uri.userinfo.nil?
- uri = uri.dup
- uri.userinfo = auth
- end
-
- uri
- rescue URI::InvalidComponentError
- error_message = "Please CGI escape your usernames and passwords before " \
- "setting them for authentication."
- raise HTTPError.new(error_message)
- end
-
- def remove_auth(uri)
- if uri.userinfo
- uri = uri.dup
- uri.user = uri.password = nil
- end
-
- uri
- end
- end
- end
- end
-end