mirror of https://gitee.com/bigwinds/arangodb
Add paths to the manifest
This commit is contained in:
parent
7f20de5f41
commit
0ad5395d53
|
@ -9,11 +9,11 @@
|
||||||
this.applicationContext = opts.applicationContext;
|
this.applicationContext = opts.applicationContext;
|
||||||
this.path = opts.path;
|
this.path = opts.path;
|
||||||
this.name = opts.name;
|
this.name = opts.name;
|
||||||
this.collectionNames = opts.collectionNames;
|
|
||||||
this.authenticated = opts.authenticated;
|
this.authenticated = opts.authenticated;
|
||||||
this.author = opts.author;
|
this.author = opts.author;
|
||||||
this.description = opts.description;
|
this.description = opts.description;
|
||||||
this.license = opts.license;
|
this.license = opts.license;
|
||||||
|
this.determineFromCollectionNames(opts.collectionNames);
|
||||||
this._path = this.applicationContext.foxxFilename("templates");
|
this._path = this.applicationContext.foxxFilename("templates");
|
||||||
this.folder = fs.join(this.path, this.name);
|
this.folder = fs.join(this.path, this.name);
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,6 @@
|
||||||
_.extend(Engine.prototype, {
|
_.extend(Engine.prototype, {
|
||||||
write: function() {
|
write: function() {
|
||||||
fs.makeDirectory(this.folder);
|
fs.makeDirectory(this.folder);
|
||||||
|
|
||||||
fs.write(fs.join(this.folder, "manifest.json"), this.buildManifest());
|
fs.write(fs.join(this.folder, "manifest.json"), this.buildManifest());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -29,6 +28,19 @@
|
||||||
return _.template(fs.read(fs.join(this._path, name)));
|
return _.template(fs.read(fs.join(this._path, name)));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
determineFromCollectionNames: function (collectionNames) {
|
||||||
|
this.collectionNames = [];
|
||||||
|
this.controllers = [];
|
||||||
|
|
||||||
|
_.each(collectionNames, function (collectionName) {
|
||||||
|
this.collectionNames.push(collectionName);
|
||||||
|
this.controllers.push({
|
||||||
|
url: '/' + collectionName,
|
||||||
|
path: 'controllers/' + collectionName + '.js'
|
||||||
|
});
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
buildManifest: function() {
|
buildManifest: function() {
|
||||||
var manifest = this.template("manifest.json.tmpl");
|
var manifest = this.template("manifest.json.tmpl");
|
||||||
|
|
||||||
|
@ -36,7 +48,8 @@
|
||||||
name: this.name,
|
name: this.name,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
author: this.author,
|
author: this.author,
|
||||||
license: this.license
|
license: this.license,
|
||||||
|
controllers: this.controllers
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"controllers": {
|
"controllers": {
|
||||||
|
<% _.each(controllers, function (controller) { %>
|
||||||
|
"<%= controller.url %>": "<%= controller.path %>",
|
||||||
|
<% }); %>
|
||||||
},
|
},
|
||||||
|
|
||||||
"setup": "",
|
"setup": "",
|
||||||
|
|
Loading…
Reference in New Issue