Module: Bones::Plugins::Rcov
Instance Method Summary collapse
Instance Method Details
#define_tasks ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/bones/plugins/rcov.rb', line 50 def define_tasks return unless have? :rcov config = ::Bones.config if have? :test namespace :test do desc 'Run rcov on the unit tests' Rcov::RcovTask.new do |t| t.output_dir = config.rcov.dir t.rcov_opts = config.rcov.opts t.ruby_opts = config.ruby_opts.dup.concat(config.test.opts) t.test_files = if test(?f, config.test.file) then [config.test.file] else config.test.files.to_a end t.libs = config.libs unless config.libs.empty? end task :clobber_rcov do rm_r config.rcov.dir rescue nil end end task :clobber => 'test:clobber_rcov' end end |
#initialize_rcov ⇒ Object
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 |
# File 'lib/bones/plugins/rcov.rb', line 6 def initialize_rcov require 'rcov' require 'rcov/rcovtask' have?(:rcov) { true } ::Bones.config { desc 'Configuration settings for the Rcov code coverage tool.' rcov { path 'rcov', :desc => <<-__ Path to the rcov executable. __ dir 'coverage', :desc => <<-__ Code coverage metrics will be written to this directory. __ opts %w[--sort coverage -T], :desc => <<-__ An array of command line options that will be passed to the rcov command when running your tests. See the Rcov help documentation either online or from the command line by running 'rcov --help'. __ threshold 90.0, :desc => <<-__ The threshold value (in percent) for coverage. If the actual coverage is not greater than or equal to this value, the verify task will raise an exception. __ threshold_exact false, :desc => <<-__ Require the threshold to be met exactly. By default this option is set to false. __ } } rescue LoadError have?(:rcov) { false } end |
#post_load ⇒ Object
44 45 46 47 48 |
# File 'lib/bones/plugins/rcov.rb', line 44 def post_load return unless have? :rcov config = ::Bones.config config.exclude << "^#{Regexp.escape(config.rcov.dir)}/" end |