Commit 16b4d95e authored by Fabio Pelosin's avatar Fabio Pelosin

[presenter] present output to per set so it doesn't wait for all the sets to be…

[presenter] present output to per set so it doesn't wait for all the sets to be ready on lenghty operations
parent 50749fbe
......@@ -30,9 +30,8 @@ module Pod
def list_all
sets = Source.all_sets
puts @presenter.render(sets)
puts "#{sets.count} pods were found"
puts
sets.each {|s| puts @presenter.describe(s)}
puts "\n#{sets.count} pods were found"
end
def list_new
......@@ -52,12 +51,11 @@ module Pod
end
end
end
puts
days.reverse.each do |d|
sets = groups[d]
next unless sets
puts "Pods added in the last #{d == 1 ? 'day' : "#{d} days"}".yellow
puts @presenter.render(sets.sort_by {|set| creation_dates[set.name]})
puts "\nPods added in the last #{d == 1 ? 'day' : "#{d} days"}".yellow
sets.sort_by {|s| creation_dates[s.name]}.each {|s| puts @presenter.describe(s)}
end
end
......@@ -65,6 +63,7 @@ module Pod
puts "\nUpdating Spec Repositories\n".yellow if @update && config.verbose?
Repo.new(ARGV.new(["update"])).run if @update
@new ? list_new : list_all
puts
end
end
end
......
......@@ -13,13 +13,13 @@ module Pod
def render(array)
result = "\n"
array.each {|set| result << render_set(set)}
seats.each {|s| puts describe(s)}
result
end
def render_set(set)
def describe(set)
pod = CocoaPod.new(set)
result = "--> #{pod.name} (#{pod.versions})\n".green
result = "\n--> #{pod.name} (#{pod.versions})\n".green
result << wrap_string(pod.summary)
result << detail('Homepage', pod.homepage)
result << detail('Source', pod.source_url)
......@@ -29,7 +29,7 @@ module Pod
result << detail('License', pod.license) if @stats
result << detail('Watchers', pod.github_watchers) if @stats
result << detail('Forks', pod.github_forks) if @stats
result << "\n"
result
end
private
......
......@@ -25,7 +25,8 @@ module Pod
def run
sets = Source.search_by_name(@query.strip, @full_text_search)
puts @presenter.render(sets)
sets.each {|s| puts @presenter.describe(s)}
puts
end
end
end
......
......@@ -12,7 +12,7 @@ describe Pod::Command::Presenter do
it "presents the name, version, description, homepage and source of a specification set" do
presenter = Presenter.new(argv())
output = presenter.render_set(@set)
output = presenter.describe(@set)
output.should.include? 'CocoaLumberjack'
output.should.include? '1.0'
output.should.include? '1.1'
......@@ -25,13 +25,12 @@ describe Pod::Command::Presenter do
response = '{"repository":{"homepage":"","url":"https://github.com/robbiehanson/CocoaLumberjack","has_downloads":true,"has_issues":true,"language":"Objective-C","master_branch":"master","forks":42,"fork":false,"created_at":"2011/03/30 19:38:39 -0700","has_wiki":true,"description":"A fast & simple, yet powerful & flexible logging framework for Mac and iOS","size":416,"private":false,"name":"CocoaLumberjack","owner":"robbiehanson","open_issues":4,"watchers":318,"pushed_at":"2012/03/26 12:39:36 -0700"}}% '
Pod::Specification::Statistics.instance.expects(:fetch_stats).with("robbiehanson", "CocoaLumberjack").returns(response)
presenter = Presenter.new(argv('--stats'))
output = presenter.render_set(@set)
output = presenter.describe(@set)
output.should.include? 'Author: Robbie Hanson'
output.should.include? 'License: BSD'
output.should.include? 'Platform: iOS - OS X'
output.should.include? 'Watchers: 318'
output.should.include? 'Forks: 42'
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment