2012-01-26 09:36:14 +00:00
|
|
|
var fs = require('fs');
|
2012-03-27 14:22:24 +00:00
|
|
|
var path = require('path');
|
2012-01-26 09:36:14 +00:00
|
|
|
|
2011-10-10 13:22:51 +00:00
|
|
|
exports.Schema = require('./lib/schema').Schema;
|
|
|
|
exports.AbstractClass = require('./lib/abstract-class').AbstractClass;
|
|
|
|
exports.Validatable = require('./lib/validatable').Validatable;
|
2012-12-14 13:12:13 +00:00
|
|
|
exports.BaseSQL = require('./lib/sql');
|
2012-01-10 13:26:24 +00:00
|
|
|
|
2012-10-28 23:21:51 +00:00
|
|
|
exports.init = function (rw) {
|
2012-11-03 02:33:03 +00:00
|
|
|
if (typeof rw === 'string') {
|
2012-10-28 23:21:51 +00:00
|
|
|
railway.orm = exports;
|
|
|
|
} else {
|
|
|
|
rw.orm = {Schema: exports.Schema, AbstractClass: exports.AbstractClass};
|
|
|
|
}
|
|
|
|
require('./lib/railway')(rw);
|
2012-03-27 14:22:24 +00:00
|
|
|
};
|
|
|
|
|
2012-01-14 08:24:24 +00:00
|
|
|
try {
|
2012-03-27 14:22:24 +00:00
|
|
|
if (process.versions.node < '0.6') {
|
2012-01-26 09:36:14 +00:00
|
|
|
exports.version = JSON.parse(fs.readFileSync(__dirname + '/package.json')).version;
|
2012-01-20 09:01:24 +00:00
|
|
|
} else {
|
|
|
|
exports.version = require('../package').version;
|
|
|
|
}
|
2012-01-26 09:36:14 +00:00
|
|
|
} catch (e) {}
|
2012-04-18 23:20:44 +00:00
|
|
|
|
2012-12-13 21:50:02 +00:00
|
|
|
exports.test = require('./test/common_test');
|
|
|
|
|