-
Notifications
You must be signed in to change notification settings - Fork 3
/
ember-addon-main.js
55 lines (42 loc) · 1.22 KB
/
ember-addon-main.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var path = require('path');
var BroccoliBuilder = require('broccoli').Builder;
var BroccoliLeasotFilter = require('./lib/index');
var chalk = require('chalk');
var forOwnFn = require('lodash/object').forOwn;
module.exports = {
name: 'broccoli-leasot',
included: function(app) {
this._super.included.apply(this, arguments);
var appFolder, testsFolder;
appFolder = path.resolve(app.project.root, app.trees.app._directoryPath);
testsFolder = path.resolve(app.project.root, app.trees.tests._directoryPath);
var optionsForLeasot = {
enabled: true
};
var optionsThatCanBeOverridden = ['enabled', 'kinds', 'extensions', 'groupBy', 'console'];
if (typeof(app.options.markers) !== 'undefined') {
forOwnFn(app.options.markers, function(value, key) {
if (optionsThatCanBeOverridden.indexOf(key) !== -1) {
optionsForLeasot[key] = value;
} else {
console.log('\n' + chalk.bgRed(key + ' is an unknown option for broccoli-leasot'));
}
});
}
console.log('\n');
new BroccoliBuilder(
new BroccoliLeasotFilter(
appFolder,
optionsForLeasot,
'app'
)
).build();
new BroccoliBuilder(
new BroccoliLeasotFilter(
testsFolder,
optionsForLeasot,
'tests'
)
).build()
}
};