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

Use caching for ExternalSources::DownloaderSource pods

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