2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2013-11-18 19:34:13 -05:00
|
|
|
##
|
|
|
|
# Represents an installed gem. This is used for dependency resolution.
|
|
|
|
|
2013-07-09 19:21:36 -04:00
|
|
|
class Gem::Source::Installed < Gem::Source
|
2013-11-18 19:34:13 -05:00
|
|
|
def initialize # :nodoc:
|
2013-10-18 17:56:18 -04:00
|
|
|
@uri = nil
|
2013-07-09 19:21:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
##
|
|
|
|
# Installed sources sort before all other sources
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def <=>(other)
|
2013-07-09 19:21:36 -04:00
|
|
|
case other
|
2014-09-13 23:30:02 -04:00
|
|
|
when Gem::Source::Git,
|
|
|
|
Gem::Source::Lock,
|
2013-11-30 18:27:52 -05:00
|
|
|
Gem::Source::Vendor then
|
2013-11-18 19:34:13 -05:00
|
|
|
-1
|
2013-07-09 19:21:36 -04:00
|
|
|
when Gem::Source::Installed then
|
|
|
|
0
|
|
|
|
when Gem::Source then
|
|
|
|
1
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
##
|
|
|
|
# We don't need to download an installed gem
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def download(spec, path)
|
2013-07-09 19:21:36 -04:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def pretty_print(q) # :nodoc:
|
2014-09-13 23:30:02 -04:00
|
|
|
q.text "[Installed]"
|
|
|
|
end
|
2013-07-09 19:21:36 -04:00
|
|
|
end
|