-
Notifications
You must be signed in to change notification settings - Fork 49
/
index.js
49 lines (37 loc) · 1.17 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
46
47
48
49
/* jshint node: true */
'use strict';
var path = require('path');
var chalk = require('chalk');
var defaults = require('lodash.defaults');
var VersionChecker = require('ember-cli-version-checker');
var CoffeePreprocessor = require('./lib/coffee-preprocessor');
module.exports = {
name: 'Ember CLI Coffeescript Addon',
shouldSetupRegistryInIncluded: function() {
var checker = new VersionChecker(this);
return !checker.for('ember-cli', 'npm').isAbove('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);
}
}
};