Skip to content

Commit

Permalink
Conform to latest conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Feb 23, 2012
1 parent 509abbe commit 5de6ed0
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: "node_js"
node_js:
- 0.4
- 0.6
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NODE = node
TEST = vows
TEST = ./node_modules/.bin/vows
TESTS ?= test/*-test.js

test:
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/passport-tumblr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var Strategy = require('./strategy');
/**
* Framework version.
*/
exports.version = '0.1.0';
require('pkginfo')(module, 'version');

/**
* Expose constructors.
Expand Down
7 changes: 5 additions & 2 deletions lib/passport-tumblr/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@
"name": "passport-tumblr",
"version": "0.1.0",
"description": "Tumblr authentication strategy for Passport.",
"author": "Jared Hanson <[email protected]> (http://www.jaredhanson.net/)",
"author": { "name": "Jared Hanson", "email": "[email protected]", "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"]
}
6 changes: 6 additions & 0 deletions test/strategy-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
},
},

Expand Down

0 comments on commit 5de6ed0

Please sign in to comment.