Commit 872dc480 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Add ACL to the cache

parent d52828ef
......@@ -6,28 +6,13 @@ module Pod
class Cache
Result = Struct.new(:location, :spec, :checkout_options)
attr_accessor :root
attr_reader :root
def initialize(root)
@root = root
root.mkpath unless root.exist?
end
def cache_key(pod_name, version = nil, downloader_opts = nil)
raise ArgumentError unless pod_name || (!version && !downloader_opts)
if version
"Release/#{pod_name}/#{version}"
elsif downloader_opts
opts = downloader_opts.to_a.sort_by(&:first).map { |k, v| "#{k}=#{v}" }.join('-').gsub(/#{File::SEPARATOR}+/, '+')
"External/#{pod_name}/#{opts}"
end
end
def path_for_pod(name, version = nil, downloader_opts = nil)
root + cache_key(name, version, downloader_opts)
end
def download_pod(name_or_spec, released = false, downloader_opts = nil, head = false)
spec = nil
if name_or_spec.is_a? Pod::Specification
......@@ -73,6 +58,23 @@ module Pod
raise
end
private
def cache_key(pod_name, version = nil, downloader_opts = nil)
raise ArgumentError unless pod_name || (!version && !downloader_opts)
if version
"Release/#{pod_name}/#{version}"
elsif downloader_opts
opts = downloader_opts.to_a.sort_by(&:first).map { |k, v| "#{k}=#{v}" }.join('-').gsub(/#{File::SEPARATOR}+/, '+')
"External/#{pod_name}/#{opts}"
end
end
def path_for_pod(name, version = nil, downloader_opts = nil)
root + cache_key(name, version, downloader_opts)
end
def download(name, target, params, head)
downloader = Downloader.for_target(target, params)
if head
......
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