diff options
| author | Peter Bacon Darwin | 2014-02-26 11:46:02 +0000 | 
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-26 11:47:22 +0000 | 
| commit | 30c8207e0f2e10a6f02a0c2ba16825ad27092108 (patch) | |
| tree | 61412c716d51d4bbd570b2ba412a790d2e5974fb /docs/config/processors/debug-dump.js | |
| parent | 3d6dff44f33b192a7fa007bfda5e44574fadc6e1 (diff) | |
| download | angular.js-30c8207e0f2e10a6f02a0c2ba16825ad27092108.tar.bz2 | |
chore(doc-gen): add debug-dump processor
Diffstat (limited to 'docs/config/processors/debug-dump.js')
| -rw-r--r-- | docs/config/processors/debug-dump.js | 26 | 
1 files changed, 26 insertions, 0 deletions
| 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 | 
