Included Modules

Bones::Plugins::Rcov

Public Instance Methods

define_tasks() click to toggle source
    # File lib/bones/plugins/rcov.rb, line 46
46:   def define_tasks
47:     return unless have? :rcov
48:     config = ::Bones.config
49: 
50:     if have? :test
51:       namespace :test do
52:         desc 'Run rcov on the unit tests'
53:         Rcov::RcovTask.new do |t|
54:           t.output_dir = config.rcov.dir
55:           t.rcov_opts = config.rcov.opts
56:           t.ruby_opts = config.ruby_opts.dup.concat(config.test.opts)
57: 
58:           t.test_files =
59:               if test(ff, config.test.file) then [config.test.file]
60:               else config.test.files.to_a end
61: 
62:           t.libs = config.libs unless config.libs.empty?
63:         end
64: 
65:         task :clobber_rcov do
66:           rm_r config.rcov.dir rescue nil
67:         end
68:       end
69:       task :clobber => 'test:clobber_rcov'
70:     end
71: 
72:     if have? :spec
73:       require 'spec/rake/verify_rcov'
74:       namespace :spec do
75:         desc 'Run all specs with Rcov'
76:         Spec::Rake::SpecTask.new(:rcov) do |t|
77:           t.ruby_opts = config.ruby_opts
78:           t.spec_opts = config.spec.opts
79:           t.spec_files = config.spec.files
80:           t.libs += config.libs
81:           t.rcov = true
82:           t.rcov_dir = config.rcov.dir
83:           t.rcov_opts.concat(config.rcov.opts)
84:         end
85: 
86:         RCov::VerifyTask.new(:verify) do |t|
87:           t.threshold = config.rcov.threshold
88:           t.index_html = File.join(config.rcov.dir, 'index.html')
89:           t.require_exact_threshold = config.rcov.threshold_exact
90:         end
91: 
92:         task :verify => :rcov
93:         remove_desc_for_task %(spec:clobber_rcov)
94:       end
95:       task :clobber => 'spec:clobber_rcov'
96:     end
97:   end
initialize_rcov() click to toggle source
    # File lib/bones/plugins/rcov.rb, line 6
 6:   def initialize_rcov
 7:     require 'rcov'
 8:     require 'rcov/rcovtask'
 9:     have?(:rcov) { true }
10: 
11:     ::Bones.config {
12:       desc 'Configuration settings for the Rcov code coverage tool.'
13:       rcov {
14:         dir 'coverage', :desc =>           Code coverage metrics will be written to this directory.
15: 
16:         opts ]--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'.
17: 
18:         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.
19: 
20:         threshold_exact false, :desc =>           Require the threshold to be met exactly. By default this option is          set to false.
21:       }
22:     }
23:   rescue LoadError
24:     have?(:rcov) { false }
25:   end
post_load() click to toggle source
    # File lib/bones/plugins/rcov.rb, line 40
40:   def post_load
41:     return unless have? :rcov
42:     config = ::Bones.config
43:     config.exclude << "^#{Regexp.escape(config.rcov.dir)}/"
44:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.