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
f799b5ce
Commit
f799b5ce
authored
Aug 14, 2014
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Installer] Speed up downloads (cocoapods-downloader)
parent
1a943d72
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
3 additions
and
88 deletions
+3
-88
config.rb
lib/cocoapods/config.rb
+0
-32
abstract_external_source.rb
lib/cocoapods/external_sources/abstract_external_source.rb
+1
-1
installer.rb
lib/cocoapods/installer.rb
+0
-1
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+1
-18
config_spec.rb
spec/unit/config_spec.rb
+0
-25
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+1
-11
No files found.
lib/cocoapods/config.rb
View file @
f799b5ce
...
...
@@ -23,8 +23,6 @@ module Pod
:new_version_message
=>
true
,
:cache_root
=>
Pathname
.
new
(
File
.
join
(
ENV
[
'HOME'
],
'Library/Caches/CocoaPods'
)),
:max_cache_size
=>
500
,
:aggressive_cache
=>
false
,
}
public
...
...
@@ -77,10 +75,6 @@ module Pod
# @!group Cache
# @return [Fixnum] The maximum size for the cache expressed in Mb.
#
attr_accessor
:max_cache_size
# @return [Pathname] The directory where CocoaPods should cache remote data
# and other expensive to compute information.
#
...
...
@@ -91,21 +85,6 @@ module Pod
@cache_root
end
# Allows to set whether the downloader should use more aggressive caching
# options.
#
# @note The aggressive cache has lead to issues if a tag is updated to
# point to another commit.
#
attr_writer
:aggressive_cache
# @return [Bool] Whether the downloader should use more aggressive caching
# options.
#
def
aggressive_cache?
@aggressive_cache
||
(
ENV
[
'CP_AGGRESSIVE_CACHE'
]
==
'TRUE'
)
end
public
#-------------------------------------------------------------------------#
...
...
@@ -267,17 +246,6 @@ module Pod
# @!group Dependency Injection
# @return [Downloader] The downloader to use for the retrieving remote
# source.
#
def
downloader
(
target_path
,
options
)
downloader
=
Downloader
.
for_target
(
target_path
,
options
)
downloader
.
cache_root
=
cache_root
downloader
.
max_cache_size
=
max_cache_size
downloader
.
aggressive_cache
=
aggressive_cache?
downloader
end
# @return [Specification::Set::Statistics] The statistic provider to use
# for specifications.
#
...
...
lib/cocoapods/external_sources/abstract_external_source.rb
View file @
f799b5ce
...
...
@@ -101,7 +101,7 @@ module Pod
UI
.
titled_section
(
title
,
{
:verbose_prefix
=>
"-> "
})
do
target
=
sandbox
.
root
+
name
target
.
rmtree
if
target
.
exist?
downloader
=
Config
.
instance
.
downloader
(
target
,
params
)
downloader
=
Downloader
.
for_target
(
target
,
params
)
downloader
.
download
store_podspec
(
sandbox
,
target
+
"
#{
name
}
.podspec"
)
sandbox
.
store_pre_downloaded_pod
(
name
)
...
...
lib/cocoapods/installer.rb
View file @
f799b5ce
...
...
@@ -288,7 +288,6 @@ module Pod
@pod_installers
||=
[]
pod_installer
=
PodSourceInstaller
.
new
(
sandbox
,
specs_by_platform
)
pod_installer
.
aggressive_cache
=
config
.
aggressive_cache?
pod_installer
.
install!
@pod_installers
<<
pod_installer
@installed_specs
.
concat
(
specs_by_platform
.
values
.
flatten
.
uniq
)
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
f799b5ce
...
...
@@ -25,8 +25,6 @@ module Pod
def
initialize
(
sandbox
,
specs_by_platform
)
@sandbox
=
sandbox
@specs_by_platform
=
specs_by_platform
@aggressive_cache
=
false
end
# @return [String] A string suitable for debugging.
...
...
@@ -39,21 +37,6 @@ module Pod
public
# @!group Configuration
# @return [Bool] whether the downloader should always check against the
# remote if issues might be generated (mostly useful to speed up
# testing).
#
# @note This might be removed in future.
#
attr_accessor
:aggressive_cache
alias_method
:aggressive_cache?
,
:aggressive_cache
#-----------------------------------------------------------------------#
public
# @!group Installation
# Creates the target in the Pods project and the relative support files.
...
...
@@ -167,7 +150,7 @@ module Pod
# source.
#
def
downloader
@downloader
||=
Config
.
instance
.
downloader
(
root
,
root_spec
.
source
.
dup
)
@downloader
||=
Downloader
.
for_target
(
root
,
root_spec
.
source
.
dup
)
end
#-----------------------------------------------------------------------#
...
...
spec/unit/config_spec.rb
View file @
f799b5ce
...
...
@@ -32,13 +32,6 @@ module Pod
@sut
.
default_test_podfile_path
.
should
==
Pathname
.
new
(
"~/.cocoapods/templates/Podfile.test"
).
expand_path
end
it
"allows to specify whether the aggressive cache should be used with an environment variable"
do
@sut
.
aggressive_cache
=
false
ENV
[
'CP_AGGRESSIVE_CACHE'
]
=
'TRUE'
@sut
.
aggressive_cache?
.
should
.
be
.
true
ENV
.
delete
(
'CP_AGGRESSIVE_CACHE'
)
end
it
"allows to specify the home dir with an environment variable"
do
ENV
[
'CP_HOME_DIR'
]
=
'~/custom_home_dir'
@sut
.
home_dir
.
should
==
Pathname
.
new
(
"~/custom_home_dir"
).
expand_path
...
...
@@ -154,33 +147,15 @@ module Pod
@sut
.
should
.
clean
end
it
"has a default cache size of 500"
do
@sut
.
max_cache_size
.
should
==
500
end
it
"returns the cache root"
do
@sut
.
cache_root
.
should
==
Pathname
.
new
(
File
.
join
(
ENV
[
'HOME'
],
'Library/Caches/CocoaPods'
))
end
it
"doesn't use aggressive cache"
do
@sut
.
should
.
not
.
aggressive_cache?
end
end
#-------------------------------------------------------------------------#
describe
"Dependency Injection"
do
it
"returns the downloader"
do
downloader
=
@sut
.
downloader
(
Pathname
.
new
(
''
),
{
:git
=>
'example.com'
})
downloader
.
target_path
.
should
==
Pathname
.
new
(
''
)
downloader
.
url
.
should
==
'example.com'
downloader
.
cache_root
.
should
==
@sut
.
cache_root
downloader
.
max_cache_size
.
should
==
500
downloader
.
aggressive_cache
.
should
.
be
.
false
end
it
"returns the specification statistics provider"
do
stats_provider
=
@sut
.
spec_statistics_provider
stats_provider
.
cache_file
.
should
==
@sut
.
cache_root
+
'statistics.yml'
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
f799b5ce
...
...
@@ -12,16 +12,6 @@ module Pod
#-------------------------------------------------------------------------#
describe
"In General"
do
it
"doesn't use an aggressive cache by default"
do
@installer
.
should
.
not
.
aggressive_cache?
end
end
#-------------------------------------------------------------------------#
describe
"Installation"
do
describe
"Download"
do
...
...
@@ -33,7 +23,7 @@ module Pod
pod_folder
.
should
.
exist
end
it
"downloads the head source
if
specified source"
do
it
"downloads the head source
even if a specific source is present
specified source"
do
config
.
sandbox
.
store_head_pod
(
'BananaLib'
)
@spec
.
source
=
{
:git
=>
SpecHelper
.
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
}
@installer
.
install!
...
...
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