Commit 23c0b5dc authored by Eloy Durán's avatar Eloy Durán

Make CACHE_ROOT a Pathname, this is less surprising.

parent 5aae0c49
require 'rubygems'
module Pod
require 'pathname'
require 'cocoapods/gem_version'
require 'cocoapods-core'
require 'xcodeproj'
......@@ -16,12 +18,12 @@ module Pod
end
end
# @return [String] The directory where CocoaPods caches the downloads.
# @return [Pathname] The directory where CocoaPods caches the downloads.
#
# @todo The {Installer::PodSourceInstaller} and the #{ExternalSources}
# classes build and configure the downloader from scratch.
#
CACHE_ROOT = "#{ENV['HOME']}/Library/Caches/CocoaPods"
CACHE_ROOT = Pathname.new(File.join(ENV['HOME'], 'Library/Caches/CocoaPods'))
# @return [Fixnum] The maximum size for the cache expressed in Mb.
#
......@@ -30,7 +32,7 @@ module Pod
#
MAX_CACHE_SIZE = 500
Pod::Specification::Set::Statistics.instance.cache_file = Pathname.new(CACHE_ROOT) + 'statistics.yml'
Pod::Specification::Set::Statistics.instance.cache_file = CACHE_ROOT + 'statistics.yml'
autoload :Command, 'cocoapods/command'
autoload :Executable, 'cocoapods/executable'
......@@ -44,8 +46,6 @@ module Pod
autoload :UI, 'cocoapods/user_interface'
autoload :Validator, 'cocoapods/validator'
autoload :Pathname, 'pathname'
module Generator
autoload :Acknowledgements, 'cocoapods/generator/acknowledgements'
autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
......
......@@ -132,7 +132,7 @@ module Pod
target = sandbox.root + name
target.rmtree if target.exist?
downloader = Downloader.for_target(target, params)
downloader.cache_root = CACHE_ROOT
downloader.cache_root = CACHE_ROOT.to_s
downloader.max_cache_size = MAX_CACHE_SIZE
downloader.aggressive_cache = false
downloader.download
......
......@@ -156,7 +156,7 @@ module Pod
def downloader
return @downloader if @downloader
@downloader = Downloader.for_target(root, root_spec.source.dup)
@downloader.cache_root = CACHE_ROOT
@downloader.cache_root = CACHE_ROOT.to_s
@downloader.max_cache_size = MAX_CACHE_SIZE
@downloader.aggressive_cache = aggressive_cache?
@downloader
......
......@@ -107,8 +107,7 @@ module Pod
# @return [Pathname] The path where the search index should be stored.
#
def search_index_path
caches_path = Pathname.new(File.expand_path(CACHE_ROOT))
caches_path + 'search_index.yaml'
CACHE_ROOT + 'search_index.yaml'
end
public
......
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