Created
March 16, 2017 03:52
-
-
Save tyronet-sportsbet/41225225425eed0d3a3aff5b6a06d6d9 to your computer and use it in GitHub Desktop.
Searches through a provided Objective-C header and removes any imports to other headers that are not present in any folder under the current working folder tree
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
#!/usr/bin/env ruby | |
module_headers = Dir.glob("**/*.h").map {|f| File.basename(f) } | |
bridging_header = File.read(ARGV[0]) | |
output_header = "" | |
bridging_header.lines.each do |l| | |
if match = l.match(/#import\s*"(.*)"/) | |
header = match.captures[0] | |
if module_headers.include?(header) | |
output_header << l | |
end | |
else | |
output_header << l | |
end | |
end | |
File.write(ARGV[0], output_header) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment