forked from locks/ember-localstorage-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathember-addon-main.js
37 lines (29 loc) · 909 Bytes
/
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
'use strict';
var path = require('path');
var fs = require('fs');
module.exports = {
name: 'Ember Localstorage Adapter',
treeFor: function(name) {
if (name !== 'vendor') { return; }
var treePath = path.join(__dirname, '..', 'ember-localstorage-adapter');
var namespacedPath = path.join(treePath, 'ember-localstorage-adapter');
if(!fs.existsSync(namespacedPath)) {
fs.mkdirSync(namespacedPath);
}
fs.writeFileSync(
path.join(namespacedPath, 'localstorage_adapter.js'),
fs.readFileSync(path.join(treePath, 'localstorage_adapter.js'), {encoding: 'utf8'})
);
return unwatchedTree(treePath);
},
included: function(app){
this.app = app;
this.app.import('vendor/ember-localstorage-adapter/localstorage_adapter.js');
}
};
function unwatchedTree(dir) {
return {
read: function() { return dir; },
cleanup: function() { }
};
};