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:
Charlie Sharpsteen 2014-05-26 12:02:59 -07:00
parent e3d2602cba
commit 1b275a4926
1 changed files with 14 additions and 3 deletions

View File

@ -5,8 +5,7 @@ Puppet::Face.define(:yardoc, '0.0.1') do
action(:yardoc) do
default
when_invoked do |manifest, options|
when_invoked do |*args|
unless Puppet.features.yard?
raise RuntimeError, "The 'yard' gem must be installed in order to use this face."
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."
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'
# Hand off to YARD for further processing.
YARD::CLI::Yardoc.run(manifest)
YARD::CLI::Yardoc.run(*manifest_files)
end
end
end