-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
55 lines (46 loc) · 1.5 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
# Cucumber task
require 'cucumber'
require 'cucumber/rake/task'
task :test => ['spec', 'features']
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "features --format progress"
end
# RSpec task
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
# YARD task
require 'yard'
YARD::Rake::YardocTask.new(:doc)
# Coverage task. Checks if code coverage is 100%.
task :cov do |t|
PERCENTAGE_FILE = File.join(File.dirname(__FILE__), 'coverage/percentage.txt')
if !File.exists?(PERCENTAGE_FILE)
fail "Could not find file 'coverage/percentage.txt'. Please run 'rake spec'"+
" to generate coverage statistics."
end
File.open(PERCENTAGE_FILE, 'r') do |f|
if f.read.to_f != 100.0
fail "Code coverage is below 100%. See coverage/index.html for details."
end
end
end
# API task. Lists methods, constants etc. that belong to the user API.
task :api do |t|
puts "============================================="
puts "The following objects belong to the user API."
puts "For information on the APIs, see NEWS."
puts "============================================="
YARD::CLI::List.new.run("--query", "@api.text =~ /^user/")
end
# Debug task. Checks if I've forgotten a debug statement somewhere.
task :debug do |t|
Dir['**/*.rb'].each do |f|
File.open(File.join(File.dirname(__FILE__), f), 'r') do |file|
ct = 1
file.each do |line|
fail("#{$~} in file #{f}, line #{ct}.\n#{line}") if line =~ /TODO|DEBUG/
ct += 1
end
end
end
end