-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
65 lines (56 loc) · 1.47 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
# -*- ruby -*-
require 'rubygems'
require 'spec/rake/spectask'
require 'cucumber/rake/task'
require 'rcov/rcovtask'
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
task :verify_rcov => [:spec, :features]
task :default => :verify_rcov
desc "Run all specs"
Spec::Rake::SpecTask.new do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['--options', 'spec/spec.opts']
unless ENV['NO_RCOV']
t.rcov = true
t.rcov_opts << '--text-report'
t.rcov_opts << '--exclude features\/,spec\/'
t.rcov_opts << '--aggregate coverage\coverage.data'
t.rcov_opts << '--sort coverage'
end
end
desc "Run Cucumber features"
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = '--no-source'
t.rcov = true
t.rcov_opts << '-o coverage'
t.rcov_opts << '--text-report'
t.rcov_opts << '--exclude features\/,spec\/'
t.rcov_opts << '--aggregate coverage\coverage.data'
t.rcov_opts << '--sort coverage'
end
directory 'coverage'
task :features => 'coverage'
task :spec => 'coverage'
desc "Run unit tests"
Rcov::RcovTask.new(:test) do |t|
t.pattern = FileList['test/all_tests.rb']
t.verbose = true
t.rcov_opts << '--sort coverage'
end
def egrep(pattern)
Dir['**/*.rb'].each do |fn|
count = 0
open(fn) do |f|
while line = f.gets
count += 1
if line =~ pattern
puts "#{fn}:#{count}:#{line}"
end
end
end
end
end
desc "Look for TODO and FIXME tags in the code"
task :todo do
egrep /(FIXME|todo|TBD)/
end