Class: Pod::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-cache-proxy/native/resolver.rb

Instance Method Summary collapse

Instance Method Details

#orig_resolver_specs_by_targetObject



9
# File 'lib/cocoapods-cache-proxy/native/resolver.rb', line 9

alias_method :orig_resolver_specs_by_target, :resolver_specs_by_target

#resolver_specs_by_targetObject



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
# File 'lib/cocoapods-cache-proxy/native/resolver.rb', line 10

def resolver_specs_by_target
    specs_by_target = orig_resolver_specs_by_target

    return specs_by_target unless Pod::Config.instance.cache_proxy_source_available
    root_proxy_source = Pod::Config.instance.cache_proxy_source

    specs_by_target.each do |target, specs|
        specs.each do |spec|
            root_spec = spec.spec.root
            source = root_spec.source
            next unless !source.blank? && source.has_key?(:git) && source.has_key?(:tag)
            next if target.check_ignore_cache_proxy_pod(root_spec.name)

            git = source[:git]
            tag = source[:tag]
            submodules = source.has_key?(:submodules) ? source[:submodules] : false

            proxy_source = target.proxy_source_for_pod(root_spec.name)
            new_url = (proxy_source.nil? ? root_proxy_source : proxy_source).build_proxy_source(root_spec.name, git, tag, submodules)
            source = {
                :http => new_url,
                :type => "tgz",
            }
            root_spec.source = source
        end
    end
    specs_by_target
end