Sha256: 5221873691c00ee3140a4e5d89bf8bd5688152efc1fbba63870529ae51daf90c

Contents?: true

Size: 1.6 KB

Versions: 53

Compression:

Stored size: 1.6 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, 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
end

Version data entries

53 entries across 53 versions & 3 rubygems

Version Path
bundler-1.3.6 lib/bundler/remote_specification.rb
bundler-1.4.0.rc.1 lib/bundler/remote_specification.rb
bundler-1.4.0.pre.2 lib/bundler/remote_specification.rb
bundler-1.4.0.pre.1 lib/bundler/remote_specification.rb
bundler-1.3.5 lib/bundler/remote_specification.rb
bundler-1.3.4 lib/bundler/remote_specification.rb
bundler-1.3.3 lib/bundler/remote_specification.rb
bundler-1.3.2 lib/bundler/remote_specification.rb
bundler-1.3.1 lib/bundler/remote_specification.rb
bundler-1.3.0 lib/bundler/remote_specification.rb
bundler-1.2.5 lib/bundler/remote_specification.rb
bundler-1.3.0.pre.8 lib/bundler/remote_specification.rb
bundler-1.2.4 lib/bundler/remote_specification.rb
bundler-1.3.0.pre.7 lib/bundler/remote_specification.rb
bundler-1.3.0.pre.6 lib/bundler/remote_specification.rb
bundler-1.3.0.pre.5 lib/bundler/remote_specification.rb
bundler-1.3.0.pre.4 lib/bundler/remote_specification.rb
bundler-1.3.0.pre.3 lib/bundler/remote_specification.rb
bundler-1.3.0.pre.2 lib/bundler/remote_specification.rb
bundler-1.3.0.pre lib/bundler/remote_specification.rb