mirror of https://gitee.com/bigwinds/arangodb
Bugfixing
This commit is contained in:
parent
51f3c853ad
commit
d3987063a5
|
@ -55,7 +55,7 @@ controller.post("/generate", function(req, res) {
|
||||||
var conf = req.params("configuration");
|
var conf = req.params("configuration");
|
||||||
conf.set("applicationContext", applicationContext);
|
conf.set("applicationContext", applicationContext);
|
||||||
conf.set("path", path);
|
conf.set("path", path);
|
||||||
templateEngine = new TemplateEngine(Configuration.forDB());
|
templateEngine = new TemplateEngine(conf.forDB());
|
||||||
|
|
||||||
templateEngine.write();
|
templateEngine.write();
|
||||||
}).bodyParam("configuration", {
|
}).bodyParam("configuration", {
|
||||||
|
|
|
@ -53,15 +53,30 @@
|
||||||
|
|
||||||
_.each(collectionNames, function (collectionName) {
|
_.each(collectionNames, function (collectionName) {
|
||||||
var modelName = i.singularize(collectionName),
|
var modelName = i.singularize(collectionName),
|
||||||
repositoryPath = 'repositories/' + collectionName + '.js',
|
collectionStart,
|
||||||
modelPath = 'models/' + modelName + '.js';
|
repositoryBase = collectionName.substr(1),
|
||||||
|
repositoryName,
|
||||||
|
repositoryPath,
|
||||||
|
repositoryInstance,
|
||||||
|
modelPath;
|
||||||
|
collectionStart = collectionName.charAt(0);
|
||||||
|
if (collectionStart.match("[a-zA-Z]") === null) {
|
||||||
|
throw "Collection Name has to start with a letter";
|
||||||
|
}
|
||||||
|
if (modelName === collectionName) {
|
||||||
|
repositoryBase += "_repo";
|
||||||
|
}
|
||||||
|
repositoryName = collectionStart.toUpperCase() + repositoryBase;
|
||||||
|
repositoryInstance = collectionStart.toLowerCase() + repositoryBase;
|
||||||
|
repositoryPath = 'repositories/' + collectionName;
|
||||||
|
modelPath = 'models/' + modelName;
|
||||||
|
|
||||||
this.collectionNames.push(collectionName);
|
this.collectionNames.push(collectionName);
|
||||||
this.controllers.push({
|
this.controllers.push({
|
||||||
url: '/' + collectionName,
|
url: '/' + collectionName,
|
||||||
path: 'controllers/' + collectionName + '.js',
|
path: 'controllers/' + collectionName + '.js',
|
||||||
repositoryInstance: collectionName,
|
repositoryInstance: repositoryName,
|
||||||
repository: i.titleize(collectionName),
|
repository: repositoryInstance,
|
||||||
repositoryPath: repositoryPath,
|
repositoryPath: repositoryPath,
|
||||||
model: i.titleize(modelName),
|
model: i.titleize(modelName),
|
||||||
modelPath: modelPath,
|
modelPath: modelPath,
|
||||||
|
@ -69,10 +84,10 @@
|
||||||
collectionName: collectionName
|
collectionName: collectionName
|
||||||
});
|
});
|
||||||
this.repositories.push({
|
this.repositories.push({
|
||||||
path: repositoryPath
|
path: repositoryPath + '.js'
|
||||||
});
|
});
|
||||||
this.models.push({
|
this.models.push({
|
||||||
path: modelPath
|
path: modelPath + '.js'
|
||||||
});
|
});
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
@ -90,8 +105,8 @@
|
||||||
|
|
||||||
controllers: {},
|
controllers: {},
|
||||||
|
|
||||||
setup: "",
|
// setup: "",
|
||||||
teardown: ""
|
// teardown: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
_.each(this.controllers, function (controller) {
|
_.each(this.controllers, function (controller) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<%= model %> = require('<%= modelPath %>').Model,
|
<%= model %> = require('<%= modelPath %>').Model,
|
||||||
_ = require('underscore'),
|
_ = require('underscore'),
|
||||||
controller,
|
controller,
|
||||||
todos;
|
<%= repositoryInstance %>;
|
||||||
|
|
||||||
controller = new Foxx.Controller(applicationContext);
|
controller = new Foxx.Controller(applicationContext);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue