Class: Pod::Command::RepoArt::List
- Inherits:
-
Pod::Command::RepoArt
- Object
- Pod::Command
- Pod::Command::RepoArt
- Pod::Command::RepoArt::List
- Defined in:
- lib/pod/command/repo_art/list.rb
Constant Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#art_sources ⇒ Source
The list of the Artifactory sources.
-
#initialize(argv) ⇒ List
constructor
A new instance of List.
- #print_art_sources(sources) ⇒ Object
- #print_source(source) ⇒ Object
- #print_source_count(sources) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ List
Returns a new instance of List.
22 23 24 25 |
# File 'lib/pod/command/repo_art/list.rb', line 22 def initialize(argv) @count_only = argv.flag?('count-only') super end |
Class Method Details
.options ⇒ Object
16 17 18 19 20 |
# File 'lib/pod/command/repo_art/list.rb', line 16 def self. [ ['--count-only', 'Show the total number of repos'] ].concat(super) end |
Instance Method Details
#art_sources ⇒ Source
Returns The list of the Artifactory sources.
50 51 52 53 54 |
# File 'lib/pod/command/repo_art/list.rb', line 50 def art_sources SourcesManager.all.select do |source| UTIL.art_repo?(source.repo) end end |
#print_art_sources(sources) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/pod/command/repo_art/list.rb', line 33 def print_art_sources(sources) sources.each do |source| UI.title source.name do print_source(source) end end UI.puts "\n" end |
#print_source(source) ⇒ Object
42 43 44 45 46 |
# File 'lib/pod/command/repo_art/list.rb', line 42 def print_source(source) UI.puts '- Type: Artifactory' UI.puts "- URL: #{UTIL.get_art_url(source.repo)}" if UTIL.artpodrc_file_exists(source.repo) UI.puts "- Path: #{source.repo}" end |
#print_source_count(sources) ⇒ Object
56 57 58 59 60 |
# File 'lib/pod/command/repo_art/list.rb', line 56 def print_source_count(sources) number_of_repos = sources.length repo_string = number_of_repos != 1 ? 'repos' : 'repo' UI.puts "#{number_of_repos} #{repo_string}\n".green end |
#run ⇒ Object
27 28 29 30 31 |
# File 'lib/pod/command/repo_art/list.rb', line 27 def run sources = art_sources print_art_sources(sources) unless @count_only print_source_count(sources) end |