Created
April 21, 2010 09:58
-
-
Save halfbyte/373640 to your computer and use it in GitHub Desktop.
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
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