Module: Pod::Downloader

Defined in:
lib/cocoapods-ve/ext/downloader_ext.rb

Class Method Summary collapse

Class Method Details

.download(request, target, can_cache: true, cache_path: Config.instance.cache_root + 'Pods') ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cocoapods-ve/ext/downloader_ext.rb', line 5

def download(
  request,
  target,
  can_cache: true,
  cache_path: Config.instance.cache_root + 'Pods'
)
    if ENV['COCOAPODS_LINK_POD_CACHE_VE'] == 'true'
        can_cache &&= !Config.instance.skip_download_cache

        request = preprocess_request(request)

        if can_cache
            raise ArgumentError, 'Must provide a `cache_path` when caching.' unless cache_path
            cache = Cache.new(cache_path)
            result = cache.download_pod(request)
        else
            raise ArgumentError, 'Must provide a `target` when caching is disabled.' unless target

            require 'cocoapods/installer/pod_source_preparer'
            result, = download_request(request, target)
            Installer::PodSourcePreparer.new(result.spec, result.location).prepare!
        end

        if target && result.location && target != result.location
            UI.message "link #{request.name} from `#{result.location}` to #{UI.path target}", '> ' do
                FileUtils.rm_rf target
                FileUtils.ln_sf(result.location, target)
            end
        end
        result
    else
        download_t( request,target)
    end

end

.download_tObject



4
# File 'lib/cocoapods-ve/ext/downloader_ext.rb', line 4

alias download_t download