Created
November 21, 2014 21:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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