forked from CocoaPods/CocoaPods
/
outdated.rb
51 lines (40 loc) · 1.37 KB
/
outdated.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
module Pod
class Command
class Outdated < Command
def self.banner
%{Show outdated pods:
$ pod outdated
Shows the outdated pods in the current Podfile.lock, but only those from
spec repos, not those from local/external sources or `:head' versions.}
end
def self.options
[["--no-update", "Skip running `pod repo update` before install"]].concat(super)
end
def initialize(argv)
config.skip_repo_update = argv.option('--no-update')
super unless argv.empty?
end
def run
verify_podfile_exists!
verify_lockfile_exists!
sandbox = Sandbox.new(config.project_pods_root)
resolver = Resolver.new(config.podfile, config.lockfile, sandbox)
resolver.update_mode = true
resolver.update_external_specs = false
resolver.resolve
#TODO: the command report new dependencies (added to by updated ones)
# as updates.
names = resolver.pods_to_install - resolver.pods_from_external_sources
specs = resolver.specs.select do |spec|
names.include?(spec.name) && !spec.version.head?
end
if specs.empty?
puts "No updates are available.".yellow
else
puts "The following updates are available:".green
puts " - " << specs.join("\n - ") << "\n"
end
end
end
end
end