-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
68 lines (53 loc) · 1.28 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
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'cucumber/rake/task'
require 'rake/clean'
CLEAN.include(FileList['coverage'])
task default: [:test]
task test: [:clean, :rubocop, :spec, :clean, :features, :docs]
task docs: [:examples, :build_docs, :no_doc_change]
RSpec::Core::RakeTask.new(:spec) do |s|
s.pattern = 'spec/**/*.rb'
end
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['**/*.rb']
task.fail_on_error = true
end
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "features --format pretty"
end
task :build_docs do
pid = fork do
exec('ruby', 'src_readme/make.rb')
end
Process.wait(pid)
if $?.exitstatus > 0
puts "Readme build failed!"
exit 1
end
end
task :no_doc_change do
pid = fork do
exec('git', 'diff', '--exit-code', 'src_readme/README_no_output.md')
end
Process.wait(pid)
if $?.exitstatus > 0
puts "Readme build changed the README.md! Must rebuild and commit."
exit 1
end
end
task :examples do
FileList['src_readme/examples/*.rb'].each do |file|
puts "Testing example: #{file}"
pid = fork do
exec('ruby', file)
end
Process.wait(pid)
if $?.exitstatus > 0
puts "Example #{file} failed!"
exit 1
end
puts ""
end
end