Sha256: 247261d8fc9c1b3d45ec51fe31769834c3b101b7dd2e5d901e58afa87298f8ca

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

module Bundler
  class Source
    class Rubygems
      class Remote
        attr_reader :uri,
          :anonymized_uri

        def initialize(uri)
          uri = Bundler.settings.mirror_for(uri)
          fallback_auth = Bundler.settings.credentials_for(uri)

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

      private

        def apply_auth(uri, auth)
          if auth && uri.userinfo.nil?
            uri = uri.dup
            uri.userinfo = auth
          end

          uri
        end

        def remove_auth(uri)
          if uri.userinfo
            uri = uri.dup
            uri.user = uri.password = nil
          end

          uri
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shopify-bundler-1.10.7 lib/bundler/source/rubygems/remote.rb