(PDOC-23) Polish JSON output command line behavior

Fix path where json is saved.
Suppress statistics when emitting json to stdout.
This commit is contained in:
Ian Kronquist 2015-10-15 18:56:05 -07:00
parent 0e1dbb17be
commit 86414df8de
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,11 @@ module PuppetX::PuppetLabs::Strings::Util
# 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 options[:emit_json_stdout]
yard_args.push('--no-stats')
end
# This line monkeypatches yard's progress indicator so it doesn't write # This line monkeypatches yard's progress indicator so it doesn't write
# all over the terminal. This should definitely not be in real code, but # all over the terminal. This should definitely not be in real code, but
# it's very handy for debugging with pry # it's very handy for debugging with pry

View File

@ -71,7 +71,7 @@ module YARD
def serialize(data) def serialize(data)
if YARD::Config.options[:emit_json] if YARD::Config.options[:emit_json]
path = File.join(basepath, YARD::Config.options[:emit_json]) path = YARD::Config.options[:emit_json]
log.debug "Serializing json to #{path}" log.debug "Serializing json to #{path}"
File.open!(path, "wb") {|f| f.write data } File.open!(path, "wb") {|f| f.write data }
end end