class Pod::Command::RepoTal::List
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/cocoapods-repo-tal/command/repo/list.rb, line 15 def initialize(argv) @count_only = argv.flag?('count-only') super end
options()
click to toggle source
Calls superclass method
# File lib/cocoapods-repo-tal/command/repo/list.rb, line 11 def self.options [['--count-only', 'Show the total number of repos']].concat(super) end
Public Instance Methods
run()
click to toggle source
@output Examples:
master - type: git (master) - URL: https://github.com/CocoaPods/Specs.git - path: /Users/lascorbe/.cocoapods/repos/master test - type: local copy - URL: file:///Users/lascorbe/.cocoapods/repos/test - path: /Users/lascorbe/.cocoapods/repos/test
# File lib/cocoapods-repo-tal/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
Private Instance Methods
print_count_of_sources(sources)
click to toggle source
Pretty-prints the number of sources.
@param [Array<Source>] sources
The sources whose count should be printed.
@return [void]
# File lib/cocoapods-repo-tal/command/repo/list.rb, line 84 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)
click to toggle source
Pretty-prints the source at the given path.
@param [Source] source
The source repository to be printed.
@return [void]
# File lib/cocoapods-repo-tal/command/repo/list.rb, line 47 def print_source(source) if 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)
click to toggle source
Pretty-prints the given sources.
@param [Array<Source>] sources
The sources that should be printed.
@return [void]
# File lib/cocoapods-repo-tal/command/repo/list.rb, line 68 def print_sources(sources) sources.each do |source| UI.title source.name do print_source(source) end end UI.puts "\n" end