Method: PodBuilder::Podfile.resolve_pod_names_from_podfile

Defined in:
lib/pod_builder/podfile.rb

.resolve_pod_names_from_podfile(names) ⇒ Object



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/pod_builder/podfile.rb', line 438

def self.resolve_pod_names_from_podfile(names)
  resolved_names = []

  # resolve potentially wrong pod name case
  podfile_path = PodBuilder::basepath("Podfile")
  content = File.read(podfile_path)

  current_section = ""
  content.each_line do |line|
    matches = line.gsub("\"", "'").match(/pod '(.*?)'/)
    if matches&.size == 2
      if resolved_name = names.detect { |t| matches[1].split("/").first.downcase == t.downcase }
        resolved_names.push(matches[1].split("/").first)
      end
    end
  end

  resolved_names.uniq
end