Skip to content

Instantly share code, notes, and snippets.

@danmayer
Created May 23, 2009 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danmayer/116858 to your computer and use it in GitHub Desktop.
Save danmayer/116858 to your computer and use it in GitHub Desktop.
def run_spellcheck(file,interactive=false)
if interactive
cmd = "aspell -p ./config/devver_dictionary -H check #{file}"
puts cmd
system(cmd)
[true,""]
else
cmd = "aspell -p ./config/devver_dictionary -H list < #{file}"
puts cmd
results = `#{cmd}`
[results.empty?, results]
end
end
task :spellcheck => 'spellcheck:interactive'
namespace :spellcheck do
files = FileList['app/views/**/*.html.erb']
desc "Spellcheck interactive"
task :interactive do
files.each do |file|
run_spellcheck(file,true)
end
puts "spelling check complete"
end
desc "Spellcheck for ci"
task :ci do
files.each do |file|
success, results = run_spellcheck(file)
unless success
puts results
exit 1
end
end
puts "no spelling errors"
exit 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment