Permalink
Browse files

Extend cleaner.rb to accept files to ignore.

  • Loading branch information...
1 parent 1ec16c1 commit 30aec22e76c0633158525c77c76adca0998143c0 @radar radar committed Feb 6, 2010
Showing with 16 additions and 2 deletions.
  1. +16 −2 cleaner.rb
View
@@ -1,9 +1,23 @@
files = Dir["**/*"]
ignored_files = [
- "development.log"
+ /log\/.*/,
]
+
+files.delete_if do |file|
+ if File.directory?(file)
+ true
+ else
+ ignored_files.any? do |condition|
+ if condition.is_a?(String)
+ file == condition
+ else
+ condition.match(file)
+ end
+ end || false
+ end
+end
+
for file in files - ignored_files
- p file
if File.file?(file)
lines = File.readlines(file).map { |line| line.gsub(/^\s+$/, "\n") }
File.open(file, "w+") { |f| f.write(lines.join) }

0 comments on commit 30aec22

Please sign in to comment.