Skip to content

Commit

Permalink
[outdated] Don’t show pods that can't be checked.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Aug 23, 2012
1 parent 4954dbe commit cb2d996
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 37 deletions.
41 changes: 9 additions & 32 deletions lib/cocoapods/command/outdated.rb
Expand Up @@ -6,7 +6,8 @@ def self.banner
$ pod outdated
Shows the outdated pods in the current Podfile.lock.}
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
Expand All @@ -30,41 +31,17 @@ def run
resolver.update_mode = true
resolver.update_external_specs = false
resolver.resolve
pods_to_install = resolver.pods_to_install
external_pods = resolver.pods_from_external_sources

known_update_specs = []
head_mode_specs = []
resolver.specs.each do |s|
next if external_pods.include?(s.name)
next unless pods_to_install.include?(s.name)

if s.version.head?
head_mode_specs << s.name
else
known_update_specs << s.to_s
end
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 pods_to_install.empty?
puts "\nNo updates are available.\n".yellow
if specs.empty?
puts "No updates are available.".yellow
else

unless known_update_specs.empty?
puts "\nThe following updates are available:".green
puts " - " << known_update_specs.join("\n - ") << "\n"
end

unless head_mode_specs.empty?
puts "\nThe following pods might present updates as they are in head mode:".green
puts " - " << head_mode_specs.join("\n - ") << "\n"
end

unless (external_pods).empty?
puts "\nThe following pods might present updates as they loaded from an external source:".green
puts " - " << external_pods.join("\n - ") << "\n"
end
puts
puts "The following updates are available:".green
puts " - " << specs.join("\n - ") << "\n"
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/cocoapods/resolver.rb
Expand Up @@ -120,13 +120,13 @@ def should_install?(name)
def pods_to_install
unless @pods_to_install
if lockfile
@pods_to_install = specs.select { |spec|
@pods_to_install = specs.select do |spec|
spec.version != lockfile.pods_versions[spec.pod_name]
}.map(&:name)
end.map(&:name)
if update_mode
@pods_to_install += specs.select { |spec|
@pods_to_install += specs.select do |spec|
spec.version.head? || pods_from_external_sources.include?(spec.pod_name)
}.map(&:name)
end.map(&:name)
end
@pods_to_install += @pods_by_state[:added] + @pods_by_state[:changed]
else
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/resolver_spec.rb
Expand Up @@ -326,7 +326,7 @@ def set.specification; spec = super; spec.platform = @stubbed_platform; spec; en
@resolver.should_install?("JSONKit").should.be.true
end

it "respects the constraints of the pofile" do
it "respects the constraints of the podfile" do
podfile = Podfile.new do
platform :ios
pod 'BlocksKit'
Expand Down

0 comments on commit cb2d996

Please sign in to comment.