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'
|
2009-01-09 00:43:32 -05:00
|
|
|
|
|
|
|
$LOAD_PATH.unshift("lib")
|
|
|
|
require 'shoulda'
|
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
|
|
|
|
|
2007-07-24 16:45:07 -04:00
|
|
|
desc 'Update documentation on website'
|
|
|
|
task :sync_docs => 'rdoc' do
|
|
|
|
`rsync -ave ssh doc/ dev@dev.thoughtbot.com:/home/dev/www/dev.thoughtbot.com/shoulda`
|
|
|
|
end
|
|
|
|
|
2010-06-07 17:18:36 -04:00
|
|
|
desc 'Default: run tests for all supported versions of Rails'
|
|
|
|
task :default do
|
|
|
|
%w(2.3.8 3.0.0.beta3).each do |version|
|
|
|
|
system("RAILS_VERSION=#{version} rake -s test;")
|
|
|
|
end
|
|
|
|
end
|
2007-11-08 16:45:27 -05:00
|
|
|
|
2008-09-14 11:12:39 -04:00
|
|
|
spec = Gem::Specification.new do |s|
|
|
|
|
s.name = "shoulda"
|
2009-01-05 11:50:57 -05:00
|
|
|
s.version = Shoulda::VERSION
|
2008-09-14 11:12:39 -04:00
|
|
|
s.summary = "Making tests easy on the fingers and eyes"
|
|
|
|
s.homepage = "http://thoughtbot.com/projects/shoulda"
|
|
|
|
s.rubyforge_project = "shoulda"
|
|
|
|
|
2008-10-07 11:03:35 -04:00
|
|
|
s.files = FileList["[A-Z]*", "{bin,lib,rails,test}/**/*"]
|
2008-09-14 11:12:39 -04:00
|
|
|
s.executables = s.files.grep(/^bin/) { |f| File.basename(f) }
|
2007-11-08 16:45:27 -05:00
|
|
|
|
2008-09-14 11:12:39 -04:00
|
|
|
s.has_rdoc = true
|
|
|
|
s.extra_rdoc_files = ["README.rdoc", "CONTRIBUTION_GUIDELINES.rdoc"]
|
2009-02-28 17:54:02 -05:00
|
|
|
s.rdoc_options = ["--line-numbers", "--main", "README.rdoc"]
|
2008-09-14 11:12:39 -04:00
|
|
|
|
|
|
|
s.authors = ["Tammer Saleh"]
|
|
|
|
s.email = "tsaleh@thoughtbot.com"
|
|
|
|
end
|
|
|
|
|
|
|
|
Rake::GemPackageTask.new spec do |pkg|
|
|
|
|
pkg.need_tar = true
|
|
|
|
pkg.need_zip = true
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Clean files generated by rake tasks"
|
|
|
|
task :clobber => [:clobber_rdoc, :clobber_package]
|
|
|
|
|
|
|
|
desc "Generate a gemspec file for GitHub"
|
|
|
|
task :gemspec do
|
|
|
|
File.open("#{spec.name}.gemspec", 'w') do |f|
|
|
|
|
f.write spec.to_ruby
|
|
|
|
end
|
|
|
|
end
|