require 'rubygems' require 'bundler' Bundler.setup require 'rake' require 'rake/clean' require 'rake/testtask' require 'rake/rdoctask' require File.dirname(__FILE__) + '/lib/sprout/version' Rake::RDocTask.new do |rdoc| rdoc.title = "Project Sprouts v.#{Sprout::VERSION::STRING}" rdoc.rdoc_dir = 'rdoc' rdoc.main = "Sprout::Sprout" rdoc.rdoc_files.include("README.textile", "lib/**/*.rb") end CLEAN.add('rdoc') namespace :test do Rake::TestTask.new(:units) do |t| t.libs << "test/unit" t.test_files = FileList["test/unit/*_test.rb"] t.verbose = true end namespace :coverage do desc "Delete aggregate coverage data." task(:clean) { rm_f "coverage.data" } end # Apparently, rcov does not work on Windows. # Hide these tasks so that we can at least # run the others... if(!(RUBY_PLATFORM =~ /mingw/i) && !(RUBY_PLATFORM =~/mswin/i)) require 'rcov/rcovtask' namespace :coverage do desc "Delete aggregate coverage data." task(:clean) { rm_f "coverage.data" } end desc "Aggregate code coverage for unit, functional and integration tests" task :coverage => "test:coverage:clean" # Hold collection in case we need it: #%w[unit functional integration].each do |target| %w[unit].each do |target| namespace :coverage do Rcov::RcovTask.new(target) do |t| t.libs = ["lib", "test"] t.test_files = FileList["test/#{target}/**/*_test.rb"] t.output_dir = ".coverage/#{target}" t.verbose = true t.rcov_opts << "--aggregate coverage.data --exclude .bundle" end end task :coverage => "test:coverage:#{target}" end end namespace :torture do desc "Flog the Sprouts" task :flog do puts "--------------------------" puts "Flog Report:" message =< ['torture:flog', 'torture:flay'] end task :test => 'test:units' desc "Run all tests and reports" task :cruise => [:test, 'test:coverage', 'test:torture']