Commit 3a575c7a authored by Fabio Pelosin's avatar Fabio Pelosin

[UI] Show the versions of a pod per repo.

Closes #226
parent b455a333
...@@ -141,11 +141,11 @@ module Pod ...@@ -141,11 +141,11 @@ module Pod
puts_indented set.name puts_indented set.name
else else
pod = UIPod.new(set) pod = UIPod.new(set)
title("\n-> #{pod.name} (#{pod.version})".green, '', 3) do title("\n-> #{pod.name} (#{pod.version})".green, '', 1) do
puts_indented pod.summary puts_indented pod.summary
labeled('Homepage', pod.homepage) labeled('Homepage', pod.homepage)
labeled('Source', pod.source_url) labeled('Source', pod.source_url)
labeled('Versions', pod.versions) unless set.versions.count == 1 labeled('Versions', pod.verions_by_source)
if mode == :stats if mode == :stats
labeled('Pushed', pod.github_last_activity) labeled('Pushed', pod.github_last_activity)
labeled('Authors', pod.authors) if pod.authors =~ /,/ labeled('Authors', pod.authors) if pod.authors =~ /,/
......
...@@ -15,11 +15,25 @@ module Pod ...@@ -15,11 +15,25 @@ module Pod
end end
def version def version
@set.versions.last @set.versions.first
end end
def versions def versions
@set.versions.reverse.join(", ") @set.versions.sort.reverse
end
def verions_by_source
result = []
@set.versions_by_source.each do |source, versions|
result << "#{versions.map(&:to_s) * ', '} [#{source.name} repo]"
end
result * ' - '
end
# @return [Array<String>]
#
def sources
@set.sources.map(&:name).sort
end end
# specification information # specification information
......
...@@ -20,6 +20,13 @@ describe Pod::UI do ...@@ -20,6 +20,13 @@ describe Pod::UI do
output.should.include? 'https://github.com/robbiehanson/CocoaLumberjack.git' output.should.include? 'https://github.com/robbiehanson/CocoaLumberjack.git'
end end
it "presents the name, version, description, homepage and source of a specification set" do
Pod::UI.pod(@set)
output = Pod::UI.output.gsub(/\n */,'')
output.should.include? 'Versions: 1.6, 1.3.3, 1.3.2, 1.3.1, 1.3, 1.2.3, 1.2.2, 1.2.1, 1.2, 1.1, 1.0 [master repo]'
end
it "presents the stats of a specification set" do it "presents the stats of a specification set" do
repo = { "forks"=>42, "watchers"=>318, "pushed_at"=>"2011-01-26T19:06:43Z" } repo = { "forks"=>42, "watchers"=>318, "pushed_at"=>"2011-01-26T19:06:43Z" }
Octokit.expects(:repo).with("robbiehanson/CocoaLumberjack").returns(repo) Octokit.expects(:repo).with("robbiehanson/CocoaLumberjack").returns(repo)
......
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