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
|
# RSpec tasks
begin
require 'rspec/core/rake_task'
# Create the 'spec' task
RSpec::Core::RakeTask.new(:spec) do |task|
task.rspec_opts = '--color'
end
namespace :spec do
desc "Run the test suite and generate coverage metrics"
task :coverage => [ :simplecov, :spec ]
# Add test coverage to the 'spec' task.
task :simplecov do
ENV['COVERAGE'] = '1'
end
end
task :default => :spec
rescue LoadError
warn "[Warning]: Could not load `rspec`."
end
# YARD tasks
begin
require 'yard'
require 'yard/rake/yardoc_task'
YARD::Rake::YardocTask.new(:doc) do |yardoc|
yardoc.files = [ 'lib/**/*.rb', '-', '**/*.md' ]
end
rescue LoadError
warn "[Warning]: Could not load `yard`."
end
# Cane tasks
begin
require 'cane/rake_task'
Cane::RakeTask.new(:cane) do |cane|
cane.add_threshold 'coverage/.last_run.json', :>=, 100
cane.abc_max = 15
end
Rake::Task['cane'].prerequisites << Rake::Task['spec:coverage']
Rake::Task[:default].clear_prerequisites
task :default => :cane
rescue LoadError
warn "[Warning]: Could not load `cane`."
end
# Bundler tasks
begin
require "bundler/gem_tasks"
rescue LoadError
warn "[Warning]: Could not load `bundler/gem_tasks`."
end
|