2010-06-23 14:29:51 -04:00
|
|
|
require 'rubygems'
|
2007-03-14 14:20:37 -04:00
|
|
|
require 'rake'
|
|
|
|
require 'rake/testtask'
|
|
|
|
require 'rake/rdoctask'
|
2008-09-14 11:12:39 -04:00
|
|
|
require 'rake/gempackagetask'
|
2010-09-12 04:03:34 -04:00
|
|
|
begin
|
|
|
|
require 'cucumber/rake/task'
|
|
|
|
rescue LoadError
|
|
|
|
warn "couldn't load cucumber, skipping"
|
|
|
|
end
|
2009-01-09 00:43:32 -05:00
|
|
|
|
|
|
|
$LOAD_PATH.unshift("lib")
|
2010-06-23 14:29:51 -04:00
|
|
|
require 'shoulda/version'
|
2008-09-15 09:49:31 -04:00
|
|
|
load 'tasks/shoulda.rake'
|
2007-03-14 14:20:37 -04:00
|
|
|
|
2007-07-21 23:54:36 -04:00
|
|
|
# Test::Unit::UI::VERBOSE
|
2009-01-22 18:22:11 -05:00
|
|
|
test_files_pattern = 'test/{unit,functional,other,matchers}/**/*_test.rb'
|
2007-03-14 14:20:37 -04:00
|
|
|
Rake::TestTask.new do |t|
|
2010-06-07 17:18:36 -04:00
|
|
|
t.libs << 'lib' << 'test'
|
2008-07-01 10:06:29 -04:00
|
|
|
t.pattern = test_files_pattern
|
2007-07-21 23:54:36 -04:00
|
|
|
t.verbose = false
|
2007-03-14 14:20:37 -04:00
|
|
|
end
|
|
|
|
|
2007-04-05 15:15:56 -04:00
|
|
|
Rake::RDocTask.new { |rdoc|
|
|
|
|
rdoc.rdoc_dir = 'doc'
|
2007-08-07 10:44:59 -04:00
|
|
|
rdoc.title = "Shoulda -- Making tests easy on the fingers and eyes"
|
2009-02-28 17:54:02 -05:00
|
|
|
rdoc.options << '--line-numbers'
|
2007-04-05 15:15:56 -04:00
|
|
|
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
2008-06-17 13:07:10 -04:00
|
|
|
rdoc.rdoc_files.include('README.rdoc', 'CONTRIBUTION_GUIDELINES.rdoc', 'lib/**/*.rb')
|
2007-04-05 15:15:56 -04:00
|
|
|
}
|
|
|
|
|
2008-07-01 10:06:29 -04:00
|
|
|
desc "Run code-coverage analysis using rcov"
|
|
|
|
task :coverage do
|
|
|
|
rm_rf "coverage"
|
|
|
|
files = Dir[test_files_pattern]
|
|
|
|
system "rcov --rails --sort coverage -Ilib #{files.join(' ')}"
|
|
|
|
end
|
|
|
|
|
2010-06-11 14:54:06 -04:00
|
|
|
eval("$specification = begin; #{IO.read('shoulda.gemspec')}; end")
|
|
|
|
Rake::GemPackageTask.new $specification do |pkg|
|
2008-09-14 11:12:39 -04:00
|
|
|
pkg.need_tar = true
|
|
|
|
pkg.need_zip = true
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Clean files generated by rake tasks"
|
|
|
|
task :clobber => [:clobber_rdoc, :clobber_package]
|
2010-06-23 14:29:51 -04:00
|
|
|
|
2010-12-13 15:56:37 -05:00
|
|
|
Cucumber::Rake::Task.new do |t|
|
|
|
|
t.fork = true
|
|
|
|
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
|
|
|
|
t.profile = 'default'
|
2010-06-23 14:29:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
desc 'Default: run test and cucumber features for support versions'
|
2010-12-13 15:56:37 -05:00
|
|
|
task :default => [:test, :cucumber]
|
2010-06-23 14:29:51 -04:00
|
|
|
|