Commit df2c0c65 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #2501 from CocoaPods/feature/outdated

[Outdated] Refine pod outdated to show what pod update would do
parents a80e75dd 09f86af3
......@@ -4,6 +4,13 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
## Master
##### Enhancements
* Make the output of `pod outdated` show what running `pod update` will do.
Takes into account the sources specified in the `Podfile`.
[Samuel Giddins](https://github.com/segiddins)
[#2470](https://github.com/CocoaPods/CocoaPods/issues/2470)
##### Bug Fixes
* Improved sanitizing of configuration names to avoid generating invalid
......
......@@ -27,8 +27,9 @@ module Pod
UI.puts 'No updates are available.'.yellow
else
UI.section 'The following updates are available:' do
updates.each do |(name, from_version, to_version)|
UI.puts "- #{name} #{from_version} -> #{to_version}"
updates.each do |(name, from_version, matching_version, to_version)|
UI.puts "- #{name} #{from_version} -> #{matching_version} " \
"(latest version #{to_version})"
end
end
end
......@@ -64,7 +65,10 @@ module Pod
pod_name = spec.root.name
lockfile_version = lockfile.version(pod_name)
if source_version > lockfile_version
[pod_name, lockfile_version, source_version]
matching_spec = unlocked_pods.find { |s| s.name == pod_name }
matching_version =
matching_spec ? matching_spec.version : "(unused)"
[pod_name, lockfile_version, matching_version, source_version]
else
nil
end
......@@ -72,6 +76,18 @@ module Pod
end
end
def unlocked_pods
@unlocked_pods ||= begin
pods = []
UI.titled_section('Analyzing dependencies') do
pods = Installer::Analyzer.new(config.sandbox, config.podfile).
analyze(false).
specs_by_target.values.flatten.uniq
end
pods
end
end
def deprecated_pods
@deprecated_pods ||= begin
spec_sets.map(&:specification).select do |spec|
......@@ -82,7 +98,7 @@ module Pod
def spec_sets
@spec_sets ||= begin
aggregate = Source::Aggregate.new(analyzer.sources.map(&:name))
aggregate = Source::Aggregate.new(analyzer.sources)
installed_pods.map do |pod_name|
aggregate.search(Dependency.new(pod_name))
end.compact.uniq
......
......@@ -4,6 +4,10 @@ module Pod
describe Command::Outdated do
extend SpecHelper::TemporaryRepos
before do
Command::Outdated.any_instance.stubs(:unlocked_pods).returns([])
end
it 'tells the user that no Podfile was found in the project dir' do
exception = lambda { run_command('outdated', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the project directory."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment