forked from jwood/tenacity
/
Rakefile
75 lines (61 loc) · 1.89 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
require 'rubygems'
require 'bundler'
Bundler::GemHelper.install_tasks
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'rake/testtask'
require 'rcov/rcovtask'
require 'rake/rdoctask'
require 'yard'
task :default => :test
Rake::TestTask.new(:test) do |test|
ENV['TENACITY_TEST'] = 'true'
test.libs << 'lib' << 'test' << 'test/fixtures'
test.pattern = ENV['TEST'] || "test/**/*_test.rb"
test.verbose = true
end
desc 'Run an abbreviated version of the test suite'
task :quick_test do
ENV['QUICK'] = 'true'
Rake::Task["test"].invoke
end
desc 'Run the full test suite, testing all ORM/ODMs against each other'
task :long_test do
ENV['LONG'] = 'true'
Rake::Task["test"].invoke
end
# Usage: rake 'single_test["test/association_features/belongs_to_test.rb", "/memoize the association/"]'
desc "Run a single test"
task :single_test, [:test_file, :test_name] do |test, args|
system "ruby -I'lib:lib:test:test/fixtures' #{args['test_file']} -n #{args['test_name']}"
end
Rcov::RcovTask.new do |test|
test.libs << 'test' << 'test/fixtures'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
test.rcov_opts << '--exclude "gems/*"'
end
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "tenacity #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('EXTEND*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', '-', 'EXTEND.rdoc']
end
desc 'Delete rcov, rdoc, yard, and other generated files'
task :clobber => [:clobber_rcov, :clobber_rdoc, :clobber_yard]
desc 'Delete yard generated files'
task :clobber_yard do
puts 'rm -rf doc .yardoc'
FileUtils.rm_rf ['doc', '.yardoc']
end