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
77a563d9
Commit
77a563d9
authored
May 15, 2015
by
Olivier Halligon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doc + --short option + preparing for `clean`
parent
6620fa90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
20 deletions
+44
-20
cache.rb
lib/cocoapods/command/cache.rb
+44
-20
No files found.
lib/cocoapods/command/cache.rb
View file @
77a563d9
...
...
@@ -11,6 +11,30 @@ module Pod
or cleaning the pods cache.
DESC
def
initialize
(
argv
)
@cache_root
=
Config
.
instance
.
cache_root
+
'Pods'
super
end
private
# @return [Hash<String, Hash<String, Request>>]
# A hash whose keys are the pod spec name
# And values are a hash keyed by the specs file paths
#
def
cache_requests_per_pod
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
class
List
<
Cache
self
.
summary
=
'List the paths of pod caches for each known pod'
...
...
@@ -23,21 +47,28 @@ module Pod
CLAide
::
Argument
.
new
(
'NAME'
,
false
),
]
def
self
.
options
[[
'--short'
,
'Only print the path relative to the cache root'
,
]].
concat
(
super
)
end
def
initialize
(
argv
)
@podname
=
argv
.
shift_argument
@
cache_root
=
Config
.
instance
.
cache_root
+
'Pods'
@
short_output
=
argv
.
flag?
(
'short'
)
super
end
def
run
if
(
@podname
.
nil?
)
cache_hash
.
each
do
|
pod
,
list
|
UI
.
puts
(
"Cache root:
#{
@cache_root
}
"
)
if
@short_output
if
(
@podname
.
nil?
)
# Print all
cache_requests_per_pod
.
each
do
|
pod
,
list
|
UI
.
title
pod
print_pod_cache_list
(
list
)
end
else
cache_list
=
cache_
hash
[
@podname
]
else
# Print only for the requested pod
cache_list
=
cache_
requests_per_pod
[
@podname
]
if
cache_list
.
nil?
UI
.
notice
(
"No cache for pod named
#{
@podname
}
found"
)
else
...
...
@@ -48,28 +79,21 @@ module Pod
private
# Prints the list of specs & pod cache dirs for a single pod name
#
# @param [Hash<String,Request>] list
# The list of spec_file => Downloader::Request
# for a given pod name
#
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
)
UI
.
labeled
(
'Spec'
,
@short_output
?
spec_file
.
relative_path_from
(
@cache_root
)
:
spec_file
)
UI
.
labeled
(
'Pod'
,
@
short_output
?
request
.
slug
:
@
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
...
...
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