/
Rakefile
60 lines (49 loc) · 1021 Bytes
/
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
require 'rake'
require 'spec/rake/spectask'
require 'fileutils'
SPEC = "spec/system_spec.rb"
SPEC_OUTPUT_DIR = "spec_output"
ENGINE = (
if defined? RUBY_ENGINE
RUBY_ENGINE
else
"ruby"
end
)
@raw_output = nil
@rcov = nil
def run_spec(which)
mkdir_p SPEC_OUTPUT_DIR
tag = ENGINE == "ruby" ? "" : "_" + ENGINE
stem = File.join(
SPEC_OUTPUT_DIR,
File.basename(SPEC).sub(%r!\.rb\Z!, "") + "#{tag}_#{which}"
)
if @raw_output
# text format and redirect to record hard errors
system("spec -fs #{SPEC} -- --#{which} > #{stem}.txt 2>&1")
else
Spec::Rake::SpecTask.new(which.to_s) do |t|
t.spec_files = FileList[SPEC]
t.spec_opts = ["--format", "html:#{stem}.html", "--", "--#{which}"]
if @rcov
t.rcov = true
end
end
end
end
task :raw_output do
@raw_output = true
end
task :rcov do
@rcov = true
end
task :engine do
puts ENGINE
end
[:alt, :kernel].each { |which|
task which do
run_spec(which)
end
task :default => which
}