Sha256: 8992aba6dd2fb12907ca089de8036aed371afe62cc3e193cefabc64e7d61b935

Contents?: true

Size: 1.63 KB

Versions: 41

Compression:

Stored size: 1.63 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 necesary.
  class RemoteSpecification
    include MatchPlatform

    attr_reader :name, :version, :platform
    attr_accessor :source

    def initialize(name, version, platform, source_uri)
      @name     = name
      @version  = version
      @platform = platform
      @source_uri = source_uri
    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 ||= begin
        Gem::SpecFetcher.new.fetch_spec([@name, @version, @platform], URI(@source_uri.to_s))
      end
    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
end

Version data entries

41 entries across 41 versions & 5 rubygems

Version Path
bundler-1.0.22 lib/bundler/remote_specification.rb
mpapis-bundler-1.0.21.1 lib/bundler/remote_specification.rb
mpapis-bundler-1.0.21 lib/bundler/remote_specification.rb
bundler-maglev--1.0.21 lib/bundler/remote_specification.rb
bundler-1.0.21 lib/bundler/remote_specification.rb
bundler-1.0.21.rc lib/bundler/remote_specification.rb
bundler-1.0.20 lib/bundler/remote_specification.rb
bundler-1.0.20.rc lib/bundler/remote_specification.rb
bundler-1.0.19.rc lib/bundler/remote_specification.rb
bundler-1.0.18 lib/bundler/remote_specification.rb
bundler-1.0.17 lib/bundler/remote_specification.rb
bundler-1.0.15 lib/bundler/remote_specification.rb
bundler-1.0.14 lib/bundler/remote_specification.rb
bundler-1.0.13 lib/bundler/remote_specification.rb
bundler-1.0.12 lib/bundler/remote_specification.rb
bundler-1.0.11 lib/bundler/remote_specification.rb
bundler-1.0.10 lib/bundler/remote_specification.rb
bundler-1.0.9 lib/bundler/remote_specification.rb
bundler-1.0.7 lib/bundler/remote_specification.rb
bundler-1.0.5 lib/bundler/remote_specification.rb