class Detroit::Yardstick
Yardstick
is a documentation coverage metric tool.
@assembly Standard
@todo Switch to analyze station if detroit moves it after document.
Constants
- MANPAGE
Location of the manpage document for this tool.
Attributes
return [Boolean]
The path to the file where the measurements will be written.
@param [String, Pathname] output
optional output path for measurements
@return [String]
List of paths to measure.
@param [Array<#to_s>, to_s] path
optional list of paths to measure
@return [String,Array<String>]
@return [Hash]
return [Integer]
return [Boolean]
Public Instance Methods
This tool ties into the ‘post_document` station of the standard assembly.
@return [Boolean,Symbol]
# File lib/detroit-yardstick.rb, line 88 def assemble?(station, options={}) return :save if station == :post_document return false end
Prerequisite setup.
@return [undefined]
# File lib/detroit-yardstick.rb, line 28 def prerequisite require 'yardstick' @path = 'lib/**/*.rb' @output = project.log + 'yardstick.txt' @verbose = true @exact = true end
Measure the documentation and write to stdout.
@example
tool.print # (print measurement report to stdout)
@return [undefined]
# File lib/detroit-yardstick.rb, line 81 def print ::Yardstick.measure(yard_config).puts($stdout) end
Measure the documentation and write to output.
@example
tool.save # (save measurement report to output)
@return [undefined]
# File lib/detroit-yardstick.rb, line 71 def save write_report { |io| ::Yardstick.measure(yard_config).puts(io) } end
Private Instance Methods
Open up a report for writing
@yield [io]
yield to an object that responds to #puts
@yieldparam [#puts] io
the object that responds to #puts
@return [void]
# File lib/detroit-yardstick.rb, line 125 def write_report(&block) file = Pathname(output) file.dirname.mkpath file.open('w', &block) end
# File lib/detroit-yardstick.rb, line 96 def yard_config Yardstick::Config.coerce(yard_options) end
# File lib/detroit-yardstick.rb, line 101 def yardstick_options opts = {} opts[:path] = path opts[:output] = output opts[:verbose] = verbose opts[:require_exact_threshold] = exact opts[:threshold] = threshold if threashold opts[:rules] = rules if rules return opts end