Sha256: 5735bc90373f8ecd74fe5f7f756c2cafcc382631a47f3c88bad6a7beba0dd4be

Contents?: true

Size: 1.56 KB

Versions: 14

Compression:

Stored size: 1.56 KB

Contents

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
    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

    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 donwloaded, the backend specification will
    # be swapped out.
    def __swap__(spec)
      @specification = spec
    end

    private

    def _remote_uri
      # "#{@source_uri}/quick/Marshal.4.8/#{@name}-#{@version}.gemspec.rz"
      tuple = [@name, @version, @platform]
      tuple = tuple - [nil, 'ruby', '']
      "#{@source_uri}/quick/Marshal.4.8/#{tuple.join("-")}.gemspec.rz"
    end

    def _remote_specification
      @specification ||= begin
        deflated = Gem::RemoteFetcher.fetcher.fetch_path(_remote_uri)
        inflated = Gem.inflate(deflated)
        Marshal.load(inflated)
      end
    end

    def method_missing(method, *args, &blk)
      _remote_specification.send(method, *args, &blk)
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
bowline-bundler-0.0.4 lib/bowline/bundler/remote_specification.rb
bowline-bundler-0.0.3 lib/bowline/bundler/remote_specification.rb
bowline-bundler-0.0.2 lib/bowline/bundler/remote_specification.rb
bowline-bundler-0.0.1 lib/bowline/bundler/remote_specification.rb
bundler08-0.8.5 lib/bundler08/remote_specification.rb
bundler08-0.8.4 lib/bundler08/remote_specification.rb
bundler08-0.8.3 lib/bundler08/remote_specification.rb
bundler08-0.8.2 lib/bundler08/remote_specification.rb
moneypools-bundler-0.8.1 lib/bundler/remote_specification.rb
bundler-0.8.1 lib/bundler/remote_specification.rb
bundler-0.8.0 lib/bundler/remote_specification.rb
bundler-0.7.3.pre2 lib/bundler/remote_specification.rb
bundler-0.7.3.pre lib/bundler/remote_specification.rb
bundler-0.7.2 lib/bundler/remote_specification.rb