class Bundler::RemoteSpecification
full specification will only be fetched when necessary.
be seeded with what we’re given from the source’s abbreviated index - the
is on the source server in rubygems’ “quick” index. The proxy object is to
Represents a lazily loaded gem specification, where the full specification
def <=>(other)
is compatible with Gem::Specification and other Bundler or RubyGems
Compare this specification against another object. Using sort_obj
def <=>(other) if other.respond_to?(:sort_obj) sort_obj <=> other.sort_obj else super end end
def __swap__(spec)
once the remote gem is downloaded, the backend specification will
Because Rubyforge cannot be trusted to provide valid specifications
def __swap__(spec) raise APIResponseInvalidDependenciesError unless spec.dependencies.all? {|d| d.is_a?(Gem::Dependency) } SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies) @_remote_specification = spec end
def _remote_specification
def _remote_specification @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform]) @_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \ " missing from the server! Try installing with `--full-index` as a workaround.") end
def dependencies
def dependencies @dependencies ||= begin deps = method_missing(:dependencies) # allow us to handle when the specs dependencies are an array of array of string # in order to delay the crash to `#__swap__` where it results in a friendlier error # see https://github.com/rubygems/bundler/issues/5797 deps = deps.map {|d| d.is_a?(Gem::Dependency) ? d : Gem::Dependency.new(*d) } deps end end
def fetch_platform
Needed before installs, since the arch matters then and quick
def fetch_platform @platform = _remote_specification.platform end
def full_name
def full_name if platform == Gem::Platform::RUBY || platform.nil? "#{@name}-#{@version}" else "#{@name}-#{@version}-#{platform}" end end
def git_version
def git_version return unless loaded_from && source.is_a?(Bundler::Source::Git) " #{source.revision[0..6]}" end
def initialize(name, version, platform, spec_fetcher)
def initialize(name, version, platform, spec_fetcher) @name = name @version = Gem::Version.create version @platform = platform @spec_fetcher = spec_fetcher @dependencies = nil end
def method_missing(method, *args, &blk)
def method_missing(method, *args, &blk) _remote_specification.send(method, *args, &blk) end
def respond_to?(method, include_all = false)
def respond_to?(method, include_all = false) super || _remote_specification.respond_to?(method, include_all) end
def sort_obj
-
(Array)
- an object you can use to compare and sort this
Other tags:
- See: Gem::Specification#sort_obj -
See: #<=> -
def sort_obj [@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1] end
def to_ary
def to_ary nil end
def to_s
def to_s "#<#{self.class} name=#{name} version=#{version} platform=#{platform}>" end