Skip to content

Instantly share code, notes, and snippets.

@halfbyte
Created April 21, 2010 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halfbyte/373640 to your computer and use it in GitHub Desktop.
Save halfbyte/373640 to your computer and use it in GitHub Desktop.
namespace :compass do
desc "Validate the sass files"
task :check do
require 'tmpdir'
FileUtils.rm_rf "public/stylesheets/compiled"
FileUtils.rm_rf "app/stylesheets/.sass-cache"
err_filename = File.join(Dir.tmpdir, 'compass_err.txt')
system "compass >/dev/null 2>#{err_filename}"
if (File.exist?(err_filename))
err = File.read(err_filename)
if err.match(/WARNING|ERROR|Error/)
puts err
raise "Errors/Warnings in SASS files"
else
puts "no error or warning found"
end
end
end
end
# adding compass:check as a prequisite to the test task
Rake::Task['test'].enhance do
Rake::Task['compass:check'].invoke
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment