-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
40 lines (33 loc) · 923 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
require 'cane/rake_task'
require 'rspec/core/rake_task'
def prettify(task)
task.rspec_opts = '--color --format=doc'
end
RSpec::Core::RakeTask.new(:spec)
namespace :spec do
RSpec::Core::RakeTask.new(:doc) do |rspec|
prettify(rspec)
end
end
RSpec::Core::RakeTask.new(:demo) do |rspec|
rspec.pattern = './demo{,/*/**}/*_spec.rb'
prettify(rspec)
end
desc "Run cane to check quality metrics"
Cane::RakeTask.new(:quality) do |cane|
cane.abc_max = 5
cane.no_doc = true
cane.style_measure = 120
end
desc "Check code coverage level"
task :coverage => :spec do
required = 100.0
percent = File.read('coverage/coverage_percent').to_f
if percent < 100.0
raise "Coverage below minimum level (#{required.round(2)}%): #{percent.round(2)}%"
else
puts "Coverage meets minimum requirement: #{required.round(2)}%"
end
end
task :shippable => [:quality, :spec, :coverage]
task :default => :shippable