Skip to content

Instantly share code, notes, and snippets.

@travisjeffery
Last active December 30, 2015 02:59
Show Gist options
  • Save travisjeffery/7766730 to your computer and use it in GitHub Desktop.
Save travisjeffery/7766730 to your computer and use it in GitHub Desktop.
Remove xcode/objc header comments
#!/usr/bin/env ruby
files = Dir.glob("#{ARGV[0]}/**/*.{m,h}")
regexp = /^\/\/.*$\n/
files.each do |filepath|
lines = []
replace = true
IO.readlines(filepath).each do |line|
if !replace || !replace = line.match(regexp)
lines << line
end
end
lines.shift if lines[0] == "\n"
File.open(filepath, 'w') {|f| f.puts lines }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment