Tag all functions with @api public

The Puppet Core uses a `.yardopts` file that hides all docstrings that do not
have an API tag. This patch is a hack that allows `puppet yardoc` to extract
documentation for parser functions shipped in the core.

FIXME: This isn't the right way to solve the problem. The right way to solve
the problem is to adjust the Puppet `.yardopts` file to a sane value.
This commit is contained in:
Charlie Sharpsteen 2014-06-19 16:28:21 -07:00
parent 71427fad17
commit 918e3bc9cc
1 changed files with 12 additions and 1 deletions

View File

@ -24,6 +24,12 @@ module Puppetx::Yardoc::YARD::Handlers
return_type = options['type']
return_type ||= 'statement' # Default for newfunction
obj.add_tag YARD::Tags::Tag.new(:return, '', return_type)
# FIXME: This is a hack that allows us to document the Puppet Core which
# uses `--no-transitive-tag api` and then only shows things explicitly
# tagged with `public` or `private` api. This is kind of insane and
# should be fixed upstream.
obj.add_tag YARD::Tags::Tag.new(:api, 'public')
end
private
@ -37,7 +43,12 @@ module Puppetx::Yardoc::YARD::Handlers
# name ::ParserFunctions, then there will be a clash. Hopefully the name
# is sufficiently uncommon.
obj = P(:root, 'ParserFunctions')
::YARD::Registry.register PuppetNamespaceObject.new(:root, 'ParserFunctions') if obj.is_a?(Proxy)
if obj.is_a? Proxy
namespace_obj = PuppetNamespaceObject.new(:root, 'ParserFunctions')
namespace_obj.add_tag YARD::Tags::Tag.new(:api, 'public')
::YARD::Registry.register namespace_obj
end
obj
end