From 30c8207e0f2e10a6f02a0c2ba16825ad27092108 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Wed, 26 Feb 2014 11:46:02 +0000 Subject: chore(doc-gen): add debug-dump processor --- docs/config/processors/debug-dump.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/config/processors/debug-dump.js (limited to 'docs/config/processors/debug-dump.js') diff --git a/docs/config/processors/debug-dump.js b/docs/config/processors/debug-dump.js new file mode 100644 index 00000000..644091a3 --- /dev/null +++ b/docs/config/processors/debug-dump.js @@ -0,0 +1,26 @@ +var writer = require('dgeni/lib/utils/doc-writer'); +var log = require('winston'); +var util = require("util"); + +var filter, outputPath, depth; + +module.exports = { + name: 'debug-dump', + runBefore: ['write-files'], + description: 'This processor dumps docs that match a filter to a file', + init: function(config, injectables) { + filter = config.get('processing.debug-dump.filter'); + outputPath = config.get('processing.debug-dump.outputPath'); + depth = config.get('processing.debug-dump.depth', 2); + }, + process: function(docs) { + if ( filter && outputPath ) { + log.info('Dumping docs:', filter, outputPath); + var filteredDocs = filter(docs); + var dumpedDocs = util.inspect(filteredDocs, depth); + return writer.writeFile(outputPath, dumpedDocs).then(function() { + return docs; + }); + } + } +}; \ No newline at end of file -- cgit v1.2.3