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 *.pid
*.swp *.swp
*.swo *.swo
/node_modules/*/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

View File

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

View File

@ -2,8 +2,7 @@
* Module dependencies. * Module dependencies.
*/ */
var Model = require('../node_modules/model/lib/model') var DataSource = require('jugglingdb').DataSource
, DataSource = require('jugglingdb').DataSource
, ModelBuilder = require('jugglingdb').ModelBuilder , ModelBuilder = require('jugglingdb').ModelBuilder
, assert = require('assert') , assert = require('assert')
, RemoteObjects = require('sl-remoting') , 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", "name": "asteroid",
"description": "asteroid", "description": "asteroid",
"version": "0.0.1", "version": "0.7.0",
"scripts": { "scripts": {
"test": "mocha -R spec" "test": "mocha -R spec"
}, },
@ -10,21 +10,12 @@
"express": "~3.1.1", "express": "~3.1.1",
"jugglingdb": "git+ssh://git@github.com:strongloop/jugglingdb.git", "jugglingdb": "git+ssh://git@github.com:strongloop/jugglingdb.git",
"merge": "~1.1.0", "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", "sl-remoting": "git+ssh://git@github.com:strongloop/sl-remoting.git",
"inflection": "~1.2.5" "inflection": "~1.2.5"
}, },
"devDependencies": { "devDependencies": {
"mocha": "latest" "mocha": "latest"
}, },
"bundleDependencies": [
"asteroid-module",
"data-source",
"model",
"model-route",
"oracle-data-source",
"route"
],
"optionalDependencies": { "optionalDependencies": {
"jugglingdb-oracle": "git+ssh://git@github.com:strongloop/jugglingdb-oracle.git" "jugglingdb-oracle": "git+ssh://git@github.com:strongloop/jugglingdb-oracle.git"
} }

View File

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