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
6620fa90
Commit
6620fa90
authored
May 15, 2015
by
Olivier Halligon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding `pod cache list` command. #3508
First draft, Still WIP (TODO = Add specs + add `pod cache clean` command)
parent
e44f1013
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
command.rb
lib/cocoapods/command.rb
+1
-0
cache.rb
lib/cocoapods/command/cache.rb
+77
-0
No files found.
lib/cocoapods/command.rb
View file @
6620fa90
...
...
@@ -24,6 +24,7 @@ module Pod
require
'cocoapods/command/setup'
require
'cocoapods/command/spec'
require
'cocoapods/command/init'
require
'cocoapods/command/cache'
self
.
abstract_command
=
true
self
.
command
=
'pod'
...
...
lib/cocoapods/command/cache.rb
0 → 100644
View file @
6620fa90
require
'cocoapods/downloader'
module
Pod
class
Command
class
Cache
<
Command
self
.
abstract_command
=
true
self
.
summary
=
'Manipulate the CocoaPods cache'
self
.
description
=
<<-
DESC
Manipulate the download cache for pods, like printing the cache content
or cleaning the pods cache.
DESC
class
List
<
Cache
self
.
summary
=
'List the paths of pod caches for each known pod'
self
.
description
=
<<-
DESC
Shows the content of cache organized by pod.
If `NAME` is given, show the results only for that pod name.
DESC
self
.
arguments
=
[
CLAide
::
Argument
.
new
(
'NAME'
,
false
),
]
def
initialize
(
argv
)
@podname
=
argv
.
shift_argument
@cache_root
=
Config
.
instance
.
cache_root
+
'Pods'
super
end
def
run
if
(
@podname
.
nil?
)
cache_hash
.
each
do
|
pod
,
list
|
UI
.
title
pod
print_pod_cache_list
(
list
)
end
else
cache_list
=
cache_hash
[
@podname
]
if
cache_list
.
nil?
UI
.
notice
(
"No cache for pod named
#{
@podname
}
found"
)
else
print_pod_cache_list
(
cache_list
)
end
end
end
private
def
print_pod_cache_list
(
list
)
list
.
each
do
|
spec_file
,
request
|
type
=
request
.
released_pod?
?
'Release'
:
'External'
UI
.
section
(
"
#{
request
.
spec
.
version
}
(
#{
type
}
)"
)
do
UI
.
labeled
(
'Spec'
,
spec_file
)
UI
.
labeled
(
'Pod'
,
@cache_root
+
request
.
slug
)
end
end
end
def
cache_hash
specs_dir
=
@cache_root
+
'Specs'
spec_files
=
specs_dir
.
find
.
select
{
|
f
|
f
.
fnmatch
(
'*.podspec.json'
)
}
spec_files
.
reduce
({})
do
|
hash
,
spec_file
|
spec
=
Specification
.
from_file
(
spec_file
)
hash
[
spec
.
name
]
=
{}
if
hash
[
spec
.
name
].
nil?
release
=
spec_file
.
to_s
.
start_with?
(
specs_dir
+
'Release'
).
to_s
request
=
Downloader
::
Request
.
new
(
:spec
=>
spec
,
:released
=>
release
)
hash
[
spec
.
name
][
spec_file
]
=
request
hash
end
end
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