This repository has been archived by the owner on Jul 29, 2020. It is now read-only.
forked from pat/thinking-sphinx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
80 lines (65 loc) · 2.03 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
require 'rubygems'
require 'bundler'
Bundler::GemHelper.install_tasks
Bundler.require :default, :development
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
RSpec::Core::RakeTask.new
desc 'Run all feature-set configurations'
task :cucumber => ['cucumber:mysql', 'cucumber:postgresql']
namespace :cucumber do
def add_task(name, description)
Cucumber::Rake::Task.new(name, description) do |t|
t.cucumber_opts = "--format pretty DATABASE=#{name}"
end
end
add_task :mysql, 'Run feature-set against MySQL'
add_task :postgresql, 'Run feature-set against PostgreSQL'
desc 'Build cucumber.yml file'
task :defaults do
steps = FileList['features/step_definitions/**.rb'].collect { |path|
"--require #{path}"
}.join(" ")
File.open('cucumber.yml', 'w') { |f|
f.write "default: \"--require features/support/env.rb #{steps}\"\n"
}
end
end
namespace :rcov do
desc 'Generate RCov reports'
RSpec::Core::RakeTask.new(:rspec) do |t|
t.rcov = true
t.rcov_opts = [
'--exclude', 'spec',
'--exclude', 'gems',
'--exclude', 'riddle',
'--exclude', 'ruby',
'--aggregate coverage.data'
]
end
def add_task(name, description)
Cucumber::Rake::Task.new(name, description) do |t|
t.cucumber_opts = "--format pretty features/*.feature DATABASE=#{name}"
t.rcov = true
t.rcov_opts = [
'--exclude', 'spec',
'--exclude', 'gems',
'--exclude', 'riddle',
'--exclude', 'features',
'--aggregate coverage.data'
]
end
end
add_task :mysql, 'Run feature-set against MySQL with rcov'
add_task :postgresql, 'Run feature-set against PostgreSQL with rcov'
task :all do
rm 'coverage.data' if File.exist?('coverage.data')
rm 'rerun.txt' if File.exist?('rerun.txt')
Rake::Task['rcov:rspec'].invoke
Rake::Task['rcov:mysql'].invoke
Rake::Task['rcov:postgresql'].invoke
end
end if defined?(Rcov)
desc 'Generate documentation'
YARD::Rake::YardocTask.new
task :default => [:spec, :cucumber]