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:
parent
71427fad17
commit
918e3bc9cc
|
@ -24,6 +24,12 @@ module Puppetx::Yardoc::YARD::Handlers
|
||||||
return_type = options['type']
|
return_type = options['type']
|
||||||
return_type ||= 'statement' # Default for newfunction
|
return_type ||= 'statement' # Default for newfunction
|
||||||
obj.add_tag YARD::Tags::Tag.new(:return, '', return_type)
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -37,7 +43,12 @@ module Puppetx::Yardoc::YARD::Handlers
|
||||||
# name ::ParserFunctions, then there will be a clash. Hopefully the name
|
# name ::ParserFunctions, then there will be a clash. Hopefully the name
|
||||||
# is sufficiently uncommon.
|
# is sufficiently uncommon.
|
||||||
obj = P(:root, 'ParserFunctions')
|
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
|
obj
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue