Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit 6ccf1727de320136ab1c3047beba90bbe8b3b5a0 1 parent be38488
@hueniverse hueniverse authored
View
18 .gitignore
@@ -0,0 +1,18 @@
+.idea
+*.iml
+npm-debug.log
+dump.rdb
+node_modules
+results.tap
+results.xml
+npm-shrinkwrap.json
+config.json
+.DS_Store
+*/.DS_Store
+*/*/.DS_Store
+._*
+*/._*
+*/*/._*
+coverage.*
+lib-cov
+
View
5 .travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+
+node_js:
+ - 0.8
+
View
24 LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2013, Walmart.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Walmart nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL WALMART BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
33 Makefile
@@ -0,0 +1,33 @@
+REPORTER = dot
+
+test:
+ @#lib-cov
+ @NODE_ENV=test ./node_modules/.bin/mocha --recursive --reporter $(REPORTER) --ignore-leaks --timeout 3000
+ @#$(MAKE) rm-lib-cov
+
+tests: test
+
+lib-cov: rm-lib-cov
+ @jscoverage lib lib-cov
+
+rm-lib-cov:
+ @rm -rf ./lib-cov/
+
+test-cov: lib-cov
+ @$(MAKE) test TEST_COV=1 REPORTER=json-cov > coverage.json
+ @$(MAKE) rm-lib-cov
+
+test-cov-html: lib-cov
+ @$(MAKE) test TEST_COV=1 REPORTER=html-cov > coverage.html
+ @$(MAKE) rm-lib-cov
+
+tap: lib-cov
+ @NODE_ENV=test ./node_modules/.bin/mocha -R tap > results.tap
+ @$(MAKE) rm-lib-cov
+
+unit:
+ @#lib-cov
+ @NODE_ENV=test ./node_modules/.bin/mocha --recursive -R xunit --ignore-leaks > results.xml --timeout 3000
+ @#$(MAKE) rm-lib-cov
+
+.PHONY: test tap test-cov test-cov-html unit lib-cov rm-lib-cov
View
9 README.md 100644 → 100755
@@ -1,4 +1,7 @@
-scooter
-=======
+<a href="https://github.com/walmartlabs/blammo"><img src="https://raw.github.com/walmartlabs/blammo/master/images/from.png" align="right" /></a>
+![scooter Logo](/images/scooter.png)
+
+User-agent information plugin for [**hapi**](https://github.com/walmartlabs/hapi)
+
+[![Build Status](https://secure.travis-ci.org/walmartlabs/scooter.png)](http://travis-ci.org/walmartlabs/scooter)
-User-agent information plugin for hapi
View
1  index.js
@@ -0,0 +1 @@
+module.exports = require('./lib');
View
27 lib/index.js
@@ -0,0 +1,27 @@
+// Load modules
+
+var Hoek = require('hoek');
+
+
+// Declare internals
+
+var internals = {};
+
+internals.config = {
+};
+
+
+exports.register = function (pack, options, next) {
+
+ Hoek.merge(internals.config, options);
+
+ pack.ext('onRequest', internals.onRequest);
+
+ next();
+};
+
+
+internals.onRequest = function (request, next) {
+
+ next();
+};
View
37 package.json
@@ -0,0 +1,37 @@
+{
+ "name": "scooter",
+ "description": "User-agent information plugin for hapi",
+ "version": "0.0.0",
+ "author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)",
+ "contributors": [],
+ "repository": "git://github.com/walmartlabs/scooter",
+ "main": "index",
+ "keywords": [
+ "hapi",
+ "plugin",
+ "user-agent"
+ ],
+ "engines": {
+ "node": ">=0.8.0"
+ },
+ "dependencies": {
+ "hoek": "0.4.x"
+ },
+ "devDependencies": {
+ "hapi": "0.x.x",
+ "mocha": "1.x.x",
+ "chai": "1.x.x"
+ },
+ "scripts": {
+ "test": "make test && make unit"
+ },
+ "licenses": [
+ {
+ "type": "BSD",
+ "url": "http://github.com/hueniverse/scooter/raw/master/LICENSE"
+ }
+ ],
+ "hapi": {
+ "plugin": "1.x.x"
+ }
+}
View
52 test/index.js
@@ -0,0 +1,52 @@
+// Load modules
+
+var Chai = require('chai');
+var Hapi = require('hapi');
+var Scooter = process.env.TEST_COV ? require('../lib-cov') : require('../lib');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Chai.expect;
+
+
+describe('Scooter', function () {
+
+ // Wrapper is required for coverage
+
+ var plugin = {
+ name: 'scooter',
+ version: Hapi.utils.loadPackage().version,
+ hapi: {
+ plugin: '1.x.x'
+ },
+ register: Scooter.register
+ };
+
+ it('parses and sets user-agent information for an incoming request', function (done) {
+
+ var options = {
+ permissions: {
+ ext: true
+ }
+ };
+
+ var server = new Hapi.Server();
+
+ server.plugin().register(plugin, options, function (err) {
+
+ expect(err).to.not.exist;
+ server.inject({ method: 'GET', url: '/no-found' }, function (res) {
+
+ done();
+ });
+ });
+ });
+});
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.