class Gemirro::Source
The Source
class is used for storing information about an external source such as the name and the Gems to mirror.
@!attribute [r] name
@return [String]
@!attribute [r] host
@return [String]
@!attribute [r] gems
@return [Array]
Attributes
Public Class Methods
Source
# File lib/gemirro/source.rb, line 23 def initialize(name, host, gems = []) @name = name.downcase.gsub(/\s+/, '_') @host = host.chomp('/') @gems = gems end
@param [String] name @param [String] host @param [Array] gems
Public Instance Methods
Source
# File lib/gemirro/source.rb, line 49 def fetch_gem(filename) Utils.logger.info( "Fetching gem #{filename} on #{@host}" ) Http.get(host + "/gems/#{filename}").body end
Fetches the ‘.gem` file of a given Gem
and version.
@param [String] name @param [String] version @return [String]
Source
# File lib/gemirro/source.rb, line 62 def fetch_gemspec(filename) Utils.logger.info( "Fetching gemspec #{filename} on #{@host}" ) marshal = Gemirro::Configuration.marshal_identifier Http.get(host + "/quick/#{marshal}/#{filename}").body end
Fetches the ‘.gemspec.rz` file of a given Gem
and version.
@param [String] filename @return [String]
Source
# File lib/gemirro/source.rb, line 34 def fetch_versions Utils.logger.info( "Fetching versions on #{@name} (#{@host})" ) Http.get("#{host}/versions").body end
Fetches a list of all the available Gems and their versions.
@return [String]
Source
# File lib/gemirro/source.rb, line 76 def gem(name, requirement = nil) gems << Gem.new(name, requirement) end
Adds a new Gem
to the source.
@param [String] name @param [String] requirement