Skip to content

Instantly share code, notes, and snippets.

@alkesh
Created September 9, 2010 14:16
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 alkesh/571915 to your computer and use it in GitHub Desktop.
Save alkesh/571915 to your computer and use it in GitHub Desktop.
rails3 default.rake
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