Permalink
Browse files

Got generators working.

  • Loading branch information...
1 parent edf26c7 commit 9e1fe0461e6bfb14540aad3b3d4e5a85c683f5d0 mde committed Aug 17, 2012
Showing with 141 additions and 181 deletions.
  1. +6 −2 bin/cli.js
  2. +3 −0 lib/app.js
  3. +3 −6 lib/init/model.js
  4. +128 −116 templates/Jakefile
  5. +1 −1 templates/resource/model.ejs
  6. +0 −56 templates/scaffold/model.ejs
View
@@ -144,9 +144,13 @@ if(cmds.length) {
// Add Jake argument based on commands
switch(cmds[0]) {
case 'db:init':
- // Generating application
+ // Create DBs
cmd += '"db:init"';
break;
+ case 'db:createTable':
+ // Create DBs
+ cmd += '"db:createTable[' + cmds[1] + ']"';
+ break;
case 'app':
// Generating application
cmd += '"gen:app[' + cmds[1] + engineCmd + ']"';
@@ -175,7 +179,7 @@ if(cmds.length) {
die(cmds[0] + ' is not a Geddy command.');
}
- //cmd += ' --quiet';
+ cmd += ' --quiet';
exec(cmd, function(err, stdout, stderr) {
if(err) {
throw err;
View
@@ -48,6 +48,9 @@ geddy.model = model;
geddy.utils = utils;
geddy.errors = errors;
+// Use Geddy logger as the utility logger
+utils.log.registerLogger(geddy.log);
+
var App = function () {
var JSPAT = /\.(js|coffee)$/;
View
@@ -44,9 +44,6 @@ module.exports = new (function () {
, appAdaptersPath = path.join(cwd, modelDir, 'adapters')
, ctors;
- // FIXME: Do this in app.js
- utils.log.registerLogger(geddy.log);
-
// May be running totally model-less
if (!utils.file.existsSync(path.join(cwd, modelDir))) {
return callback();
@@ -70,7 +67,7 @@ module.exports = new (function () {
// If the model doesn't exist, something is fucked up
if (!model[name]) {
- throw new Error('Model ' + m.ctorName + ' did not get registered properly.');
+ throw new Error('Model ' + name + ' did not get registered properly.');
}
adapterName = model[name].adapter;
@@ -102,8 +99,8 @@ module.exports = new (function () {
// No adapter, log an error
if (!adapterPath) {
- geddy.log.error('Adapter not found for ' + name +
- '. Make sure your adapter is in app/models/adapters');
+ geddy.log.error('Model adapter not found for ' + name +
+ '.\nSet .adapter for this model, or set model.defaultAdapter.');
}
else {
adapter = model.loadedAdapters[adapterName];
Oops, something went wrong.

0 comments on commit 9e1fe04

Please sign in to comment.