Advertisement
Guest User

Untitled

a guest
May 24th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. namespace :housekeeping do
  2. desc "Remove all header-comments"
  3. task :remove_header_comments do
  4. ["Classes", "Tests"].each do |directory|
  5. files = Dir["./#{directory}/**/*"].select { |value| File.file?(value) }
  6. files.each do |file|
  7. lines_array = File.open(file).readlines
  8. if lines_array.first.match(/^\/\//) && !lines_array.first.match(/^\/\/ DO NOT EDIT/)
  9. text = lines_array.drop_while { |line| line.match(/^\/\/|^\n/) }
  10. File.open(file, 'w') do |f|
  11. f.puts text
  12. end
  13. end
  14. end
  15. end
  16. end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement