2016-02-01 12:43:26 +00:00
|
|
|
# frozen_string_literal: true
|
2013-11-19 00:34:13 +00:00
|
|
|
##
|
|
|
|
# Represents an installed gem. This is used for dependency resolution.
|
|
|
|
|
2013-07-09 23:21:36 +00:00
|
|
|
class Gem::Source::Installed < Gem::Source
|
|
|
|
|
2013-11-19 00:34:13 +00:00
|
|
|
def initialize # :nodoc:
|
2013-10-18 21:56:18 +00:00
|
|
|
@uri = nil
|
2013-07-09 23:21:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
##
|
|
|
|
# Installed sources sort before all other sources
|
|
|
|
|
|
|
|
def <=> other
|
|
|
|
case other
|
2014-09-14 03:30:02 +00:00
|
|
|
when Gem::Source::Git,
|
|
|
|
Gem::Source::Lock,
|
2013-11-30 23:27:52 +00:00
|
|
|
Gem::Source::Vendor then
|
2013-11-19 00:34:13 +00:00
|
|
|
-1
|
2013-07-09 23:21:36 +00: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
|
|
|
|
|
|
|
|
def download spec, path
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2014-09-14 03:30:02 +00:00
|
|
|
def pretty_print q # :nodoc:
|
|
|
|
q.text '[Installed]'
|
|
|
|
end
|
|
|
|
|
2013-07-09 23:21:36 +00:00
|
|
|
end
|
|
|
|
|