Sha256: 620d719436c0536471929c3adf3eee67ac3b3ba914cf51456c3b7f0aa6c2accb
Contents?: true
Size: 1.25 KB
Versions: 19
Compression:
Stored size: 1.25 KB
Contents
# -*- coding: utf-8 -*- module Gemirro ## # 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] # class Source attr_reader :name, :host, :gems ## # @param [String] name # @param [String] host # @param [Array] gems # def initialize(name, host, gems = []) @name = name.downcase.gsub(/\s+/, '_') @host = host.chomp('/') @gems = gems end ## # Fetches a list of all the available Gems and their versions. # # @return [String] # def fetch_versions Http.get(host + '/' + Configuration.versions_file).body end ## # Fetches the `.gem` file of a given Gem and version. # # @param [String] name # @param [String] version # @return [String] # def fetch_gem(name, version) Http.get(host + "/gems/#{name}-#{version}.gem").body end ## # Adds a new Gem to the source. # # @param [String] name # @param [String] requirement # def gem(name, requirement = nil) gems << Gem.new(name, requirement) end end end
Version data entries
19 entries across 19 versions & 1 rubygems