Sha256: 082c175640f7224fff486df43167120f33f6562128545f7a96c2ded4ab66d7fb

Contents?: true

Size: 717 Bytes

Versions: 7

Compression:

Stored size: 717 Bytes

Contents

require 'addressable/uri'

module Stickler::Repository
  #
  # When talking to rubygems itself, the rubygems_api key is required.
  # This authenticator is injected automatically if the host you are
  # talking to matches the rubygems host
  #
  class RubygemsAuthenticator
    def self.rubygems_uri
      @rubygems_uri ||= Addressable::URI.parse( "https://rubygems.org" )
    end

    def self.handles?( uri )
      return ( uri.scheme == rubygems_uri.scheme ) &&
             ( uri.host   == rubygems_uri.host )
    end

    def initialize( uri )
      # do nothing
    end

    def credentials
      Gem.configuration.rubygems_api_key
    end

    def rubygems_uri
      self.class.rubygems_uri
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stickler-2.4.2 lib/stickler/repository/rubygems_authenticator.rb
stickler-2.4.1 lib/stickler/repository/rubygems_authenticator.rb
stickler-2.4.0 lib/stickler/repository/rubygems_authenticator.rb
stickler-2.3.0 lib/stickler/repository/rubygems_authenticator.rb
stickler-2.2.4 lib/stickler/repository/rubygems_authenticator.rb
stickler-2.2.3 lib/stickler/repository/rubygems_authenticator.rb
stickler-2.2.2 lib/stickler/repository/rubygems_authenticator.rb