ifnode
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -200,5 +200,12 @@ var path = require('path'), | ||
db = this._config.db, | ||
app_schemas = this._schemas = {}; | ||
app_schemas = this._schemas = {}, | ||
Object.keys(db).forEach(function(db_connection_name) { | ||
db_connections_names = Object.keys(db); | ||
if(!db_connections_names.length) { | ||
return; | ||
} | ||
self._default_creator = db_connections_names[0]; | ||
db_connections_names.forEach(function(db_connection_name) { | ||
var db_config = db[db_connection_name]; | ||
@@ -286,3 +293,3 @@ | ||
if(typeof component.initialize === 'function') { | ||
component.initialize(); | ||
component.initialize(component.config); | ||
}; | ||
@@ -330,3 +337,3 @@ | ||
} | ||
if(local_config.host !== 'localhost') { | ||
if(!_.contains(['127.0.0.1', 'localhost'], local_config.host)) { | ||
server_params.push(local_config.host); | ||
@@ -354,3 +361,3 @@ } | ||
this._ifnode_core_folder = __dirname; | ||
this._project_folder = app_config.project_folder || path.resolve(this._ifnode_core_folder, '../../../'); | ||
this._project_folder = app_config.project_folder || path.dirname(process.argv[1]); | ||
this._backend_folder = path.resolve(this._project_folder, 'protected/'); | ||
@@ -357,0 +364,0 @@ |
@@ -46,2 +46,6 @@ var _ = require('underscore'), | ||
generate_url = function(pathname) { | ||
if(pathname[0] !== '/') { | ||
pathname = '/' + pathname; | ||
} | ||
return this.origin + pathname; | ||
@@ -48,0 +52,0 @@ }, |
@@ -0,0 +0,0 @@ var _ = require('underscore'), |
@@ -24,3 +24,4 @@ var drivers = {}, | ||
mongoose: require('./mongoose'), | ||
knex: require('./knex') | ||
knex: require('./knex'), | ||
redis: require('./redis') | ||
}; | ||
@@ -27,0 +28,0 @@ }, |
@@ -7,9 +7,10 @@ var Schema = function(model_config) { | ||
this.table = model_config.table; | ||
// this._columns = model_config.columns; | ||
// this._config = model_config; | ||
this.init(model_config); | ||
}; | ||
Schema.fn = Schema.prototype; | ||
Schema.fn = Schema.prototype; | ||
Schema.connect_driver = function(db_config) { | ||
var knex = require('knex')(db_config); | ||
Schema.fn._driver = knex; | ||
}; | ||
Schema.fn.init = function() { | ||
@@ -20,13 +21,3 @@ this.driver = Schema.fn._driver; | ||
} | ||
// this._schema = this._driver.Schema(this._columns); | ||
// this.statics = this._schema.statics = {}; | ||
// this.methods = this._schema.methods = {}; | ||
}; | ||
Schema.connect_driver = function(db_config) { | ||
var knex = require('knex')(db_config); | ||
Schema.fn._driver = knex; | ||
}; | ||
Schema.fn.compile = function() { | ||
@@ -33,0 +24,0 @@ this._model = this; |
@@ -1,16 +0,32 @@ | ||
var _ = require('underscore'); | ||
var _ = require('underscore'), | ||
var Schema = function(model_config) { | ||
if(!(this instanceof Schema)) { | ||
return new Schema(model_config); | ||
} | ||
Schema = function(model_config) { | ||
if(!(this instanceof Schema)) { | ||
return new Schema(model_config); | ||
} | ||
this._model_config = model_config; | ||
this._model_config = model_config; | ||
this.table = model_config.table; | ||
this._columns = model_config.columns || {}; | ||
this._schema_config = _.extend(this._default_schema_config, model_config.config || {}); | ||
this.init(model_config); | ||
this.table = model_config.table; | ||
this._columns = model_config.columns || {}; | ||
this._schema_config = _.extend(this._default_schema_config, model_config.config || {}); | ||
this.init(model_config); | ||
}; | ||
Schema.fn = Schema.prototype; | ||
Schema.connect_driver = function(db_config) { | ||
var mongoose = require('mongoose'); | ||
mongoose.connect(db_config.url); | ||
Schema.fn._driver = mongoose; | ||
} | ||
Schema.fn.init = function() { | ||
this._initialize_schema(); | ||
this.statics = this._schema.statics = {}; | ||
this.methods = this._schema.methods = {}; | ||
}; | ||
Schema.fn = Schema.prototype; | ||
Schema.fn.compile = function() { | ||
this._model = this._driver.model(this.table, this._schema); | ||
}; | ||
Schema.fn._default_schema_config = { | ||
@@ -39,7 +55,2 @@ id: false, | ||
}; | ||
Schema.fn.init = function() { | ||
this._initialize_schema(); | ||
this.statics = this._schema.statics = {}; | ||
this.methods = this._schema.methods = {}; | ||
}; | ||
Schema.fn.get_original_schema = function() { | ||
@@ -58,12 +69,2 @@ return this._schema; | ||
Schema.connect_driver = function(db_config) { | ||
var mongoose = require('mongoose'); | ||
mongoose.connect(db_config.url); | ||
Schema.fn._driver = mongoose; | ||
} | ||
Schema.fn.compile = function() { | ||
this._model = this._driver.model(this.table, this._schema); | ||
}; | ||
module.exports = function(db_config) { | ||
@@ -70,0 +71,0 @@ Schema.connect_driver(db_config); |
{ | ||
"name": "ifnode", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Node.js MVC Framework", | ||
@@ -38,2 +38,3 @@ "main": "index.js", | ||
"redis": "latest", | ||
"knex": "latest", | ||
@@ -40,0 +41,0 @@ "mongoose": "latest", |
## ifnode | ||
Best MVC Framework for Node.JS :-^) |
Sorry, the diff of this file is not supported yet
1239
46164
23
23
+ Addedredis@latest
+ Added@redis/bloom@1.2.0(transitive)
+ Added@redis/client@1.5.16(transitive)
+ Added@redis/graph@1.1.1(transitive)
+ Added@redis/json@1.0.6(transitive)
+ Added@redis/search@1.1.6(transitive)
+ Added@redis/time-series@1.0.5(transitive)
+ Addedcluster-key-slot@1.1.2(transitive)
+ Addedgeneric-pool@3.9.0(transitive)
+ Addedredis@4.6.14(transitive)
+ Addedyallist@4.0.0(transitive)