-
Notifications
You must be signed in to change notification settings - Fork 25
/
index.js
38 lines (31 loc) · 1.09 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
var YuidocCompiler = require('./lib/broccoli-yuidoc');
var optsGenerator = require('./lib/options');
var mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-cli-yuidoc',
postprocessTree: function(type, workingTree) {
if(type === 'all') {
var env = this.app.env;
var config = optsGenerator.load();
if((this.liveDocsEnabled && env === 'development') ||
(config.options && config.options.enabledEnvironments && config.options.enabledEnvironments.indexOf(env) !== -1)) {
return this.addDocsToTree(workingTree, optsGenerator.generate(config));
}
}
return workingTree;
},
included: function(){
var cmdOpts = process.argv.slice(3);
this.liveDocsEnabled = cmdOpts.indexOf('--docs') !== -1;
},
includedCommands: function() {
return {
'ember-cli-yuidoc': require('./lib/commands/ember-cli-yuidoc')
};
},
addDocsToTree: function(inputTree, config){
var yuidocTree = new YuidocCompiler(config.paths, config);
return mergeTrees([inputTree, yuidocTree], { overwrite: true });
}
};