Cross package maker. DEB/RPM generation or conversion. Derived from jordansissel/fpm.

⌈⌋ ⎇ branch:  cross package maker


Artifact [c6e32ba962]

Artifact c6e32ba962c11c1493db3f62757de1a642cfd2c2:

  • File test/docs.rb — part of check-in [1e5dbadf47] at 2012-02-23 07:59:31 on branch trunk — - start major refactoring. Design first, this time. With tests. (user: jls@semicomplete.com size: 1511)

require "rubygems"                                                                                               
require "yard"                                                                                                   
require File.join(File.expand_path(File.dirname(__FILE__)), "testing")
require "minitest/autorun"

describe "documentation tests" do
  before do
    # Use YARD to parse all ruby files found in '../lib'
    libdir = File.join(File.dirname(__FILE__), "..", "lib")
    YARD::Registry.load(Dir.glob(File.join(libdir, "**", "*.rb")))
    @registry = YARD::Registry.all
  end

  test "All classes, methods, modules, and constants must be documented" do
    # Note, the 'find the undocumented things' code here is 
    # copied mostly from: YARD 0.7.5's lib/yard/cli/stats.rb
    #
    # Find all undocumented classes, modules, and constants
    undocumented = @registry.select do |o| 
      [:class, :module, :constant].include?(o.type) && o.docstring.blank?
    end

    # Find all undocumented methods
    methods = @registry.select { |m| m.type == :method }
    methods.reject! { |m| m.is_alias? || !m.is_explicit? }
    undocumented += methods.select do |m| 
      m.docstring.blank? && !m.overridden_method
    end

    if (undocumented.length > 0)
      message = ["The following are not documented"]
      undocumented.each do |o|
        message << "* #{o.type.to_s} #{o.to_s} <#{o.file}:#{o.line}>"
      end

      flunk(message.join("\n"))
    else
      pass
    end
  end
end