Skip to content

Instantly share code, notes, and snippets.

@pietbrauer
Created April 14, 2015 12:02
Show Gist options
  • Save pietbrauer/94a30bf484ba5675a8ab to your computer and use it in GitHub Desktop.
Save pietbrauer/94a30bf484ba5675a8ab to your computer and use it in GitHub Desktop.
Rake task for cleaning header comments from objc files
namespace :housekeeping do
desc "Remove all header-comments"
task :remove_header_comments do
["Classes", "Tests"].each do |directory|
files = Dir["./#{directory}/**/*"].select { |value| File.file?(value) }
files.each do |file|
lines_array = File.open(file).readlines
if lines_array.first.match(/^\/\//) && !lines_array.first.match(/^\/\/ DO NOT EDIT/)
text = lines_array.drop_while { |line| line.match(/^\/\/|^\n/) }
File.open(file, 'w') do |f|
f.puts text
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment