Created — forked from ashmoran/rake_strip_whitespace.rb

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Simple Rake task to use sed to strip trailing whitespace from Ruby source

View rake_strip_whitespace.rb
1 2 3 4 5 6 7 8 9
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
Something went wrong with that request. Please try again.