Work with cs-compound

This commit is contained in:
Anatoliy Chakkaev 2013-01-22 23:27:49 +07:00
parent a770f20c08
commit 8cfa00a1b2
2 changed files with 13 additions and 5 deletions

View File

@ -4,7 +4,12 @@ var path = require('path');
exports.Schema = require('./lib/schema').Schema; exports.Schema = require('./lib/schema').Schema;
exports.AbstractClass = require('./lib/abstract-class').AbstractClass; exports.AbstractClass = require('./lib/abstract-class').AbstractClass;
exports.Validatable = require('./lib/validatable').Validatable; exports.Validatable = require('./lib/validatable').Validatable;
exports.BaseSQL = require('./lib/sql');
var baseSQL = './lib/sql';
exports.__defineGetter__('BaseSQL', function () {
return require(baseSQL);
});
exports.init = function (rw) { exports.init = function (rw) {
if (global.railway) { if (global.railway) {
@ -12,7 +17,8 @@ exports.init = function (rw) {
} else { } else {
rw.orm = {Schema: exports.Schema, AbstractClass: exports.AbstractClass}; rw.orm = {Schema: exports.Schema, AbstractClass: exports.AbstractClass};
} }
require('./lib/railway')(rw); var railway = './lib/railway';
require(railway)(rw);
}; };
try { try {
@ -23,5 +29,7 @@ try {
} }
} catch (e) {} } catch (e) {}
exports.test = require('./test/common_test'); var commonTest = './test/common_test';
exports.__defineGetter__('test', function () {
return require(commonTest);
});

View File

@ -11,7 +11,7 @@ if (global.railway) {
module.exports = function init(root) { module.exports = function init(root) {
var railway, app, models; var railway, app, models;
if (typeof root !== 'object' || root.constructor.name !== 'Compound') { if (typeof root !== 'object' || (root.constructor.name !== 'Compound' && root.constructor.name !== 'CompoundServer')) {
railway = global.railway; railway = global.railway;
app = global.app; app = global.app;
models = app.models; models = app.models;