This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
53 lines (46 loc) · 1.38 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
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
spec.rspec_opts = "-d"
end
RSpec::Core::RakeTask.new(:spec_with_report) do |spec|
spec.fail_on_error = false
spec.pattern = FileList['spec/**/*_spec.rb']
spec.rspec_opts = "--format html --out report/tests/report.html"
end
desc "Run all specs, profile the code, and generate a coverage report"
task :report do
Dir.mkdir "report" unless File.exists? "report"
Dir.mkdir "report/profile" unless File.exists? "report/profile"
Dir.mkdir "report/tests" unless File.exists? "report/tests"
File.open "report/index.html","w" do |f|
f.write <<-HTML
<html>
<body>
<h1> Status Report </h1>
<p>
<a href="coverage/index.html"> Coverage </a>
</p>
<p>
<a href="profile/profile.graph.html"> Graph Speed Profile </a><br/>
<a href="profile/profile.stack.html"> Speed Profile </a>
</p>
<p>
<a href="test/report.html"> Test Report </a>
</p>
</body>
</html>
HTML
end
ENV["REPORT"] = "1"
Rake::Task[:spec_with_report].invoke
ENV["REPORT"] = ""
end
desc "Delete the report directory"
task :clear_report do
`rm -rf report`
end
task :default => :spec