diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2644170 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: "node_js" +node_js: + - 0.4 + - 0.6 diff --git a/Makefile b/Makefile index b6f2ccf..c055b26 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NODE = node -TEST = vows +TEST = ./node_modules/.bin/vows TESTS ?= test/*-test.js test: diff --git a/README.md b/README.md index a957277..8f05111 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Passport-Tumblr [Passport](https://github.com/jaredhanson/passport) strategy for authenticating -with Tumblr using the OAuth 1.0a API. +with [Tumblr](https://www.tumblr.com/) using the OAuth 1.0a API. ## Installation @@ -50,10 +50,17 @@ application: res.redirect('/'); }); -#### Examples +## Examples For a complete, working example, refer to the [login example](https://github.com/jaredhanson/passport-tumblr/tree/master/examples/login). +## Tests + + $ npm install --dev + $ make test + +[![Build Status](https://secure.travis-ci.org/jaredhanson/passport-tumblr.png)](http://travis-ci.org/jaredhanson/passport-tumblr) + ## Credits - [Jared Hanson](http://github.com/jaredhanson) diff --git a/lib/passport-tumblr/index.js b/lib/passport-tumblr/index.js index 0674818..8a2d8c3 100644 --- a/lib/passport-tumblr/index.js +++ b/lib/passport-tumblr/index.js @@ -7,7 +7,7 @@ var Strategy = require('./strategy'); /** * Framework version. */ -exports.version = '0.1.0'; +require('pkginfo')(module, 'version'); /** * Expose constructors. diff --git a/lib/passport-tumblr/strategy.js b/lib/passport-tumblr/strategy.js index 093a57c..a94d119 100644 --- a/lib/passport-tumblr/strategy.js +++ b/lib/passport-tumblr/strategy.js @@ -73,10 +73,13 @@ Strategy.prototype.userProfile = function(token, tokenSecret, params, done) { if (err) { return done(err); } try { - o = JSON.parse(body); + var json = JSON.parse(body); var profile = { provider: 'tumblr' }; - profile.username = o.response.user.name; + profile.username = json.response.user.name; + + profile._raw = body; + profile._json = json; done(null, profile); } catch(e) { diff --git a/package.json b/package.json index 91a2fc3..bebc43d 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,29 @@ "name": "passport-tumblr", "version": "0.1.0", "description": "Tumblr authentication strategy for Passport.", - "author": "Jared Hanson (http://www.jaredhanson.net/)", + "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, "repository": { "type": "git", - "url": "http://github.com/jaredhanson/passport-tumblr.git" + "url": "git://github.com/jaredhanson/passport-tumblr.git" + }, + "bugs": { + "url": "http://github.com/jaredhanson/passport-tumblr/issues" }, "main": "./lib/passport-tumblr", "dependencies": { - "passport-oauth": ">= 0.1.0" + "pkginfo": "0.2.x", + "passport-oauth": "0.1.x" + }, + "devDependencies": { + "vows": "0.6.x" + }, + "scripts": { + "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js" }, "engines": { "node": ">= 0.4.0" }, + "licenses": [ { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } ], "keywords": ["passport", "tumblr", "auth", "authn", "authentication", "identity"] } diff --git a/test/strategy-test.js b/test/strategy-test.js index ba5bd58..4c57869 100644 --- a/test/strategy-test.js +++ b/test/strategy-test.js @@ -84,6 +84,12 @@ vows.describe('TumblrStrategy').addBatch({ assert.equal(profile.provider, 'tumblr'); assert.equal(profile.username, 'derekg'); }, + 'should set raw property' : function(err, profile) { + assert.isString(profile._raw); + }, + 'should set json property' : function(err, profile) { + assert.isObject(profile._json); + }, }, },