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