Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
f6c041e1
Commit
f6c041e1
authored
Apr 15, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #962 from xslim/master
New command podfile-info - Shows information on installed Pods #855
parents
fe0ea001
1ffed287
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
129 additions
and
0 deletions
+129
-0
CHANGELOG.md
CHANGELOG.md
+4
-0
command.rb
lib/cocoapods/command.rb
+1
-0
podfile_info.rb
lib/cocoapods/command/podfile_info.rb
+92
-0
podfile_info_spec.rb
spec/functional/command/podfile_info_spec.rb
+32
-0
No files found.
CHANGELOG.md
View file @
f6c041e1
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
###### Enhancements
###### Enhancements
*
Added
`pod podfile-info`
command. Shows list of used Pods and their info
in a project or supplied Podfile.
Options:
`--all`
- with dependancies.
`--md`
- in Markdown.
[
#855
](
https://github.com/CocoaPods/CocoaPods/issues/855
)
*
CocoaPods now defines the
`COCOAPODS=1`
macro in the Pod and the Client
*
CocoaPods now defines the
`COCOAPODS=1`
macro in the Pod and the Client
targets. This is useful for libraries which conditionally expose interfaces.
targets. This is useful for libraries which conditionally expose interfaces.
[
#903
](
https://github.com/CocoaPods/CocoaPods/issues/903
)
[
#903
](
https://github.com/CocoaPods/CocoaPods/issues/903
)
...
...
lib/cocoapods/command.rb
View file @
f6c041e1
...
@@ -18,6 +18,7 @@ module Pod
...
@@ -18,6 +18,7 @@ module Pod
require
'cocoapods/command/spec'
require
'cocoapods/command/spec'
require
'cocoapods/command/help'
require
'cocoapods/command/help'
require
'cocoapods/command/inter_process_communication'
require
'cocoapods/command/inter_process_communication'
require
'cocoapods/command/podfile_info'
self
.
abstract_command
=
true
self
.
abstract_command
=
true
self
.
command
=
'pod'
self
.
command
=
'pod'
...
...
lib/cocoapods/command/podfile_info.rb
0 → 100644
View file @
f6c041e1
module
Pod
class
Command
class
PodfileInfo
<
Command
self
.
summary
=
'Shows information on installed Pods.'
self
.
description
=
<<-
DESC
Shows information on installed Pods in current Project.
If optional `PODFILE_PATH` provided, the info will be shown for
that specific Podfile
DESC
self
.
arguments
=
'[PODFILE_PATH]'
def
self
.
options
[
[
"--all"
,
"Show information about all Pods with dependencies that are used in a project"
],
[
"--md"
,
"Output information in Markdown format"
]
].
concat
(
super
)
end
def
initialize
(
argv
)
@info_all
=
argv
.
flag?
(
'all'
)
@info_in_md
=
argv
.
flag?
(
'md'
)
@podfile_path
=
argv
.
shift_argument
super
end
def
run
use_podfile
=
(
@podfile_path
||
!
config
.
lockfile
)
if
!
use_podfile
UI
.
puts
"Using lockfile"
if
config
.
verbose?
verify_lockfile_exists!
lockfile
=
config
.
lockfile
pods
=
lockfile
.
pod_names
if
@info_all
deps
=
lockfile
.
dependencies
.
map
{
|
d
|
d
.
name
}
pods
=
(
deps
+
pods
).
uniq
end
elsif
@podfile_path
podfile
=
Pod
::
Podfile
.
from_file
(
@podfile_path
)
pods
=
pods_from_podfile
(
podfile
)
else
verify_podfile_exists!
podfile
=
config
.
podfile
pods
=
pods_from_podfile
(
podfile
)
end
UI
.
puts
"
\n
Pods used:
\n
"
.
yellow
unless
@info_in_md
pods_info
(
pods
,
@info_in_md
)
end
def
pods_from_podfile
(
podfile
)
pods
=
[]
podfile
.
root_target_definitions
.
each
{
|
e
|
h
=
e
.
to_hash
;
pods
<<
h
[
'dependencies'
]
if
h
[
'dependencies'
]}
pods
.
flatten!
pods
.
collect!
{
|
pod
|
(
pod
.
is_a?
(
Hash
))
?
pod
.
keys
.
first
:
pod
}
end
def
pods_info_hash
(
pods
,
keys
=
[
:name
,
:homepage
,
:summary
])
pods_info
=
[]
pods
.
each
do
|
pod
|
spec
=
(
Pod
::
SourcesManager
.
search_by_name
(
pod
).
first
rescue
nil
)
if
spec
info
=
{}
keys
.
each
{
|
k
|
info
[
k
]
=
spec
.
specification
.
send
(
k
)
}
pods_info
<<
info
else
end
end
pods_info
end
def
pods_info
(
pods
,
in_md
=
false
)
pods
=
pods_info_hash
(
pods
,
[
:name
,
:homepage
,
:summary
])
pods
.
each
do
|
pod
|
if
in_md
UI
.
puts
"* [
#{
pod
[
:name
]
}
](
#{
pod
[
:homepage
]
}
) -
#{
pod
[
:summary
]
}
"
else
UI
.
puts
"-
#{
pod
[
:name
]
}
-
#{
pod
[
:summary
]
}
"
end
end
end
end
end
end
\ No newline at end of file
spec/functional/command/podfile_info_spec.rb
0 → 100644
View file @
f6c041e1
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
describe
Command
::
PodfileInfo
do
extend
SpecHelper
::
TemporaryRepos
before
do
@test_source
=
Source
.
new
(
fixture
(
'spec-repos/test_repo'
))
Source
::
Aggregate
.
any_instance
.
stubs
(
:all
).
returns
([
@test_source
])
SourcesManager
.
updated_search_index
=
nil
end
it
"tells the user pods info from Podfile"
do
file
=
temporary_directory
+
'Podfile'
text
=
<<-
PODFILE
platform :ios
pod 'BananaLib'
pod 'JSONKit'
PODFILE
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
text
)
}
Dir
.
chdir
(
temporary_directory
)
do
output
=
run_command
(
'podfile-info'
)
output
.
should
.
include?
'- BananaLib - Chunky bananas!'
output
.
should
.
include?
'- JSONKit - A Very High Performance Objective-C JSON Library.'
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment