Class: BuildpackSupport::Rake::CheckAPIDocTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/buildpack_support/rake/check_api_doc_task.rb

Overview

A task generator for the check_api_doc task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &task_block) ⇒ CheckAPIDocTask

Creates a new instance of the check_api_doc task



35
36
37
38
39
40
41
42
43
# File 'lib/buildpack_support/rake/check_api_doc_task.rb', line 35

def initialize(*args, &task_block)
  setup_ivars args

  desc 'Check that all APIs have been documented' unless ::Rake.application.last_comment
  task(name, *args) do |_, task_args|
    task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
    run_task verbose
  end
end

Instance Attribute Details

#nameString

Returns the name of the task. Defaults to :check_api_doc.

Returns:

  • (String)

    the name of the task. Defaults to :check_api_doc.



28
29
30
# File 'lib/buildpack_support/rake/check_api_doc_task.rb', line 28

def name
  @name
end

#verboseBoolean

Returns the verbosity of the task. Defaults to true.

Returns:

  • (Boolean)

    the verbosity of the task. Defaults to true.



32
33
34
# File 'lib/buildpack_support/rake/check_api_doc_task.rb', line 32

def verbose
  @verbose
end

Instance Method Details

#run_task(verbose) ⇒ void

This method returns an undefined value.

Run the main task functionality

Parameters:

  • verbose (Boolean)

    whether to print the detailed output of the failure



49
50
51
52
# File 'lib/buildpack_support/rake/check_api_doc_task.rb', line 49

def run_task(verbose)
  output = `yard stats --list-undoc`
  abort message(output, verbose) if output !~ /100.00% documented/
end