Sha256: 903b9eb3b34981e240438e7c4cb935a75410223d7a70733d4371821594e85731
Contents?: true
Size: 1.95 KB
Versions: 7
Compression:
Stored size: 1.95 KB
Contents
require "uri" require "rubygems/spec_fetcher" module Bundler # Represents a lazily loaded gem specification, where the full specification # is on the source server in rubygems' "quick" index. The proxy object is to # be seeded with what we're given from the source's abbreviated index - the # full specification will only be fetched when necessary. class RemoteSpecification include MatchPlatform attr_reader :name, :version, :platform attr_accessor :source, :remote def initialize(name, version, platform, spec_fetcher) @name = name @version = version @platform = platform @spec_fetcher = spec_fetcher end # Needed before installs, since the arch matters then and quick # specs don't bother to include the arch in the platform string def fetch_platform @platform = _remote_specification.platform end def full_name if platform == Gem::Platform::RUBY or platform.nil? then "#{@name}-#{@version}" else "#{@name}-#{@version}-#{platform}" end end # Because Rubyforge cannot be trusted to provide valid specifications # once the remote gem is downloaded, the backend specification will # be swapped out. def __swap__(spec) @specification = spec end private def _remote_specification @specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform]) end def method_missing(method, *args, &blk) if Gem::Specification.new.respond_to?(method) _remote_specification.send(method, *args, &blk) else super end end end class StubSpecification < RemoteSpecification def self.from_stub(stub) spec = new(stub.name, stub.version, stub.platform, nil) spec.stub = stub spec end attr_accessor :stub def to_yaml _remote_specification.to_yaml end private def _remote_specification stub.to_spec end end end
Version data entries
7 entries across 7 versions & 1 rubygems