Commit 66e926b4 authored by Fabio Pelosin's avatar Fabio Pelosin

[ExternalSources] Cache downloads.

Closes #820
parent 218f2896
......@@ -16,6 +16,20 @@ module Pod
end
end
# @return [String] The directory where CocoaPods caches the downloads.
#
# @todo The {Installer::PodSourceInstaller} and the #{ExternalSources}
# classes build and configure the downloader from scratch.
#
CACHE_ROOT = "~/Library/Caches/CocoaPods"
# @return [Fixnum] The maximum size for the cache expressed in Mb.
#
# @todo The {Installer::PodSourceInstaller} and the #{ExternalSources}
# classes build and configure the downloader from scratch.
#
MAX_CACHE_SIZE = 500
require 'cocoapods-core'
require 'xcodeproj'
require 'cocoapods/downloader'
......
......@@ -122,6 +122,9 @@ module Pod
# marked as pre-downloaded indicating to the installer that only
# clean operations are needed.
#
# @todo The downloader configuration is the same of the
# #{PodSourceInstaller} and it needs to be kept in sync.
#
# @return [void]
#
def pre_download(sandbox)
......@@ -129,6 +132,9 @@ module Pod
target = sandbox.root + name
target.rmtree if target.exist?
downloader = Downloader.for_target(target, params)
downloader.cache_root = CACHE_ROOT
downloader.max_cache_size = MAX_CACHE_SIZE
downloader.aggressive_cache = false
downloader.download
store_podspec(sandbox, target + "#{name}.podspec")
sandbox.store_pre_downloaded_pod(name)
......
......@@ -152,14 +152,6 @@ module Pod
# @!group Dependencies
# @return [String] The directory where CocoaPods caches the downloads.
#
CACHE_ROOT = "~/Library/Caches/CocoaPods"
# @return [Fixnum] The maximum size for the cache expressed in Mb.
#
MAX_CACHE_SIZE = 500
# @return [Downloader] The downloader to use for the retrieving the
# source.
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment