Permalink
Browse files

Merge pull request #174 from kaero/master

removed deprecated ormDriver function from generators code
  • Loading branch information...
1602 committed Jun 4, 2012
2 parents d5804ab + a784a65 commit e88323ddd6b3a085d3d26c209d49b038f7cdfea2
Showing with 5 additions and 17 deletions.
  1. +5 −17 lib/generators.js
View
@@ -203,7 +203,7 @@ exports.list = function () {
}
var fileExtension = options.coffee ? '.coffee' : '.js';
var Model = model[0].toUpperCase() + model.slice(1);
- var attrs = [], result = [], driver = ormDriver();
+ var attrs = [], result = [];
options.forEach(function (arg) {
var property = arg.split(':')[0],
plainType = arg.split(':')[1],
@@ -331,7 +331,6 @@ exports.list = function () {
* @api public
*/
function crudGenerator(args) {
- var driver = ormDriver();
var model = args[0].split('.').pop();
var parents = args[0].split('.').slice(0, -1);
var models = pluralize(model).toLowerCase();
@@ -351,7 +350,7 @@ exports.list = function () {
var result = modelGenerator.apply(this, Array.prototype.slice.call(arguments));
var fileExtension = options.coffee ? '.coffee' : '.js';
- createFile('app/controllers/' + models + '_controller' + fileExtension, controllerCode(args[0], driver, result));
+ createFile('app/controllers/' + models + '_controller' + fileExtension, controllerCode(args[0], result));
createDir('app/helpers/');
createParents(ns, 'app/helpers/');
@@ -421,7 +420,7 @@ exports.list = function () {
* Get controller code
* @private
*/
- function controllerCode(model, driver, result) {
+ function controllerCode(model, result) {
var fileExtension = options.coffee ? '.coffee' : '.js';
var code;
var parents = model.split('.').slice(0, -1);
@@ -690,26 +689,15 @@ exports.list = function () {
catch(e) {}
});
if (config != null) return config;
- throw new Error( sys.format('Can not find configuration file by path template"%s"', filename) );
+ throw new Error( sys.format('Can not find configuration file by path template "%s"', filename) );
break;
case 'json':
- return JSON.parse(require('fs').readFileSync(filename, 'utf8'));
+ return JSON.parse(fs.readFileSync(filename, 'utf8'));
case 'yml':
return require(filename).shift();
default:
throw new Error( sys.format('Unknown configuration file name extension "%s"', filenameExt) );
}
};
- /**
- * Return default ORM driver, based on config/database.json
- * @deprecated
- */
- function ormDriver() {
- if (!ormDriver.config) {
- ormDriver.config = loadConfig(process.cwd() + '/config/database.~').development;
- }
- return ormDriver.config.driver;
- }
-
})();

0 comments on commit e88323d

Please sign in to comment.