class Pod::Installer::Analyzer::PodfileDependencyCache

Caches podfile & target definition dependencies, so they do not need to be re-computed from the internal hash on each access

Attributes

podfile_dependencies[R]

@return [Array<Pod::Dependency>]

All the dependencies in the podfile

Public Class Methods

from_podfile(podfile) click to toggle source

Creates a {PodfileDependencyCache} from the given {Podfile}

@param [Podfile] podfile

The {Podfile} from which dependencies should be cached

@return [PodfileDependencyCache]

A warmed, immutable cache of all the dependencies in the {Podfile}
# File lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb, line 39
def self.from_podfile(podfile)
  podfile_dependencies = []
  dependencies_by_target_definition = {}
  podfile.target_definition_list.each do |target_definition|
    deps = target_definition.dependencies.freeze
    podfile_dependencies.concat deps
    dependencies_by_target_definition[target_definition] = deps
  end
  podfile_dependencies.uniq!

  new(podfile_dependencies.freeze, dependencies_by_target_definition.freeze)
end
new(podfile_dependencies, dependencies_by_target_definition) click to toggle source
# File lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb, line 13
def initialize(podfile_dependencies, dependencies_by_target_definition)
  @podfile_dependencies = podfile_dependencies
  @dependencies_by_target_definition = dependencies_by_target_definition
end

Public Instance Methods

target_definition_dependencies(target_definition) click to toggle source

Returns the dependencies for the given target definition

# File lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb, line 20
def target_definition_dependencies(target_definition)
  @dependencies_by_target_definition[target_definition] ||
    raise(ArgumentError, "dependencies for #{target_definition.inspect} do not exist in the cache")
end
target_definition_list() click to toggle source

Returns a list of all of the target definitions in the Podfile

# File lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb, line 27
def target_definition_list
  @dependencies_by_target_definition.keys
end