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
2e117f9f
Commit
2e117f9f
authored
May 25, 2015
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3561 from CocoaPods/mr-fix-incomplete-cache
[Cache] Recognize incomplete cache for released pods
parents
ffa8b8a6
3c7c2d8b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
2 deletions
+57
-2
CHANGELOG.md
CHANGELOG.md
+5
-0
cache.rb
lib/cocoapods/downloader/cache.rb
+5
-2
cache_spec.rb
spec/unit/downloader/cache_spec.rb
+47
-0
No files found.
CHANGELOG.md
View file @
2e117f9f
...
...
@@ -12,6 +12,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Boris Bügling
](
https://github.com/neonichu
)
[
#3600
](
https://github.com/CocoaPods/CocoaPods/issues/3600
)
*
Recognizes incomplete cache when the original download of a pod was
interrupted.
[
Marius Rackwitz
](
https://github.com/mrackwitz
)
[
#3561
](
https://github.com/CocoaPods/CocoaPods/issues/3561
)
*
Allow opting out of pod source locking, meaning
`pod try`
yields editable
projects.
[
Samuel Giddins
](
https://github.com/segiddins
)
...
...
lib/cocoapods/downloader/cache.rb
View file @
2e117f9f
...
...
@@ -76,9 +76,10 @@ module Pod
# was found in the download cache.
#
def
cached_pod
(
request
)
cached_spec
=
cached_spec
(
request
)
path
=
path_for_pod
(
request
)
spec
=
request
.
spec
||
cached_spec
(
request
)
return
unless
spec
&&
path
.
directory?
return
unless
cached_spec
&&
path
.
directory?
spec
=
request
.
spec
||
cached_spec
Response
.
new
(
path
,
spec
,
request
.
params
)
end
...
...
@@ -91,6 +92,8 @@ module Pod
def
cached_spec
(
request
)
path
=
path_for_spec
(
request
)
path
.
file?
&&
Specification
.
from_file
(
path
)
rescue
JSON
::
ParserError
nil
end
# @param [Request] request
...
...
spec/unit/downloader/cache_spec.rb
View file @
2e117f9f
...
...
@@ -74,6 +74,53 @@ module Pod
end
end
describe
'when the cache is incomplete'
do
shared
'it falls back to download the pod'
do
describe
'when downloading a released pod'
do
it
'does download the source'
do
Downloader
::
Git
.
any_instance
.
expects
(
:download
).
never
@cache
.
expects
(
:uncached_pod
).
once
@cache
.
download_pod
(
@request
)
end
end
describe
'when downloading an unreleased pod'
do
it
'does download the source'
do
Downloader
::
Git
.
any_instance
.
expects
(
:download
).
never
@cache
.
expects
(
:uncached_pod
).
once
@cache
.
download_pod
(
@unreleased_request
)
end
end
end
before
do
[
@request
,
@unreleased_request
].
each
do
|
request
|
path_for_pod
=
@cache
.
send
(
:path_for_pod
,
request
)
path_for_pod
.
mkpath
Dir
.
chdir
(
path_for_pod
)
do
FileUtils
.
mkdir_p
'Classes'
File
.
open
(
'Classes/a.m'
,
'w'
)
{}
end
end
end
describe
'because the spec is missing'
do
behaves_like
'it falls back to download the pod'
end
describe
'because the spec is invalid'
do
before
do
[
@request
,
@unreleased_request
].
each
do
|
request
|
path_for_spec
=
@cache
.
send
(
:path_for_spec
,
request
)
path_for_spec
.
dirname
.
mkpath
path_for_spec
.
open
(
'w'
)
{
|
f
|
f
<<
'{'
}
end
end
behaves_like
'it falls back to download the pod'
end
end
describe
'when the download is cached'
do
before
do
[
@request
,
@unreleased_request
].
each
do
|
request
|
...
...
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