Class: Yardstick::Rake::Verify

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/yardstick/rake/verify.rb

Overview

A rake task for verifying the doc thresholds

Instance Method Summary collapse

Constructor Details

#initialize(name = :verify_measurements, options = {}) {|config| ... } ⇒ Yardstick::Rake::Verify

Initialize a Verify task

Examples:

task = Yardstick::Rake::Verify.new do |task|
  task.threshold = 100
end

Parameters:

  • options (Hash) (defaults to: {})

    optional configuration

  • name (Symbol) (defaults to: :verify_measurements)

    optional task name

Yield Parameters:



31
32
33
34
35
36
37
38
# File 'lib/yardstick/rake/verify.rb', line 31

def initialize(name = :verify_measurements, options = {}, &block)
  @name      = name
  @config    = Config.coerce(options, &block)
  @threshold = @config.threshold

  assert_threshold
  define
end

Instance Method Details

#verify_measurementsundefined

Verify the YARD coverage measurements

Examples:

task.verify_measurements  # output coverage and threshold

Returns:

  • (undefined)

Raises:

  • (RuntimeError)

    raised if threshold is not met

  • (RuntimeError)

    raised if threshold is not equal to the coverage



53
54
55
56
57
# File 'lib/yardstick/rake/verify.rb', line 53

def verify_measurements
  puts "YARD-Coverage: #{total_coverage}% (threshold: #{@threshold}%)" if @config.verbose?
  assert_meets_threshold
  assert_matches_threshold
end