38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/cocoapods-cache-proxy/native/downloader.rb', line 38
def download_file(full_filename)
Pod::UI.message "full_filename: #{full_filename}" if Pod::Config.instance.verbose?
proxy_source = Pod::Config.instance.cache_proxy_source
download_uri = URI(url)
proxy_source_uri = URI(proxy_source.baseURL)
Pod::UI.message "url: #{download_uri.path}" if Pod::Config.instance.verbose?
Pod::UI.message "proxy_source baseURL: #{proxy_source.baseURL}" if Pod::Config.instance.verbose?
if download_uri.path.start_with?(proxy_source_uri.path)
curl_options = []
curl_options.concat(["-u", "#{proxy_source.user}:#{proxy_source.password}"]) unless proxy_source.user.blank? && proxy_source.password.blank?
curl_options.concat(["-f", "-L", "-o", full_filename, url, "--create-dirs"])
Pod::UI.message "curl_options: #{curl_options.join(" ")}" if Pod::Config.instance.verbose?
curl! curl_options
else
orig_download_file(full_filename)
end
end
|