Skip to content

Instantly share code, notes, and snippets.

@orta
Last active October 31, 2015 23:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save orta/1c01b978a65a0361c086 to your computer and use it in GitHub Desktop.
Save orta/1c01b978a65a0361c086 to your computer and use it in GitHub Desktop.
Remove all project headers
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