Last active
October 31, 2015 23:28
-
-
Save orta/1c01b978a65a0361c086 to your computer and use it in GitHub Desktop.
Remove all project headers
This file contains hidden or 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
def should_crop(lines) | |
(0..6).each do |n| | |
return false unless lines[n].start_with? "//" | |
end | |
return false unless lines[7] = "" | |
true | |
end | |
all_objc = Dir.glob("Classes/**/**/**/**.{m,h}") | |
all_objc.each do |path| | |
content = File.read path | |
lines = content.lines | |
next unless should_crop(lines) | |
lines = lines[6..-1] | |
new_content = content.lines[8..-1].join | |
File.write path, new_content | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment