Skip to content

Instantly share code, notes, and snippets.

@jhildensperger
Created November 21, 2014 21:06
Show Gist options
  • Save jhildensperger/ef1708552fdee5cb3a70 to your computer and use it in GitHub Desktop.
Save jhildensperger/ef1708552fdee5cb3a70 to your computer and use it in GitHub Desktop.
Podfile preinstall hook to enerate a header for all headers in Pods targer
pre_install do |installer_representation|
aggregate_target = installer_representation.installer.aggregate_targets.detect { |target| target.name == "Pods" }
pods = installer_representation.pods.select { |pod| aggregate_target.pod_targets.collect(&:pod_name).include?(pod.name) }
pod_names = ['AFNetworking']
File.open('PodHeaders.h', 'w') do |header|
pods.select {|pod| pod_names.include?(pod.name)}.each do |pod|
header.puts "\n#pragma mark - " + pod.name + "\n\n"
pod.source_files.select {|path| path.extname == ".h"}.each do |header_path|
header_file = header_path.basename.to_s
next if header_path =~ /Spec/
header.puts "#import \"#{header_file}\""
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment