Skip to content

Commit

Permalink
Merge pull request #11 from NotNinja/develop
Browse files Browse the repository at this point in the history
Release 0.3.0
  • Loading branch information
neocotic authored May 15, 2017
2 parents 16043f1 + 7d85b5c commit 1d817f7
Show file tree
Hide file tree
Showing 42 changed files with 519 additions and 507 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "skelp/v3/es6",
"extends": "notninja/es6",
"env": {
"node": true
},
Expand Down
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
sudo: false
language: node_js
node_js:
- "6"
- "7"
script:
- npm test
- npm run ci
after_script:
- npm run coveralls
- npm run report-coverage
notifications:
slack:
rooms:
- secure: hiJNVw5FKod3veWv+h5PQby2G1n/xmFJZQlkr0YH3ISzLVIxYnOPzWlwfnK6F6BI4t8Dd76Q/n/dvxJdLI8O8B6neuE667MdVShctgcYUxtnR7ZYjJz4SKokmmGRS0Fl864Sxp/jBkNYezWljaDu35mnxIwY8ApKhmPboDxfHYHZ0hdYqNleRFN9rPNaisijpP48iAFcg+nksMkrdOB8Ritj29raPRTpmFVcwYJaEX/lpv8IhVErVHqe+RQrRIo2eWC6DxZKqTxksjZFNjcaDmRoIoXUG9sfCR7p+fMSVOXPnYqbQWO5QxOWTuoCrxsHHzkWzKbFOSTtsfq7+BVtIWR7PhoR8GJrl9a7P9+SoO/jf2rfPi4MiXXIoBqiNoGvH5IDrgvTX7ZkUecBxQAvUxmZIK8z+l/RX4oahTHuESZkAQ8CzhLlbLk1vAuojvq2Hm7Mz7wmSbQeV8qPrfQ575sssyRRndWwyrDVdhFdwyHRedLgFz4JsdFMWWVCkU3z6RyJ5nNv9Kd3MHhihHjBUsIDqk6z3ImbrLJSjEuKSzVOAcNDzrwwr6ed3OHPCNDAPuypULOATzDUH1gL5xmGFHRX3tRAQ4nRTERahojveMmFPtce32SaEXJb8Vt7pXyWoSaDH1XmYewmFd+Lhl+5z7btwY44yPIDuDcGbQqf/aQ=
on_success: change
2 changes: 1 addition & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Authors ordered by first contribution

* Alasdair Mercer <alasdair@skelp.io>
* Alasdair Mercer <mercer.alasdair@gmail.com>
11 changes: 8 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
## Version 0.3.0, 2017.05.16

* Move to !ninja [#9](https://github.com/NotNinja/routerify/issues/9)
* Switch to Codecov for code coverage [#10](https://github.com/NotNinja/routerify/issues/10)

## Version 0.2.0, 2016.12.18

* Add unit tests [#3](https://github.com/Skelp/routerify/issues/3)
* Simplify configuration of mounters and registrars [#4](https://github.com/Skelp/routerify/issues/4), [#6](https://github.com/Skelp/routerify/issues/6)
* Change default value for `registrar` option to `"index"` [#7](https://github.com/Skelp/routerify/issues/7)
* Add unit tests [#3](https://github.com/NotNinja/routerify/issues/3)
* Simplify configuration of mounters and registrars [#4](https://github.com/NotNinja/routerify/issues/4), [#6](https://github.com/NotNinja/routerify/issues/6)
* Change default value for `registrar` option to `"index"` [#7](https://github.com/NotNinja/routerify/issues/7)

## Version 0.1.0, 2016.12.15

Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contributing

If you have any questions about [Routerify](https://github.com/Skelp/routerify) please feel free to
[raise an issue](https://github.com/Skelp/routerify/issues/new).
If you have any questions about [Routerify](https://github.com/NotNinja/routerify) please feel free to
[raise an issue](https://github.com/NotNinja/routerify/issues/new).

Please [search existing issues](https://github.com/Skelp/routerify/issues) for the same feature and/or issue before
Please [search existing issues](https://github.com/NotNinja/routerify/issues) for the same feature and/or issue before
raising a new issue. Commenting on an existing issue is usually preferred over raising duplicate issues.

Please ensure that all files conform to the coding standards, using the same coding style as the rest of the code base.
Expand All @@ -21,5 +21,5 @@ You must have at least [Node.js](https://nodejs.org) 6 or newer.
All pull requests should be made to the `develop` branch.

Don't forget to add your details to the list of
[AUTHORS.md](https://github.com/Skelp/routerify/blob/master/AUTHORS.md) if you want your contribution to be recognized
by others.
[AUTHORS.md](https://github.com/NotNinja/routerify/blob/master/AUTHORS.md) if you want your contribution to be
recognized by others.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2016 Alasdair Mercer, Skelp
Copyright (C) 2017 Alasdair Mercer, !ninja

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
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
Y8b d88P
"Y88P"

[Routerify](https://github.com/Skelp/routerify) is an opinionated router loader for Express-like applications.
[Routerify](https://github.com/NotNinja/routerify) is an opinionated router loader for Express-like applications.

[![Build](https://img.shields.io/travis/Skelp/routerify/develop.svg?style=flat-square)](https://travis-ci.org/Skelp/routerify)
[![Coverage](https://img.shields.io/coveralls/Skelp/routerify/develop.svg?style=flat-square)](https://coveralls.io/github/Skelp/routerify)
[![Dependencies](https://img.shields.io/david/Skelp/routerify.svg?style=flat-square)](https://david-dm.org/Skelp/routerify)
[![Dev Dependencies](https://img.shields.io/david/dev/Skelp/routerify.svg?style=flat-square)](https://david-dm.org/Skelp/routerify#info=devDependencies)
[![License](https://img.shields.io/npm/l/routerify.svg?style=flat-square)](https://github.com/Skelp/routerify/blob/master/LICENSE.md)
[![Build](https://img.shields.io/travis/NotNinja/routerify/develop.svg?style=flat-square)](https://travis-ci.org/NotNinja/routerify)
[![Coverage](https://img.shields.io/codecov/c/github/NotNinja/routerify/develop.svg?style=flat-square)](https://codecov.io/gh/NotNinja/routerify)
[![Dependencies](https://img.shields.io/david/NotNinja/routerify.svg?style=flat-square)](https://david-dm.org/NotNinja/routerify)
[![Dev Dependencies](https://img.shields.io/david/dev/NotNinja/routerify.svg?style=flat-square)](https://david-dm.org/NotNinja/routerify?type=dev)
[![License](https://img.shields.io/npm/l/routerify.svg?style=flat-square)](https://github.com/NotNinja/routerify/blob/master/LICENSE.md)
[![Release](https://img.shields.io/npm/v/routerify.svg?style=flat-square)](https://www.npmjs.com/package/routerify)

* [Install](#install)
Expand All @@ -39,15 +39,15 @@ You'll need to have at least [Node.js](https://nodejs.org) 6 or newer.
Routerify is opinionated. Routerify is also configurable and extensible via plugins. The two core plugin types that
Routerify has are *Registrars* and *Mounters*. Through these, Routerify can be configured to load routes from modules in
any pattern and mount them onto any server.

### Registrars

Registrars are responsible for picking which source files within the directory should be loaded as modules and how the
routes are extracted from the modules. These routes are then passed to the mounter.

Routerify includes some opinionated registrars. If you don't like our opinion, you can either not use Routerify **or**
you can simply [create your own](#create-your-own-registrar) and, optionally,
[create a pull request](https://github.com/Skelp/routerify/compare) to share it with everyone, provided our opinions
[create a pull request](https://github.com/NotNinja/routerify/compare) to share it with everyone, provided our opinions
match :) If not, you can always release it as a plugin.

#### `IndexRegistrar`
Expand Down Expand Up @@ -126,7 +126,7 @@ It expects the following file structure under the target directory:

Only files whose base name matches that of a supported verb will be loaded (e.g. `helper.js` in the above example would
be ignored) and it expects each one of those modules to export either a single handler method or an array of handler
methods.
methods.

In the example above, the following routes would be registered:

Expand All @@ -150,7 +150,7 @@ class CustomRegistrar extends Registrar {
getPluginName() {
return 'custom'
}

register(file, options) {
// Load the module, extract the routes, and mount them via this.mounter
...
Expand All @@ -173,7 +173,8 @@ routerify({
```

You probably want to take a look at the relevant
[source code](https://github.com/Skelp/routerify/tree/master/src/registrar) before trying to create your own registrar.
[source code](https://github.com/NotNinja/routerify/tree/master/src/registrar) before trying to create your own
registrar.

### Mounters

Expand All @@ -183,7 +184,7 @@ option is specified, and they determine how parameter path variables are formatt

Routerify includes some mounters for common server frameworks. If your favorite framework is not supported, you can
[create your own](#create-your-own-mounter) and, optionally,
[create a pull request](https://github.com/Skelp/routerify/compare) to share it with everyone.
[create a pull request](https://github.com/NotNinja/routerify/compare) to share it with everyone.

#### `ExpressMounter`

Expand All @@ -205,7 +206,7 @@ benefits for Restify applications by allowing extra optional information (e.g. `
mounting routes.

This can be done by simply adding an `options` property containing the additional information to one of the route
handlers and it will be passed in.
handlers and it will be passed in.

#### Create your own Mounter

Expand All @@ -216,7 +217,7 @@ const routerify = require('routerify')
const Mounter = require('routerify/src/mounter')

class CustomMounter extends Mounter {

formatParamPath(param) {
// Format param for insertion into the route URL
return ...
Expand Down Expand Up @@ -253,7 +254,7 @@ routerify({
```

You probably want to take a look at the relevant
[source code](https://github.com/Skelp/routerify/tree/master/src/mounter) before trying to create your own mounter.
[source code](https://github.com/NotNinja/routerify/tree/master/src/mounter) before trying to create your own mounter.

## API

Expand Down Expand Up @@ -332,26 +333,25 @@ The current version of Routerify.

``` javascript
routerify.version
=> "0.2.0"
=> "0.3.0"
```

## Bugs

If you have any problems with Routerify or would like to see changes currently in development you can do so
[here](https://github.com/Skelp/routerify/issues).
[here](https://github.com/NotNinja/routerify/issues).

## Contributors

If you want to contribute, you're a legend! Information on how you can do so can be found in
[CONTRIBUTING.md](https://github.com/Skelp/routerify/blob/master/CONTRIBUTING.md). We want your suggestions and pull
[CONTRIBUTING.md](https://github.com/NotNinja/routerify/blob/master/CONTRIBUTING.md). We want your suggestions and pull
requests!

A list of Routerify contributors can be found in
[AUTHORS.md](https://github.com/Skelp/routerify/blob/master/AUTHORS.md).
[AUTHORS.md](https://github.com/NotNinja/routerify/blob/master/AUTHORS.md).

## License

See [LICENSE.md](https://github.com/Skelp/routerify/raw/master/LICENSE.md) for more information on our MIT license.
See [LICENSE.md](https://github.com/NotNinja/routerify/raw/master/LICENSE.md) for more information on our MIT license.

© 2016 [Skelp](https://skelp.io)
<img align="right" width="16" height="16" src="https://cdn.rawgit.com/Skelp/skelp-branding/master/assets/logo/base/skelp-logo-16x16.png">
[![Copyright !ninja](https://cdn.rawgit.com/NotNinja/branding/master/assets/copyright/base/not-ninja-copyright-186x25.png)](https://not.ninja)
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: off
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "routerify",
"version": "0.2.0",
"version": "0.3.0",
"description": "Opinionated router loader for Express-like applications",
"homepage": "https://github.com/Skelp/routerify",
"homepage": "https://github.com/NotNinja/routerify",
"bugs": {
"url": "https://github.com/Skelp/routerify/issues"
"url": "https://github.com/NotNinja/routerify/issues"
},
"author": {
"name": "Alasdair Mercer",
"email": "alasdair@skelp.io",
"url": "https://skelp.io"
"email": "mercer.alasdair@gmail.com",
"url": "https://not.ninja"
},
"license": "MIT",
"keywords": [
Expand All @@ -19,28 +19,28 @@
],
"repository": {
"type": "git",
"url": "https://github.com/Skelp/routerify.git"
"url": "https://github.com/NotNinja/routerify.git"
},
"dependencies": {
"glob": "^7.1.1",
"lodash.defaultsdeep": "^4.6.0"
},
"devDependencies": {
"chai": "^3.5.0",
"coveralls": "^2.11.15",
"eslint": "^3.12.1",
"eslint-config-skelp": "^0.1.5",
"codecov": "^2.2.0",
"eslint": "^3.19.0",
"eslint-config-notninja": "^0.1.1",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"sinon": "^1.17.6"
"mocha": "^3.4.1",
"sinon": "^2.2.0"
},
"main": "src/routerify.js",
"scripts": {
"coveralls": "istanbul cover _mocha --report lcovonly -- -R spec \"test/**/*.spec.js\" && coveralls < coverage/lcov.info",
"test": "npm run test-lint && npm run test-suite && npm run test-coverage",
"test-coverage": "istanbul check-coverage",
"test-lint": "eslint \"src/**/*.js\" \"test/**/*.js\"",
"test-suite": "istanbul cover _mocha -- -R spec \"test/**/*.spec.js\""
"ci": "npm run test",
"report-coverage": "istanbul cover _mocha --report lcovonly -- -R spec \"test/**/*.spec.js\" && codecov",
"pretest": "eslint \"src/**/*.js\" \"test/**/*.js\"",
"test": "istanbul cover _mocha -- -R list \"test/**/*.spec.js\"",
"posttest": "istanbul check-coverage"
},
"engines": {
"node": ">=6"
Expand Down
18 changes: 9 additions & 9 deletions src/mounter/express-mounter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 Alasdair Mercer, Skelp
* Copyright (C) 2017 Alasdair Mercer, !ninja
*
* 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 All @@ -20,9 +20,9 @@
* SOFTWARE.
*/

'use strict'
'use strict';

const Mounter = require('./index')
const Mounter = require('./index');

/**
* An implementation of {@link Mounter} that is intended to be used for Express applications.
Expand All @@ -37,35 +37,35 @@ class ExpressMounter extends Mounter {
* @inheritDoc
*/
formatParamPath(param) {
return `:${param}`
return `:${param}`;
}

/**
* @override
* @inheritDoc
*/
getDefaultVerbs() {
return [ 'del', 'get', 'head', 'opts', 'patch', 'post', 'put' ]
return [ 'del', 'get', 'head', 'opts', 'patch', 'post', 'put' ];
}

/**
* @override
* @inheritDoc
*/
getPluginName() {
return 'express'
return 'express';
}

/**
* @override
* @inheritDoc
*/
mount(url, verb, handlers, options) {
handlers = Array.isArray(handlers) ? handlers : [ handlers ]
handlers = Array.isArray(handlers) ? handlers : [ handlers ];

options.server[verb](url, ...handlers)
options.server[verb](url, ...handlers);
}

}

module.exports = ExpressMounter
module.exports = ExpressMounter;
16 changes: 8 additions & 8 deletions src/mounter/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 Alasdair Mercer, Skelp
* Copyright (C) 2017 Alasdair Mercer, !ninja
*
* 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 All @@ -20,10 +20,10 @@
* SOFTWARE.
*/

'use strict'
'use strict';

const Plugin = require('../plugin')
const Utilities = require('../utilities')
const Plugin = require('../plugin');
const Utilities = require('../utilities');

/**
* Responsible for mounting a route, whose information is provided by a {@link Registrar}, onto the server.
Expand All @@ -42,7 +42,7 @@ class Mounter extends Plugin {
* @abstract
*/
formatParamPath(param) {
Utilities.abstracted(Mounter, 'formatParamPath')
Utilities.abstracted(Mounter, 'formatParamPath');
}

/**
Expand All @@ -53,7 +53,7 @@ class Mounter extends Plugin {
* @abstract
*/
getDefaultVerbs() {
Utilities.abstracted(Mounter, 'getDefaultVerbs')
Utilities.abstracted(Mounter, 'getDefaultVerbs');
}

/**
Expand All @@ -68,9 +68,9 @@ class Mounter extends Plugin {
* @abstract
*/
mount(url, verb, handlers, options) {
Utilities.abstracted(Mounter, 'mount')
Utilities.abstracted(Mounter, 'mount');
}

}

module.exports = Mounter
module.exports = Mounter;
Loading

0 comments on commit 1d817f7

Please sign in to comment.