class Bundler::Source::Rubygems
def fetch_specs
def fetch_specs index = Index.new Bundler.ui.info "Fetching source index from #{uri}" (main_specs + prerelease_specs).each do |name, version, platform| next unless Gem::Platform.match(platform) spec = RemoteSpecification.new(name, version, platform, @uri) spec.source = self index << spec end index.freeze end
def initialize(options = {})
def initialize(options = {}) @options = options @uri = options["uri"] @uri = URI.parse(@uri) unless @uri.is_a?(URI) raise ArgumentError, "The source must be an absolute URI" unless @uri.absolute? end
def install(spec)
def install(spec) destination = Gem.dir Bundler.ui.debug " * Downloading" gem_path = Gem::RemoteFetcher.fetcher.download(spec, uri, destination) Bundler.ui.debug " * Installing" installer = Gem::Installer.new gem_path, :install_dir => Gem.dir, :ignore_dependencies => true, :wrappers => true, :env_shebang => true, :bin_dir => "#{Gem.dir}/bin" installer.install end
def main_specs
def main_specs Marshal.load(Gem::RemoteFetcher.fetcher.fetch_path("#{uri}/specs.4.8.gz")) rescue Gem::RemoteFetcher::FetchError => e raise ArgumentError, "#{to_s} is not a valid source: #{e.message}" end
def prerelease_specs
def prerelease_specs Marshal.load(Gem::RemoteFetcher.fetcher.fetch_path("#{uri}/prerelease_specs.4.8.gz")) rescue Gem::RemoteFetcher::FetchError Bundler.ui.warn "Source '#{uri}' does not support prerelease gems" [] end
def specs
def specs @specs ||= fetch_specs end
def to_s
def to_s "rubygems repository at #{uri}" end