Created
April 14, 2015 12:02
-
-
Save pietbrauer/94a30bf484ba5675a8ab to your computer and use it in GitHub Desktop.
Rake task for cleaning header comments from objc files
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
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