Commit d52828ef authored by Samuel E. Giddins's avatar Samuel E. Giddins

Use caching for ExternalSources::DownloaderSource pods

parent b664f190
...@@ -20,7 +20,7 @@ module Pod ...@@ -20,7 +20,7 @@ module Pod
:integrate_targets => true, :integrate_targets => true,
:new_version_message => true, :new_version_message => true,
:cache_root => Pathname(Dir.home) + 'Library/Caches/CocoaPods', :cache_root => Pathname(Dir.home) + 'Library/Caches/CocoaPods',
} }
public public
......
...@@ -41,9 +41,11 @@ module Pod ...@@ -41,9 +41,11 @@ module Pod
result = Result.new result = Result.new
result.checkout_options = downloader_opts if !head && result.location = path_for_pod(name, version, downloader_opts)
result.location = path_for_pod(name, version, downloader_opts) unless head result.checkout_options = downloader_opts
return result if !head && result.location.directory? result.spec = spec || Sandbox::PodspecFinder.new(result.location).podspecs[name]
return result if result.location.directory?
end
in_tmpdir do |target| in_tmpdir do |target|
result.checkout_options = download(name, target, downloader_opts, head) result.checkout_options = download(name, target, downloader_opts, head)
......
...@@ -99,22 +99,17 @@ module Pod ...@@ -99,22 +99,17 @@ module Pod
UI.titled_section(title, :verbose_prefix => '-> ') do UI.titled_section(title, :verbose_prefix => '-> ') do
target = sandbox.pod_dir(name) target = sandbox.pod_dir(name)
target.rmtree if target.exist? target.rmtree if target.exist?
downloader = Downloader.for_target(target, params)
downloader.download
podspec_finder = Sandbox::PodspecFinder.new(target) download_result = Config.instance.download_cache.download_pod(name, false, params)
spec = podspec_finder.podspecs[name] FileUtils.cp_r(download_result.location, target)
spec = download_result.spec
raise Informative, "Unable to find a specification for '#{name}'." unless spec raise Informative, "Unable to find a specification for '#{name}'." unless spec
store_podspec(sandbox, spec) store_podspec(sandbox, spec)
sandbox.store_pre_downloaded_pod(name) sandbox.store_pre_downloaded_pod(name)
if downloader.options_specific? sandbox.store_checkout_source(name, download_result.checkout_options)
source = params
else
source = downloader.checkout_options
end
sandbox.store_checkout_source(name, source)
end end
end end
......
...@@ -45,9 +45,9 @@ module Pod ...@@ -45,9 +45,9 @@ module Pod
end end
it 'checks for JSON podspecs' do it 'checks for JSON podspecs' do
path = config.sandbox.pod_dir('Reachability') path = config.download_cache.send(:path_for_pod, 'Reachability', nil, @subject.params)
podspec_path = path + 'Reachability.podspec.json' podspec_path = path + 'Reachability.podspec.json'
Dir.mkdir(path) path.mkpath
File.open(podspec_path, 'w') { |f| f.write '{"name":"Reachability"}' } File.open(podspec_path, 'w') { |f| f.write '{"name":"Reachability"}' }
Pathname.any_instance.stubs(:rmtree) Pathname.any_instance.stubs(:rmtree)
Downloader::Git.any_instance.stubs(:download) Downloader::Git.any_instance.stubs(:download)
......
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