Included Modules

Class/Module Index [+]

Quicksearch

Bones::Plugins::Rcov

Public Instance Methods

define_tasks() click to toggle source
# 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(ff, 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() click to toggle source
# 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 ]--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() click to toggle source
# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.