Sha256: ad1087d5261eab81ca01c44b6f27d8bd18d7edef8fcdf42730f51955315da9f6
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
require "bundler/gem_tasks" unless Rake::Task.task_defined?('spec') begin require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = "./spec/**/*_spec.rb" ENV['COVERAGE'] = 'true' end rescue LoadError $stdout.puts "RSpec failed to load; You won't be able to run tests." end end require 'rubocop/rake_task' RuboCop::RakeTask.new do |task| task.options << "--config=.hound.yml" end namespace :commitment do task :configure_test_for_code_coverage do ENV['COVERAGE'] = 'true' end task :code_coverage do require 'json' $stdout.puts "Checking code_coverage" lastrun_filename = File.expand_path('../coverage/.last_run.json', __FILE__) if File.exist?(lastrun_filename) coverage_percentage = JSON.parse(File.read(lastrun_filename)).fetch('result').fetch('covered_percent').to_i if coverage_percentage < 100 abort("ERROR: Code Coverage Goal Not Met:\n\t#{coverage_percentage}%\tExpected\n\t100%\tActual") else $stdout.puts "Code Coverage Goal Met (100%)" end else abort "Expected #{lastrun_filename} to exist for code coverage" end end end task(default: [:rubocop, 'commitment:configure_test_for_code_coverage', :spec, 'commitment:code_coverage']) task(release: :default)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
locabulary-0.3.1 | Rakefile |
locabulary-0.3.0 | Rakefile |