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.path = opts.path;
|
||||
this.name = opts.name;
|
||||
this.collectionNames = opts.collectionNames;
|
||||
this.authenticated = opts.authenticated;
|
||||
this.author = opts.author;
|
||||
this.description = opts.description;
|
||||
this.license = opts.license;
|
||||
this.determineFromCollectionNames(opts.collectionNames);
|
||||
this._path = this.applicationContext.foxxFilename("templates");
|
||||
this.folder = fs.join(this.path, this.name);
|
||||
};
|
||||
|
@ -21,7 +21,6 @@
|
|||
_.extend(Engine.prototype, {
|
||||
write: function() {
|
||||
fs.makeDirectory(this.folder);
|
||||
|
||||
fs.write(fs.join(this.folder, "manifest.json"), this.buildManifest());
|
||||
},
|
||||
|
||||
|
@ -29,6 +28,19 @@
|
|||
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() {
|
||||
var manifest = this.template("manifest.json.tmpl");
|
||||
|
||||
|
@ -36,7 +48,8 @@
|
|||
name: this.name,
|
||||
description: this.description,
|
||||
author: this.author,
|
||||
license: this.license
|
||||
license: this.license,
|
||||
controllers: this.controllers
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
],
|
||||
|
||||
"controllers": {
|
||||
<% _.each(controllers, function (controller) { %>
|
||||
"<%= controller.url %>": "<%= controller.path %>",
|
||||
<% }); %>
|
||||
},
|
||||
|
||||
"setup": "",
|
||||
|
|
Loading…
Reference in New Issue