Commit 70eaf299 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Outdated] Refine pod outdated to show what pod update would do

parent a80e75dd
......@@ -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} " \
"(last 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,22 @@ module Pod
end
end
def unlocked_pods
@unlocked_pods ||= begin
sources = if config.podfile.sources.empty?
SourcesManager.master
else
SourcesManager.sources(config.podfile.sources)
end
Resolver.new(
config.sandbox,
config.podfile,
[],
sources
).resolve.values.flatten
end
end
def deprecated_pods
@deprecated_pods ||= begin
spec_sets.map(&:specification).select do |spec|
......
......@@ -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