Skip to content

Commit

Permalink
run update
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Mar 1, 2015
1 parent dcecd6e commit 1449ee5
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 58 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[test/fixtures/*]
insert_final_newline = false
trim_trailing_whitespace = false
12 changes: 4 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Enforce Unix newlines
*.* text eol=lf
*.css text eol=lf
*.html text eol=lf
*.js text eol=lf
*.json text eol=lf
*.less text eol=lf
*.md text eol=lf
*.yml text eol=lf
* text eol=lf

# binaries
*.ai binary
*.psd binary
*.jpg binary
*.gif binary
*.png binary
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.DS_Store
*.sublime-*
_gh_pages
bower_components
Expand Down
6 changes: 3 additions & 3 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"eqnull": true,
"esnext": true,
"immed": true,
"latedef": true,
"latedef": false,
"laxcomma": false,
"mocha": true,
"newcap": true,
"noarg": true,
"node": true,
"sub": true,
"undef": true,
"unused": true,
"mocha": true
"unused": true
}
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs"
git:
depth: 10
12 changes: 4 additions & 8 deletions .verb.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# {%= name %} {%= badge("fury") %}
# {%= name %} {%= badge("fury") %} {%= badge("travis") %}

> {%= description %}
## Install
{%= include("install-npm", {save: true}) %}

## Run tests

```bash
npm test
```
## Running tests
{%= include("tests") %}

## Usage

Expand All @@ -18,7 +14,7 @@ var gulpRoutes = require('{%= name %}');
```

## API
{%= comments("index.js") %}
{%= apidocs("index.js") %}

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %})
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE-MIT → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Brian Woodward
Copyright (c) 2014-2015, Brian Woodward.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
# gulp-routes [![NPM version](https://badge.fury.io/js/gulp-routes.svg)](http://badge.fury.io/js/gulp-routes)
# gulp-routes [![NPM version](https://badge.fury.io/js/gulp-routes.svg)](http://badge.fury.io/js/gulp-routes) [![Build Status](https://travis-ci.org/assemble/gulp-routes.svg)](https://travis-ci.org/assemble/gulp-routes)

> Add middleware to run for specified routes in your gulp pipeline.
## Install
## Install with [npm](npmjs.org)

```bash
npm i gulp-routes --save
```

## Run tests
## Running tests
Install dev dependencies.

```bash
npm test
npm i -d && npm test
```


## Usage

```js
var gulpRoutes = require('gulp-routes');
```

## API
### [.gulpRoutes](index.js#L28)
### [gulpRoutes](./index.js#L32)

Create a routes plugin that runs middleware defined on a router.
Returns a plugin function for running middleware defined on a router.

* `router` **{Object}**: Instance of an [en-route] router
* `router` **{Object}**: Instance of an [en-route] router.
* `returns` **{Function}**: New function for creating a router stream.

```js
var gulpRoutes = require('gulp-routes');
var router = require('en-route');
var routes = gulpRoutes(router);
var routes = require('gulp-routes')(router);
```

### [.routes](index.js#L49)
### [.routes](./index.js#L53)

Create a router stream to run middleware for the specified method.

Expand All @@ -60,11 +60,11 @@ Pull requests and stars are always welcome. For bugs and feature requests, [plea
+ [twitter/assemble](http://twitter.com/assemble)

## License
Copyright (c) 2014 Brian Woodward
Copyright (c) 2015 Brian Woodward
Released under the MIT license

***

_This file was generated by [verb](https://github.com/assemble/verb) on December 10, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 01, 2015._

[en-route]: https://github.com/jonschlinkert/en-route
34 changes: 22 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*!
* gulp-routes <https://github.com/assemble/gulp-routes>
*
* Copyright (c) 2014 Brian Woodward, contributors.
* Licensed under the MIT license.
* Copyright (c) 2014-2015, Brian Woodward.
* Licensed under the MIT License.
*/

'use strict';
Expand All @@ -11,21 +11,25 @@ var through = require('through2');
var gutil = require('gulp-util');

/**
* Create a routes plugin that runs middleware defined on a router.
* Expose `gulpRoutes` plugin.
*/

module.exports = gulpRoutes;

/**
* Returns a plugin function for running middleware defined on a router.
*
* ```js
* var gulpRoutes = require('gulp-routes');
* var router = require('en-route');
* var routes = gulpRoutes(router);
* var routes = require('gulp-routes')(router);
* ```
*
* @name gulpRoutes
* @param {Object} `router` Instance of an [en-route] router
* @param {Object} `router` Instance of an [en-route] router.
* @return {Function} New function for creating a router stream.
* @api public
*/

module.exports = function gulpRoutes(router) {
function gulpRoutes(router) {
router = router || (this && this.router);
if (!router) {
throw new gutil.PluginError('gulp-routes', new Error('Expected a valid router object.'));
Expand All @@ -46,14 +50,20 @@ module.exports = function gulpRoutes(router) {
* @api public
*/

return function routes (method) {
return function routes(method) {
method = method || 'all';

return through.obj(function (file, encoding, cb) {
if (file.isNull() || !file.isBuffer()) {
this.push(file);
return cb();
}

var stream = this;
try {
file.options = file.options || {};
file.options.method = method;

// run middleware
router.handle(file, function (err) {
if (err) {
Expand All @@ -64,9 +74,9 @@ module.exports = function gulpRoutes(router) {
cb();
}
});
} catch (ex) {
stream.emit('error', new gutil.PluginError('gulp-routes - handle', ex));
cb();
} catch (err) {
stream.emit('error', new gutil.PluginError('gulp-routes - handle', err));
return cb();
}
});
};
Expand Down
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,26 @@
},
"license": {
"type": "MIT",
"url": "https://github.com/assemble/gulp-routes/blob/master/LICENSE-MIT"
"url": "https://github.com/assemble/gulp-routes/blob/master/LICENSE"
},
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha -R spec"
"test": "mocha"
},
"devDependencies": {
"en-route": "^0.3.3",
"mocha": "*",
"should": "*"
},
"keywords": [],
"dependencies": {
"gulp-util": "^3.0.1",
"gulp-util": "^3.0.4",
"should": "^5.0.1",
"through2": "^0.6.3"
},
"devDependencies": {
"en-route": "^0.4.0",
"mocha": "*",
"should": "^5.0.1"
}
}
9 changes: 5 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/**
* Assemble <http://assemble.io>
/*!
* gulp-routes <https://github.com/assemble/gulp-routes>
*
* Copyright (c) 2014 Jon Schlinkert, Brian Woodward, contributors
* Licensed under the MIT License (MIT).
* Copyright (c) 2014-2015, Brian Woodward.
* Licensed under the MIT License.
*/

'use strict';

var should = require('should');
Expand Down

0 comments on commit 1449ee5

Please sign in to comment.