1
0
Fork 0

Bugfixing

This commit is contained in:
Lucas Dohmen 2014-12-14 11:43:07 +01:00 committed by Michael Hackstein
parent 51f3c853ad
commit d3987063a5
3 changed files with 25 additions and 10 deletions

View File

@ -55,7 +55,7 @@ controller.post("/generate", function(req, res) {
var conf = req.params("configuration");
conf.set("applicationContext", applicationContext);
conf.set("path", path);
templateEngine = new TemplateEngine(Configuration.forDB());
templateEngine = new TemplateEngine(conf.forDB());
templateEngine.write();
}).bodyParam("configuration", {

View File

@ -53,15 +53,30 @@
_.each(collectionNames, function (collectionName) {
var modelName = i.singularize(collectionName),
repositoryPath = 'repositories/' + collectionName + '.js',
modelPath = 'models/' + modelName + '.js';
collectionStart,
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.controllers.push({
url: '/' + collectionName,
path: 'controllers/' + collectionName + '.js',
repositoryInstance: collectionName,
repository: i.titleize(collectionName),
repositoryInstance: repositoryName,
repository: repositoryInstance,
repositoryPath: repositoryPath,
model: i.titleize(modelName),
modelPath: modelPath,
@ -69,10 +84,10 @@
collectionName: collectionName
});
this.repositories.push({
path: repositoryPath
path: repositoryPath + '.js'
});
this.models.push({
path: modelPath
path: modelPath + '.js'
});
}, this);
},
@ -90,8 +105,8 @@
controllers: {},
setup: "",
teardown: ""
// setup: "",
// teardown: ""
};
_.each(this.controllers, function (controller) {

View File

@ -6,7 +6,7 @@
<%= model %> = require('<%= modelPath %>').Model,
_ = require('underscore'),
controller,
todos;
<%= repositoryInstance %>;
controller = new Foxx.Controller(applicationContext);