2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2013-11-10 12:51:40 -05:00
|
|
|
##
|
|
|
|
# An InstalledSpecification represents a gem that is already installed
|
|
|
|
# locally.
|
2013-07-09 19:21:36 -04:00
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
|
2013-07-09 19:21:36 -04:00
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def ==(other) # :nodoc:
|
2013-07-09 19:21:36 -04:00
|
|
|
self.class === other and
|
|
|
|
@set == other.set and
|
|
|
|
@spec == other.spec
|
|
|
|
end
|
|
|
|
|
2013-11-25 14:14:49 -05:00
|
|
|
##
|
|
|
|
# This is a null install as this specification is already installed.
|
|
|
|
# +options+ are ignored.
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def install(options = {})
|
2013-11-25 14:14:49 -05:00
|
|
|
yield nil
|
|
|
|
end
|
|
|
|
|
2013-11-10 12:51:40 -05:00
|
|
|
##
|
|
|
|
# Returns +true+ if this gem is installable for the current platform.
|
2013-07-09 19:21:36 -04:00
|
|
|
|
2013-11-10 12:51:40 -05:00
|
|
|
def installable_platform?
|
|
|
|
# BACKCOMPAT If the file is coming out of a specified file, then we
|
|
|
|
# ignore the platform. This code can be removed in RG 3.0.
|
2013-11-25 14:14:49 -05:00
|
|
|
return true if @source.kind_of? Gem::Source::SpecificFile
|
|
|
|
|
|
|
|
super
|
2013-07-09 19:21:36 -04:00
|
|
|
end
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def pretty_print(q) # :nodoc:
|
2014-09-13 23:30:02 -04:00
|
|
|
q.group 2, '[InstalledSpecification', ']' do
|
|
|
|
q.breakable
|
|
|
|
q.text "name: #{name}"
|
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text "version: #{version}"
|
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text "platform: #{platform}"
|
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text 'dependencies:'
|
|
|
|
q.breakable
|
|
|
|
q.pp spec.dependencies
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-11-10 12:51:40 -05:00
|
|
|
##
|
|
|
|
# The source for this specification
|
2013-09-09 20:52:14 -04:00
|
|
|
|
2013-07-09 19:21:36 -04:00
|
|
|
def source
|
|
|
|
@source ||= Gem::Source::Installed.new
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|