Re-work yardoc options
The `puppet yardoc` command now consumes an optional list of manifest files to document. If no files are passed, a default glob of `manifests/**/*.pp` will be used.
This commit is contained in:
parent
e3d2602cba
commit
1b275a4926
|
@ -5,8 +5,7 @@ Puppet::Face.define(:yardoc, '0.0.1') do
|
||||||
action(:yardoc) do
|
action(:yardoc) do
|
||||||
default
|
default
|
||||||
|
|
||||||
when_invoked do |manifest, options|
|
when_invoked do |*args|
|
||||||
|
|
||||||
unless Puppet.features.yard?
|
unless Puppet.features.yard?
|
||||||
raise RuntimeError, "The 'yard' gem must be installed in order to use this face."
|
raise RuntimeError, "The 'yard' gem must be installed in order to use this face."
|
||||||
end
|
end
|
||||||
|
@ -15,10 +14,22 @@ Puppet::Face.define(:yardoc, '0.0.1') do
|
||||||
raise RuntimeError, "The 'rgen' gem must be installed in order to use this face."
|
raise RuntimeError, "The 'rgen' gem must be installed in order to use this face."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# The last element of the argument array should be the options hash.
|
||||||
|
#
|
||||||
|
# NOTE: The Puppet Face will throw 'unrecognized option' errors if any
|
||||||
|
# YARD options are passed to it. The best way to approach this problem is
|
||||||
|
# by using the `.yardopts` file. YARD will autoload any options placed in
|
||||||
|
# that file.
|
||||||
|
opts = args.pop
|
||||||
|
|
||||||
|
# For now, assume the remaining positional args are a list of manifest
|
||||||
|
# files to parse.
|
||||||
|
manifest_files = (args.empty? ? ['manifests/**/*.pp'] : args)
|
||||||
|
|
||||||
require 'puppetx/yardoc/yard/plugin'
|
require 'puppetx/yardoc/yard/plugin'
|
||||||
|
|
||||||
# Hand off to YARD for further processing.
|
# Hand off to YARD for further processing.
|
||||||
YARD::CLI::Yardoc.run(manifest)
|
YARD::CLI::Yardoc.run(*manifest_files)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue