Comparing version 2.0.0-rc4 to 2.0.0
@@ -5,13 +5,11 @@ # How to contribute | ||
## Logging Issues | ||
All issues should be created using the [new issue form](https://github.com/hapijs/glue/issues/new). Clearly describe the issue including steps | ||
to reproduce if there are any. Also, make sure to indicate the earliest version that has the issue being reported. | ||
All issues should be created using the [new issue form](https://github.com/hapijs/glue/issues/new). Clearly describe the issue including steps to reproduce if there are any. Also, make sure to indicate the earliest version that has the issue being reported. | ||
## Patching Code | ||
Code changes are welcome and should follow the guidelines below. | ||
* Fork the repository on GitHub. | ||
* Fix the issue ensuring that your code follows the [style guide](https://github.com/hapijs/hapi/blob/master/docs/Style.md). | ||
* Fix the issue ensuring that your code follows the [style guide](https://github.com/hapijs/contrib/blob/master/Style.md). | ||
* Add tests for your new code ensuring that you have 100% code coverage (we can help you reach 100% but will not merge without it). | ||
* Run `npm test` to generate a report of test coverage | ||
* [Pull requests](http://help.github.com/send-pull-requests/) should be made to the [master branch](https://github.com/hapijs/glue/tree/master). |
@@ -199,2 +199,4 @@ // Load modules | ||
Hoek.assert(typeof instance === 'object', 'Invalid plugin configuration'); | ||
var registerOptions = Hoek.cloneWithShallow(instance, 'options'); | ||
@@ -201,0 +203,0 @@ delete registerOptions.options; |
{ | ||
"name": "glue", | ||
"description": "Server composer for hapi.js", | ||
"version": "2.0.0-rc4", | ||
"version": "2.0.0", | ||
"repository": "git://github.com/hapijs/glue", | ||
@@ -6,0 +6,0 @@ "main": "index", |
@@ -17,3 +17,7 @@ #glue | ||
* 'connections' - an array of connection options, passed individually in calls to [`server.connection([options])`](http://hapijs.com/api#serverconnectionoptions) | ||
* 'plugins' - an object holding plugin entries to register with [`server.register(plugins, [options], callback)`](http://hapijs.com/api#serverregisterplugins-options-callback). Each key is the `name` of the plugin to load and register and the value is the plugin options. | ||
* 'plugins' - an object holding plugin entries to register with [`server.register(plugins, [options], callback)`](http://hapijs.com/api#serverregisterplugins-options-callback). Each key is the `name` of the plugin to load and register and the value is one of: | ||
+ an object to use as the plugin options which get passed to the plugin's registration function when called. | ||
+ an array of objects where each object will load a separate instance of the plugin. Multiple instances of a plugin is only possible if the plugin's `attributes.multiple` is `true`. Each object can have: | ||
* any option from [`server.register`](http://hapijs.com/api#serverregisterplugins-options-callback) options | ||
* `options` - an object to use as the plugin options which get passed to the plugin's registration function when called. | ||
+ `options` - an object having | ||
@@ -20,0 +24,0 @@ * 'relativeTo' - a file-system path string that is used to resolve loading modules with `require`. Used in `server.cache` and `plugins[name]` |
@@ -188,4 +188,3 @@ // Load modules | ||
'../test/plugins/route.js': [{ | ||
options: { ignored: true }, | ||
routes: { prefix: '/third/planet' } | ||
routes: { prefix: '/test/' } | ||
}] | ||
@@ -198,9 +197,10 @@ } | ||
expect(err).to.not.exist(); | ||
expect(server.plugins.route).to.exist(); | ||
expect(server.plugins.route.prefix).to.equal('/third/planet'); | ||
done(); | ||
server.inject('/test/plugin', function (response) { | ||
expect(response.statusCode).to.equal(200); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
/* | ||
it('composes server with plugins having a plugin loaded multiple times', function (done) { | ||
@@ -217,7 +217,7 @@ | ||
select: 'a', | ||
routes: { prefix: '/a' } | ||
routes: { prefix: '/a/' } | ||
}, | ||
{ | ||
select: 'b', | ||
routes: { prefix: '/b' } | ||
routes: { prefix: '/b/' } | ||
} | ||
@@ -231,8 +231,13 @@ ] | ||
expect(err).to.not.exist(); | ||
expect(server.select('a').plugins.route.prefix).to.equal('/a'); | ||
expect(server.select('b').plugins.route.prefix).to.equal('/b'); | ||
done(); | ||
server.select('a').inject('/a/plugin', function (response) { | ||
expect(response.statusCode).to.equal(200); | ||
server.select('b').inject('/b/plugin', function (response) { | ||
expect(response.statusCode).to.equal(200); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
*/ | ||
@@ -260,2 +265,3 @@ it('composes server with plugins resolved using options.relativeTo', function (done) { | ||
preConnections: function (server, callback) { | ||
callback(); | ||
@@ -277,2 +283,3 @@ } | ||
prePlugins: function (server, callback) { | ||
callback(); | ||
@@ -294,2 +301,3 @@ } | ||
prePlugins: function (server, callback) { | ||
callback({error: 'failed'}); | ||
@@ -421,3 +429,3 @@ } | ||
it('throws on invalid plugin configuration', function (done) { | ||
it('throws on invalid plugin configuration (empty instances)', function (done) { | ||
@@ -436,2 +444,17 @@ var manifest = { | ||
}); | ||
it('throws on invalid plugin configuration (bogus instance)', function (done) { | ||
var manifest = { | ||
plugins: { | ||
'../test/plugins/helloworld.js': ['bogus'] | ||
} | ||
}; | ||
expect(function () { | ||
Glue.compose(manifest, function () { }); | ||
}).to.throw(/Invalid plugin configuration/); | ||
done(); | ||
}); | ||
}); |
@@ -8,3 +8,3 @@ exports.register = function (server, options, next) { | ||
name: 'helloworld', | ||
multiple: true | ||
multiple: false | ||
}; |
exports.register = function (server, options, next) { | ||
server.expose(server.realm.modifiers.route); | ||
server.route({method: 'GET', path: 'plugin', handler: function (request, reply) { | ||
reply(); | ||
}}); | ||
next(); | ||
@@ -4,0 +6,0 @@ }; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
51972
14
516
1
31