Class: Pod::Command::Outdated

Inherits:
Pod::Command
  • Object
show all
Defined in:
lib/cocoapods/command/outdated.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command

parse, report_error, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Outdated

Returns a new instance of Outdated.



15
16
17
18
# File 'lib/cocoapods/command/outdated.rb', line 15

def initialize(argv)
  config.skip_repo_update = argv.flag?('repo-update', config.skip_repo_update)
  super
end

Class Method Details

.optionsObject



11
12
13
# File 'lib/cocoapods/command/outdated.rb', line 11

def self.options
  [["--no-repo-update", "Skip running `pod repo update` before install"]].concat(super)
end

Instance Method Details

#runObject

TODO:

the command report new dependencies added to the Podfile as updates.

TODO:

fix.



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
50
51
# File 'lib/cocoapods/command/outdated.rb', line 25

def run
  verify_podfile_exists!
  verify_lockfile_exists!

  lockfile = config.lockfile
  pods = lockfile.pod_names
  updates = []
  pods.each do |pod_name|
    set = SourcesManager.search(Dependency.new(pod_name))
    next unless set
    source_version = set.versions.first
    lockfile_version = lockfile.version(pod_name)
    if source_version > lockfile_version
      updates << [pod_name, lockfile_version, source_version]
    end
  end

  if updates.empty?
    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}"
      end
    end
  end
end