Class: Stickler::Repository::RubygemsAuthenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/stickler/repository/rubygems_authenticator.rb

Overview

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 Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ RubygemsAuthenticator

Returns a new instance of RubygemsAuthenticator.



19
20
21
# File 'lib/stickler/repository/rubygems_authenticator.rb', line 19

def initialize( uri )
  # do nothing
end

Class Method Details

.handles?(uri) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/stickler/repository/rubygems_authenticator.rb', line 14

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

.rubygems_uriObject



10
11
12
# File 'lib/stickler/repository/rubygems_authenticator.rb', line 10

def self.rubygems_uri
  @rubygems_uri ||= Addressable::URI.parse( "https://rubygems.org" )
end

Instance Method Details

#credentialsObject



23
24
25
# File 'lib/stickler/repository/rubygems_authenticator.rb', line 23

def credentials
  Gem.configuration.rubygems_api_key
end

#rubygems_uriObject



27
28
29
# File 'lib/stickler/repository/rubygems_authenticator.rb', line 27

def rubygems_uri
  self.class.rubygems_uri
end