Created
March 20, 2011 22:31
-
-
Save ashmoran/878743 to your computer and use it in GitHub Desktop.
Simple Rake task to use sed to strip trailing whitespace from Ruby source
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
desc "Remove trailing whitespace for source files" | |
task :strip_whitespace do | |
files = %w[ .autotest .rspec .rvmrc Gemfile ] | |
globs = %w[ lib/**/*.rb spec/**/*.rb ] | |
files_from_globs = globs.map { |glob| Dir[glob] } | |
files_to_strip = (files + files_from_globs).flatten | |
system "sed -e 's/[ \t]*$//' -i '' #{files_to_strip.join(" ")}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment