Created
September 9, 2010 14:16
-
-
Save alkesh/571915 to your computer and use it in GitHub Desktop.
rails3 default.rake
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
require 'rake/clean' | |
Rake::TaskManager.class_eval do | |
def remove_task(task_name) | |
@tasks.delete(task_name.to_s) | |
end | |
end | |
Rake.application.remove_task('default') | |
CLEAN.include %w(log/** tmp/** coverage) | |
task :default => [:clean, :'db:migrate', :'spec:rcov', :verify_rcov, :cucumber] | |
task :verify_rcov do | |
total_coverage = 0 | |
if File.exists?('coverage') | |
File.open('coverage/index.html').each_line do |line| | |
if line =~ /<tt class='coverage_total'>\s*(\d+\.\d+)%\s*<\/tt>/ | |
total_coverage = $1.to_f | |
break | |
end | |
end | |
puts "Coverage: #{total_coverage}%" | |
raise "Coverage must be at least 100% but was #{total_coverage}%" if total_coverage < 100 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment