-
Notifications
You must be signed in to change notification settings - Fork 49
/
index.js
45 lines (35 loc) · 1.08 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
39
40
41
42
43
44
45
'use strict';
var path = require('path');
var chalk = require('chalk');
var checker = require('ember-cli-version-checker');
var defaults = require('lodash').defaults;
var CoffeePreprocessor = require('./lib/coffee-preprocessor');
module.exports = {
name: 'Ember CLI Coffeescript Addon',
shouldSetupRegistryInIncluded: function() {
return !checker.isAbove(this, '0.2.0');
},
getConfig: function() {
var brocfileConfig = {};
var coffeeOptions = defaults(this.project.config(process.env.EMBER_ENV).coffeeOptions || {},
brocfileConfig, {
blueprints: true
});
return coffeeOptions;
},
blueprintsPath: function() {
if (this.getConfig().blueprints) {
return path.join(__dirname, 'blueprints');
}
},
setupPreprocessorRegistry: function(type, registry) {
var plugin = new CoffeePreprocessor(this.getConfig());
registry.add('js', plugin);
},
included: function(app) {
this.app = app;
if (this.shouldSetupRegistryInIncluded()) {
this.setupPreprocessorRegistry('parent', app.registry);
}
}
};