forked from code4lib/ruby-oai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
90 lines (75 loc) · 2.45 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
require 'rubygems'
require 'rake'
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
Bundler::GemHelper.install_tasks
require 'rake/testtask'
require 'yard'
task :default => ["test", "yard"]
task :test => ["test:client", "test:provider", "test:activerecord_provider"]
namespace :test do
Rake::TestTask.new('client') do |t|
t.libs << ['lib', 'test/client']
t.pattern = 'test/client/tc_*.rb'
t.verbose = true
end
Rake::TestTask.new('provider') do |t|
t.libs << ['lib', 'test/provider']
t.pattern = 'test/provider/tc_*.rb'
t.verbose = true
end
desc "Active Record base Provider Tests"
Rake::TestTask.new('activerecord_provider') do |t|
t.libs << ['lib', 'test/activerecord_provider']
t.pattern = 'test/activerecord_provider/tc_*.rb'
t.verbose = true
end
desc 'Measures test coverage'
# borrowed from here: http://clarkware.com/cgi/blosxom/2007/01/05#RcovRakeTask
task :coverage do
rm_f "coverage"
rm_f "coverage.data"
if RUBY_VERSION =~ /^1.8/
Rake::Task['rcov:client'].invoke
Rake::Task['rcov:provider'].invoke
Rake::Task['rcov:activerecord_provider'].invoke
else
ENV['COVERAGE'] = 'true'
Rake::Task['test:client'].invoke
Rake::Task['test:provider'].invoke
Rake::Task['test:activerecord_provider'].invoke
end
system("open coverage/index.html") if (PLATFORM['darwin'] if Kernel.const_defined? :PLATFORM) || (RUBY_PLATFORM =~ /darwin/ if Kernel.const_defined? :RUBY_PLATFORM)
end
end
if RUBY_VERSION =~ /^1.8/
require 'rcov/rcovtask'
namespace :rcov do
Rcov::RcovTask.new do |t|
t.name = 'client'
t.libs << ['lib', 'test/client']
t.pattern = 'test/client/tc_*.rb'
t.verbose = true
t.rcov_opts = ['--aggregate coverage.data', '--text-summary']
end
Rcov::RcovTask.new('provider') do |t|
t.libs << ['lib', 'test/provider']
t.pattern = 'test/provider/tc_*.rb'
t.verbose = true
t.rcov_opts = ['--aggregate coverage.data', '--text-summary']
end
Rcov::RcovTask.new('activerecord_provider') do |t|
t.libs << ['lib', 'test/activerecord_provider']
t.pattern = 'test/activerecord_provider/tc_*.rb'
t.verbose = true
t.rcov_opts = ['--aggregate coverage.data', '--text-summary']
end
end
end
YARD::Rake::YardocTask.new do |t|
t.files = ["lib/**/*.rb"]
t.options = ['--output-dir', 'doc']
end