-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
53 lines (40 loc) · 1.43 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
50
51
52
53
'use strict';
var commands = require('./lib/commands');
var getNetworkIp = require('./lib/utils/get-network-ip');
var cordovaPath = require('./lib/utils/cordova-path');
var cordovaAssets = require('./lib/utils/cordova-assets');
var mergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');
module.exports = {
name: 'ember-cordova',
contentFor: function(type) {
if (this.project.targetIsCordova && type === 'body') {
return '<script src="cordova.js"></script>';
}
},
includedCommands: function() {
return commands;
},
_mergeTrees: function(trees) {
return mergeTrees(trees);
},
//In Livereload scenarios, we need to manually include cordova assets
cordovaAssetTree: function(tree) {
var platform = this.project.CORDOVA_PLATFORM;
var projectPath = cordovaPath(this.project);
var assets = cordovaAssets.getPaths(platform, projectPath);
cordovaAssets.validatePaths(assets.assetsPath, projectPath);
var pluginsTree = new Funnel('ember-cordova/cordova', {
srcDir: assets.assetsPath,
include: assets.files
});
return this._mergeTrees([tree, pluginsTree]);
},
treeForPublic: function() {
var tree = this._super.treeForPublic.apply(this, arguments);
if (this.project.targetIsCordovaLivereload) {
return this.cordovaAssetTree(tree);
}
return tree;
}
};