diff --git a/.gitignore b/.gitignore index 3df69e46..e2f7cef8 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md index 1d32bc7d..35edf2bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # asteroid -v0.0.1 +v0.7.0 ## Install diff --git a/lib/application.js b/lib/application.js index ceaa3350..9e0f108f 100644 --- a/lib/application.js +++ b/lib/application.js @@ -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') diff --git a/lib/middleware/configure.js b/lib/middleware/configure.js deleted file mode 100644 index 1c2c7d1c..00000000 --- a/lib/middleware/configure.js +++ /dev/null @@ -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; - }, {}); - diff --git a/package.json b/package.json index baf679c3..3948faf5 100644 --- a/package.json +++ b/package.json @@ -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" } diff --git a/test/support.js b/test/support.js index f24f62da..5559fe10 100644 --- a/test/support.js +++ b/test/support.js @@ -9,5 +9,5 @@ memoryConnector = require('asteroid-memory'); beforeEach(function () { app = asteroid(); EmptyModel = asteroid.createModel(); - memory = asteroid.createDataSource({connector: memoryConnector}); -}) \ No newline at end of file + memoryDataSource = asteroid.createDataSource({connector: memoryConnector}); +}); \ No newline at end of file