Remove node modules from ignore, removie configure middleware

This commit is contained in:
Ritchie Martori 2013-06-07 13:12:46 -07:00
parent 7d0858b22e
commit bcef4c88cf
6 changed files with 6 additions and 91 deletions

10
.gitignore vendored
View File

@ -9,12 +9,4 @@
*.pid
*.swp
*.swo
/node_modules/*/node_modules
/node_modules/debug
/node_modules/express
/node_modules/jugglingdb*
/node_modules/mocha
/node_modules/sl-module-loader
/node_modules/sl-remoting
/node_modules/merge
/node_modules/inflection
node_modules

View File

@ -1,5 +1,5 @@
# asteroid
v0.0.1
v0.7.0
## Install

View File

@ -2,8 +2,7 @@
* Module dependencies.
*/
var Model = require('../node_modules/model/lib/model')
, DataSource = require('jugglingdb').DataSource
var DataSource = require('jugglingdb').DataSource
, ModelBuilder = require('jugglingdb').ModelBuilder
, assert = require('assert')
, RemoteObjects = require('sl-remoting')

View File

@ -1,67 +0,0 @@
/**
* Module dependencies.
*/
var ModuleLoader = require('sl-module-loader')
, path = require('path');
/**
* Export the middleware.
*/
module.exports = configure;
/**
* Load application modules based on the current directories configuration files.
*/
function configure(root) {
var moduleLoader = configure.createModuleLoader(root);
var app = this;
process.__asteroidCache = {};
return function configureMiddleware(req, res, next) {
var modules = req.modules = res.modules = moduleLoader;
moduleLoader.load(function (err) {
if(err) {
next(err);
} else {
var models = modules.instanceOf('ModelConfiguration');
var dataSources = modules.instanceOf('DataSource');
// define models from config
models.forEach(function (model) {
app.models[model.options.name] = model.ModelCtor;
});
// define data sources from config
dataSources.forEach(function (dataSource) {
app.dataSources[dataSources.options.name] = dataSource;
});
next();
}
});
}
}
configure.createModuleLoader = function (root) {
var options = {
alias: BUNDLED_MODULE_ALIAS
};
return ModuleLoader.create(root || '.', options);
};
/**
* Turn asteroid bundled deps into aliases for the module loader
*/
var BUNDLED_MODULE_ALIAS = require('../../package.json')
.bundleDependencies
.reduce(function (prev, cur) {
prev[cur] = path.join('asteroid', 'node_modules', cur);
return prev;
}, {});

View File

@ -1,7 +1,7 @@
{
"name": "asteroid",
"description": "asteroid",
"version": "0.0.1",
"version": "0.7.0",
"scripts": {
"test": "mocha -R spec"
},
@ -10,21 +10,12 @@
"express": "~3.1.1",
"jugglingdb": "git+ssh://git@github.com:strongloop/jugglingdb.git",
"merge": "~1.1.0",
"sl-module-loader": "git+ssh://git@github.com:strongloop/sl-module-loader.git",
"sl-remoting": "git+ssh://git@github.com:strongloop/sl-remoting.git",
"inflection": "~1.2.5"
},
"devDependencies": {
"mocha": "latest"
},
"bundleDependencies": [
"asteroid-module",
"data-source",
"model",
"model-route",
"oracle-data-source",
"route"
],
"optionalDependencies": {
"jugglingdb-oracle": "git+ssh://git@github.com:strongloop/jugglingdb-oracle.git"
}

View File

@ -9,5 +9,5 @@ memoryConnector = require('asteroid-memory');
beforeEach(function () {
app = asteroid();
EmptyModel = asteroid.createModel();
memory = asteroid.createDataSource({connector: memoryConnector});
})
memoryDataSource = asteroid.createDataSource({connector: memoryConnector});
});