Skip to content

Commit

Permalink
Always include version in list without flag.
Browse files Browse the repository at this point in the history
As requested in original PR (#1617).

Also remove some extraneous whitespace that crept in.
  • Loading branch information
z00b committed Mar 29, 2014
1 parent 93caccd commit 59b88a8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[CocoaPods-Core](https://github.com/CocoaPods/Core/compare/0.30.0...master)

##### Enhancements
* Add version to output of `pod list`
[Stefan Damm](https://github.com/StefanDamm)
[Robert Zuber](https://github.com/z00b)
[#1617](https://github.com/CocoaPods/CocoaPods/issues/1617)

##### Bug Fixes
* Fix for when using s.version as the :tag for a git repository in a Podspec
Expand Down
6 changes: 2 additions & 4 deletions lib/cocoapods/command/list.rb
Expand Up @@ -7,8 +7,7 @@ class List < Command
def self.options
[[
"--update", "Run `pod repo update` before listing",
"--stats", "Show additional stats (like GitHub watchers and forks)",
"--pod-versions", "Show latest version of each pod"
"--stats", "Show additional stats (like GitHub watchers and forks)"
]].concat(super)
end

Expand All @@ -18,15 +17,14 @@ def self.options
def initialize(argv)
@update = argv.flag?('update')
@stats = argv.flag?('stats')
@pod_versions = argv.flag?('pod-versions')
super
end

def run
update_if_necessary!

sets = SourcesManager.all_sets
sets.each { |set| UI.pod(set, @pod_versions ? :name_and_version : :name) }
sets.each { |set| UI.pod(set, :name_and_version) }
UI.puts "\n#{sets.count} pods were found"
end

Expand Down
4 changes: 1 addition & 3 deletions lib/cocoapods/user_interface.rb
Expand Up @@ -158,9 +158,7 @@ def path(pathname)
# Prints the textual representation of a given set.
#
def pod(set, mode = :normal, statistics_provider = nil)
if mode == :name
puts_indented set.name
elsif mode == :name_and_version
if mode == :name_and_version
puts_indented "#{set.name} #{set.versions.first.version}"
else
pod = Specification::Set::Presenter.new(set, statistics_provider)
Expand Down
10 changes: 4 additions & 6 deletions spec/functional/command/list_spec.rb
Expand Up @@ -28,18 +28,16 @@ module Pod
out.should.include('BananaLib')
out.should.not.include('JSONKit')
end
it "presents the known pods with versions when using --pod-versions" do

it "presents the known pods with versions" do
sets = SourcesManager.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
out = run_command('list','--pod-versions')

out = run_command('list')
[ /BananaLib 1.0/,
/JSONKit #{jsonkit_set.versions.first}/,
/\d+ pods were found/
].each { |regex| out.should =~ regex }
end

end
end

3 changes: 1 addition & 2 deletions spec/functional/user_interface_spec.rb
Expand Up @@ -41,7 +41,7 @@ module Pod
output = UI.output
output.should.include? "RestKit/Network"
end

it "presents only name and version of a specification set in :name_and_version mode" do
@set = SourcesManager.search_by_name('RestKit').first
UI.pod(@set, :name_and_version)
Expand All @@ -50,4 +50,3 @@ module Pod
end
end
end

0 comments on commit 59b88a8

Please sign in to comment.