Class: Pod::Command::List

Inherits:
Pod::Command show all
Extended by:
Executable
Defined in:
lib/cocoapods/command/list.rb

Direct Known Subclasses

New

Defined Under Namespace

Classes: New

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Executable

executable, execute_command

Methods inherited from Pod::Command

parse, report_error, run

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ List

Returns a new instance of List.



17
18
19
20
21
# File 'lib/cocoapods/command/list.rb', line 17

def initialize(argv)
  @update = argv.flag?('update')
  @stats  = argv.flag?('stats')
  super
end

Class Method Details

.optionsObject



7
8
9
10
11
12
# File 'lib/cocoapods/command/list.rb', line 7

def self.options
  [[
    "--update", "Run `pod repo update` before listing",
    "--stats",  "Show additional stats (like GitHub watchers and forks)"
  ]].concat(super)
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
# File 'lib/cocoapods/command/list.rb', line 23

def run
  update_if_necessary!

  sets = SourcesManager.all_sets
  sets.each { |set| UI.pod(set, :name) }
  UI.puts "\n#{sets.count} pods were found"
end

#update_if_necessary!Object



31
32
33
34
35
36
37
# File 'lib/cocoapods/command/list.rb', line 31

def update_if_necessary!
  if @update && config.verbose?
    UI.section("\nUpdating Spec Repositories\n".yellow) do
      Repo.new(ARGV.new(["update"])).run
    end
  end
end