Fix issue running strings:generate without a yardopts file

Without a .yardopts options array.pop is nil, and everything explodes
with an exception. Applying this patch allowed for running rake
strings:generate cleanly.

Note that this did not affect strings:serve.
This commit is contained in:
Gareth Rushgrove 2016-02-03 13:56:54 +01:00
parent 3a8067bad5
commit 8bbbd7f698
1 changed files with 2 additions and 2 deletions

View File

@ -15,14 +15,14 @@ module PuppetX::PuppetLabs::Strings::Util
# by using the `.yardopts` file. YARD will autoload any options placed in # by using the `.yardopts` file. YARD will autoload any options placed in
# that file. # that file.
options = args.pop options = args.pop
YARD::Config.options = YARD::Config.options.merge(options) YARD::Config.options = YARD::Config.options.merge(options) if options
# For now, assume the remaining positional args are a list of manifest # For now, assume the remaining positional args are a list of manifest
# and ruby files to parse. # and ruby files to parse.
yard_args = (args.empty? ? MODULE_SOURCEFILES : args) yard_args = (args.empty? ? MODULE_SOURCEFILES : args)
# If json is going to be emitted to stdout, suppress statistics. # If json is going to be emitted to stdout, suppress statistics.
if options[:emit_json_stdout] if options && options[:emit_json_stdout]
yard_args.push('--no-stats') yard_args.push('--no-stats')
end end