Class: Pod::Command::Repo::List
- Inherits:
-
Pod::Command::Repo
- Object
- CLAide::Command
- Pod::Command
- Pod::Command::Repo
- Pod::Command::Repo::List
- Defined in:
- lib/cocoapods/command/repo/list.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ List
constructor
A new instance of List.
-
#print_count_of_sources(sources) ⇒ void
private
Pretty-prints the number of sources.
-
#print_source(source) ⇒ void
private
Pretty-prints the source at the given path.
-
#print_sources(sources) ⇒ void
private
Pretty-prints the given sources.
- #run ⇒ Object
Methods inherited from Pod::Command::Repo
Methods included from Executable
capture_command, capture_command!, #executable, execute_command, popen3, reader, which, which!
Methods inherited from Pod::Command
#ensure_master_spec_repo_exists!, ensure_not_root_or_allowed!, git_version, #installer_for_config, report_error, run, #verify_lockfile_exists!, verify_minimum_git_version!, #verify_podfile_exists!, verify_xcode_license_approved!
Methods included from Pod::Config::Mixin
Constructor Details
#initialize(argv) ⇒ List
Returns a new instance of List.
15 16 17 18 |
# File 'lib/cocoapods/command/repo/list.rb', line 15 def initialize(argv) @count_only = argv.flag?('count-only') super end |
Class Method Details
.options ⇒ Object
11 12 13 |
# File 'lib/cocoapods/command/repo/list.rb', line 11 def self. [['--count-only', 'Show the total number of repos']].concat(super) end |
Instance Method Details
#print_count_of_sources(sources) ⇒ void (private)
This method returns an undefined value.
Pretty-prints the number of sources.
86 87 88 89 90 |
# File 'lib/cocoapods/command/repo/list.rb', line 86 def print_count_of_sources(sources) number_of_repos = sources.length repo_string = number_of_repos != 1 ? 'repos' : 'repo' UI.puts "#{number_of_repos} #{repo_string}".green end |
#print_source(source) ⇒ void (private)
This method returns an undefined value.
Pretty-prints the source at the given path.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cocoapods/command/repo/list.rb', line 47 def print_source(source) if source.is_a?(Pod::CDNSource) UI.puts '- Type: CDN' elsif source.git? branch_name, = Executable.capture_command('git', %w(name-rev --name-only HEAD), :capture => :out, :chdir => source.repo) branch_name.strip! branch_name = 'unknown' if branch_name.empty? UI.puts "- Type: git (#{branch_name})" else UI.puts "- Type: #{source.type}" end UI.puts "- URL: #{source.url}" UI.puts "- Path: #{source.repo}" end |
#print_sources(sources) ⇒ void (private)
This method returns an undefined value.
Pretty-prints the given sources.
70 71 72 73 74 75 76 77 |
# File 'lib/cocoapods/command/repo/list.rb', line 70 def print_sources(sources) sources.each do |source| UI.title source.name do print_source(source) end end UI.puts "\n" end |
#run ⇒ Object
32 33 34 35 36 |
# File 'lib/cocoapods/command/repo/list.rb', line 32 def run sources = config.sources_manager.all print_sources(sources) unless @count_only print_count_of_sources(sources) end |