Update gitignore to allow node_modules

This commit is contained in:
Ritchie Martori 2013-04-09 11:33:29 -07:00
parent 2a0f68e434
commit cd8d679df0
27 changed files with 520 additions and 6 deletions

2
.gitignore vendored
View File

@ -1,3 +1,4 @@
.DS_Store .DS_Store
*.seed *.seed
*.log *.log
@ -7,4 +8,3 @@
*.pid *.pid
*.swp *.swp
*.swo *.swo
node_modules/

View File

@ -3,11 +3,14 @@ v0.0.1
## Install ## Install
slnode install asteroid slnode install asteroid -g
## Example ## Example
var Asteroid = require('asteroid'); var asteroid = require('asteroid');
var asteroid = Asteroid.create(); var app = asteroid();
asteroid.myMethod(); app.use(asteroid.configure());
app.use(asteroid.resources());
app.listen(3000);

1
node_modules/.bin/express generated vendored Symbolic link
View File

@ -0,0 +1 @@
../express/bin/express

10
node_modules/asteroid-module/.gitignore generated vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.swp
*.swo
node_modules/

13
node_modules/asteroid-module/README.md generated vendored Normal file
View File

@ -0,0 +1,13 @@
# asteroid-module
v0.0.1
## Install
slnode install asteroid-module
## Example
var AsteroidModule = require('asteroid-module');
var asteroidModule = AsteroidModule.create();
asteroidModule.myMethod();

12
node_modules/asteroid-module/example/example.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
/**
* A generated `AsteroidModule` example...
*
* Examples should show a working module api
* and be used in tests to continously check
* they function as expected.
*/
var AsteroidModule = require('../');
var asteroidModule = AsteroidModule.create();
asteroidModule.myMethod();

5
node_modules/asteroid-module/index.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
/**
* asteroid-module ~ public api
*/
module.exports = require('./lib/asteroid-module');

39
node_modules/asteroid-module/lib/asteroid-module.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
/**
* Expose `AsteroidModule`.
*/
module.exports = AsteroidModule;
/**
* Module dependencies.
*/
var Module = require('module-loader').Module
, debug = require('debug')('asteroid-module')
, util = require('util')
, inherits = util.inherits
, assert = require('assert');
/**
* Create a new `AsteroidModule` with the given `options`.
*
* @param {Object} options
* @return {AsteroidModule}
*/
function AsteroidModule(options) {
Module.apply(this, arguments);
// throw an error if args are not supplied
assert(typeof options === 'object', 'AsteroidModule requires an options object');
this.options = options;
debug('created with options', options);
}
/**
* Inherit from `Module`.
*/
inherits(AsteroidModule, Module);

14
node_modules/asteroid-module/package.json generated vendored Normal file
View File

@ -0,0 +1,14 @@
{
"name": "asteroid-module",
"description": "asteroid-module",
"version": "0.0.1",
"scripts": {
"test": "mocha"
},
"dependencies": {
"debug": "latest"
},
"devDependencies": {
"mocha": "latest"
}
}

View File

@ -0,0 +1,24 @@
var AsteroidModule = require('../');
describe('AsteroidModule', function(){
var asteroidModule;
beforeEach(function(){
asteroidModule = new AsteroidModule;
});
describe('.myMethod', function(){
// example sync test
it('should <description of behavior>', function() {
asteroidModule.myMethod();
});
// example async test
it('should <description of behavior>', function(done) {
setTimeout(function () {
asteroidModule.myMethod();
done();
}, 0);
});
});
});

5
node_modules/asteroid-module/test/support.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
/**
* asteroid-module test setup and support.
*/
assert = require('assert');

10
node_modules/collection/.gitignore generated vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.swp
*.swo
node_modules/

13
node_modules/collection/README.md generated vendored Normal file
View File

@ -0,0 +1,13 @@
# collection
v0.0.1
## Install
slnode install collection
## Example
var Collection = require('collection');
var collection = Collection.create();
collection.myMethod();

12
node_modules/collection/example/example.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
/**
* A generated `Collection` example...
*
* Examples should show a working module api
* and be used in tests to continously check
* they function as expected.
*/
var Collection = require('../');
var collection = Collection.create();
collection.myMethod();

5
node_modules/collection/index.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
/**
* collection ~ public api
*/
module.exports = require('./lib/collection');

105
node_modules/collection/lib/collection.js generated vendored Normal file
View File

@ -0,0 +1,105 @@
/**
* Expose `Collection`.
*/
module.exports = Collection;
/**
* Module dependencies.
*/
var Resource = require('resource').Resource
, debug = require('debug')('collection')
, util = require('util')
, inherits = util.inherits
, assert = require('assert');
/**
* Create a new `Collection` with the given `options`.
*
* @param {Object} options
* @return {Collection}
*/
function Collection(options) {
Resource.apply(this, arguments);
this.options = options;
// collection middleware
this.app.use(function (req, res, next) {
req.asyncEmit('request', next);
});
// setup http routes
// this.setupRoutes(this.app);
debug('created with options', options);
}
/**
* Inherit from `Resource`.
*/
inherits(Collection, Resource);
/**
* Dependencies.
*/
Collection.dependencies = {
'store': 'store'
}
Collection.prototype.setupRoutes = function (app) {
var store = this.store;
var done = this.done;
var Model = this.store;
var emit = this.asyncEmit;
// create
app.post('/', create);
app.post('/new', create);
function create(req, res, next) {
req.asyncEmit('create', function () {
var o = store.save(req.body, res.done);
});
}
// read
app.get('/:id', query);
app.get('/', query);
function query(req, res, next) {
var query = req.query;
query.where = query.where || {};
if(req.param('id')) {
query.where.id = req.param('id');
}
if(query.where.id) {
query.limit = 1;
}
req.asyncEmit('query', query, function () {
store.all(query, res.done);
});
}
// update
app.put('/:id', function (req, res) {
req.asyncEmit('update', req.body, function () {
store.updateAttributes(req.body, res.done);
});
});
// delete
app.destroy('/:id', function () {
var id = req.param('id');
req.asyncEmit('delete', id, function () {
store.destroy(id, res.done);
});
});
}

15
node_modules/collection/package.json generated vendored Normal file
View File

@ -0,0 +1,15 @@
{
"name": "collection",
"description": "collection",
"version": "0.0.1",
"scripts": {
"test": "mocha"
},
"dependencies": {
"debug": "latest",
"jugglingdb": "~0.2.0-29"
},
"devDependencies": {
"mocha": "latest"
}
}

24
node_modules/collection/test/collection.test.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var Collection = require('../');
describe('Collection', function(){
var collection;
beforeEach(function(){
collection = new Collection;
});
describe('.myMethod', function(){
// example sync test
it('should <description of behavior>', function() {
collection.myMethod();
});
// example async test
it('should <description of behavior>', function(done) {
setTimeout(function () {
collection.myMethod();
done();
}, 0);
});
});
});

5
node_modules/collection/test/support.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
/**
* collection test setup and support.
*/
assert = require('assert');

10
node_modules/resource/.gitignore generated vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.swp
*.swo
node_modules/

73
node_modules/resource/README.md generated vendored Normal file
View File

@ -0,0 +1,73 @@
# asteroid.Resource
## About
A `Resource` inherits from the [asteroid module](../asteroid-module) class. It wraps an asteroid application so that it can be used as a sub application initialized by a configuration file.
This example shows the basic usage of a `Resource` as a sub application. You should never have to write this code since the resource will be created and mounted for you by asteroid.
var asteroid = require('asteroid');
var Resource = require('resource');
var app = asteroid();
var subApp = new Resource({root: '/my-sub-app'});
subApp.mount(app);
subApp.get('/', function (req, res) {
res.send(req.url); // /my-sub-app
});
app.listen(3000);
## resource.app
Each resource is constructed with a asteroid/express sub app at the path provided in the resource's `config.json` options.
### myResource.app.VERB(path, [callback...], callback)
The `myResource.VERB()` methods provide routing functionality inherited from [Express](http://expressjs.com/api.html#app.get), where **VERB** is one of the HTTP verbs, such as `myResource.post()`. See the [Express docs](http://expressjs.com/api.html#app.get) for more info.
**Examples**
myResource.get('/hello-world', function(req, res) {
res.send('hello world');
});
### myResource.app.use([path], middleware)
Use the given middleware function.
**Examples**
// a logger middleware
myResource.use(function(req, res, next){
console.log(req.method, req.url); // GET /my-resource
next();
});
## Config
### Options
#### path
The `asteroid.Route` path where the resource will be mounted.
**Examples**
{
"options": {
"path": "/foo" // responds at /foo
}
}
<!-- ... -->
{
"options": {
"path": "/foo/:bar" // provides :bar param at `req.param('bar')`.
}
}

12
node_modules/resource/example/example.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
/**
* A generated `Resource` example...
*
* Examples should show a working module api
* and be used in tests to continously check
* they function as expected.
*/
var Resource = require('../');
var resource = Resource.create();
resource.myMethod();

5
node_modules/resource/index.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
/**
* resource ~ public api
*/
module.exports = require('./lib/resource');

56
node_modules/resource/lib/resource.js generated vendored Normal file
View File

@ -0,0 +1,56 @@
/**
* Expose `Resource`.
*/
module.exports = Resource;
/**
* Module dependencies.
*/
var asteroid = require('asteroid')
, AsteroidModule = require('asteroid-module')
, debug = require('debug')('asteroid:resource')
, util = require('util')
, inherits = util.inherits
, assert = require('assert');
/**
* Create a new `Resource` with the given `options`.
*
* @param {Object} options
* @return {Resource}
*/
function Resource(options) {
AsteroidModule.apply(this, arguments);
// throw an error if args are not supplied
assert(typeof options === 'object', 'Resource requires an options object');
assert(options.path, 'Resource requires a path');
// create the sub app
var app = this.app = asteroid();
this.options = options;
debug('created with options', options);
this.on('destroyed', function () {
app.disuse(this.options.path);
});
}
/**
* Inherit from `AsteroidModule`.
*/
inherits(Resource, AsteroidModule);
/**
* Mount the sub app on the given parent app at the configured path.
*/
Resource.prototype.mount = function (parent) {
parent.use(this.options.path, this.app);
}

14
node_modules/resource/package.json generated vendored Normal file
View File

@ -0,0 +1,14 @@
{
"name": "resource",
"description": "resource",
"version": "0.0.1",
"scripts": {
"test": "mocha"
},
"dependencies": {
"debug": "latest"
},
"devDependencies": {
"mocha": "latest"
}
}

24
node_modules/resource/test/resource.test.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var Resource = require('../');
describe('Resource', function(){
var resource;
beforeEach(function(){
resource = new Resource;
});
describe('.myMethod', function(){
// example sync test
it('should <description of behavior>', function() {
resource.myMethod();
});
// example async test
it('should <description of behavior>', function(done) {
setTimeout(function () {
resource.myMethod();
done();
}, 0);
});
});
});

5
node_modules/resource/test/support.js generated vendored Normal file
View File

@ -0,0 +1,5 @@
/**
* resource test setup and support.
*/
assert = require('assert');