Class: Pod::Installer::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/pod_builder/cocoapods/analyzer.rb

Instance Method Summary collapse

Instance Method Details

#pods_and_deps_in_target(target_name, podfile_items) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pod_builder/cocoapods/analyzer.rb', line 4

def pods_and_deps_in_target(target_name, podfile_items)
  target_name = "Pods-#{target_name}"

  unless specs = result.specs_by_target.select { |key, value| key.label == target_name }.values.first
    return [], []
  end
  specs.select! { |x| podfile_items.map(&:name).include?(x.name) }
  
  target_pods = []
  specs.each do |spec|
    pod = podfile_items.detect { |x| x.name == spec.name }
    raise "Pod #{spec.name} not found while trying to build Podfile.restore!" if pod.nil?
    target_pods.push(pod)
  end

  target_dependencies = target_pods.map { |x| x.dependencies(podfile_items) }.flatten.uniq
  target_pods -= target_dependencies

  return target_pods.uniq, target_dependencies.uniq
end