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
gems[R]
host[R]
name[R]
Public Class Methods
new(name, host, gems = [])
click to toggle source
@param [String] name @param [String] host @param [Array] gems
# File lib/gemirro/source.rb, line 23 def initialize(name, host, gems = []) @name = name.downcase.gsub(/\s+/, '_') @host = host.chomp('/') @gems = gems end
Public Instance Methods
fetch_gem(filename)
click to toggle source
Fetches the ‘.gem` file of a given Gem
and version.
@param [String] name @param [String] version @return [String]
# File lib/gemirro/source.rb, line 62 def fetch_gem(filename) Utils.logger.info( "Fetching gem #{filename} on #{@host}" ) Http.get(host + "/gems/#{filename}").body end
fetch_gemspec(filename)
click to toggle source
Fetches the ‘.gemspec.rz` file of a given Gem
and version.
@param [String] filename @return [String]
# File lib/gemirro/source.rb, line 75 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
fetch_prerelease_versions()
click to toggle source
Fetches a list of all the available Gems and their versions.
@return [String]
# File lib/gemirro/source.rb, line 47 def fetch_prerelease_versions Utils.logger.info( "Fetching #{Configuration.prerelease_versions_file}" \ " on #{@name} (#{@host})" ) Http.get("#{host}/#{Configuration.prerelease_versions_file}").body end
fetch_versions()
click to toggle source
Fetches a list of all the available Gems and their versions.
@return [String]
# File lib/gemirro/source.rb, line 34 def fetch_versions Utils.logger.info( "Fetching #{Configuration.versions_file} on #{@name} (#{@host})" ) Http.get("#{host}/#{Configuration.versions_file}").body end
gem(name, requirement = nil)
click to toggle source
Adds a new Gem
to the source.
@param [String] name @param [String] requirement
# File lib/gemirro/source.rb, line 89 def gem(name, requirement = nil) gems << Gem.new(name, requirement) end