/
Rakefile
70 lines (60 loc) · 1.63 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
require 'rake'
require 'rspec/core'
require 'rspec/core/rake_task'
require 'rcov/rcovtask'
require "cucumber/rake/task"
require "yard"
desc 'Default: run tests'
task :default => :test
desc "Run specs"
RSpec::Core::RakeTask.new do |t|
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
# Put spec opts in a file named .rspec in root
end
desc "Run performance specs"
RSpec::Core::RakeTask.new(:perf) do |t|
t.pattern = "./performance/**/*_spec.rb"
t.rspec_opts = ['-f d']
end
desc "Run features"
Cucumber::Rake::Task.new(:features) do |task|
task.cucumber_opts = ["features", "-f progress"]
end
desc "Run all reports, specs and features"
task :all do
puts "\nProfiling report"
Rake::Task['perf'].invoke
puts "\nCode Coverage report"
Rake::Task['coverage'].invoke
puts "\nFlog results"
Rake::Task['flog'].invoke
puts "\nSpec Tests"
Rake::Task['spec'].invoke
puts "\nCucumber features"
Rake::Task['features'].invoke
end
desc "Run tests"
task :test do
Rake::Task['spec'].invoke
Rake::Task['features'].invoke
end
desc "Flog the code! (*nix only)"
task :flog do
system('find lib -name \*.rb | xargs flog')
end
desc "Detailed Flog report! (*nix only)"
task :flog_detail do
system('find lib -name \*.rb | xargs flog -d')
end
# Task :rcov -- Run RCOV to Generate code coverage report
Rcov::RcovTask.new do |t|
t.libs << "lib"
t.test_files = FileList['spec/*.rb']
t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems', '-T']
t.verbose = true
end
# Task :yard -- Generate yard + yard-cucumber docs
YARD::Rake::YardocTask.new do |t|
t.files = ['features/**/*', 'lib/**/*.rb']
t.options = ['--private']
end