forked from 1602/jugglingdb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
42 lines (34 loc) · 1015 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var fs = require('fs');
var path = require('path');
exports.Schema = require('./lib/schema').Schema;
exports.AbstractClass = require('./lib/model.js');
var baseSQL = './lib/sql';
exports.__defineGetter__('BaseSQL', function () {
return require(baseSQL);
});
exports.init = function (rw) {
if (global.railway) {
global.railway.orm = exports;
} else {
rw.orm = {Schema: exports.Schema, AbstractClass: exports.AbstractClass};
}
var railway = './lib/railway';
if (rw.version > '1.1.5-15') {
rw.on('after routes', initialize);
} else {
initialize();
}
function initialize() {
try {
var init = require(railway);
} catch (e) {}
if (init) init(rw);
}
};
exports.__defineGetter__('version', function () {
return JSON.parse(fs.readFileSync(__dirname + '/package.json')).version;
});
var commonTest = './test/common_test';
exports.__defineGetter__('test', function () {
return require(commonTest);
});