Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: f88d7a6210
...
compare: 24279f699a
  • 4 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
6 History.md
@@ -0,0 +1,6 @@
+
+0.1.2 / 2012-06-30
+==================
+
+ * Fixed issue with `redis.createClient` options.
+ * Removed superfluous lib.
View
25 lib/announce.js → announce.js
@@ -20,8 +20,8 @@ var events = require('events')
* Exports
*/
-exports = module.exports = Announce;
-exports.createClient = createClient;
+module.exports = Announce;
+Announce.createClient = Announce;
/**
* Utils
@@ -40,6 +40,8 @@ var slice = Array.prototype.slice;
*/
function Announce (options) {
+ if (!(this instanceof Announce)) return new Announce(options);
+
options || (options = {});
// node id to uniquely identify this node
@@ -61,11 +63,11 @@ function Announce (options) {
}
// initialize a redis client for publishing
- if (options.redisPub instanceof RedisClient) {
- this.pub = options.redisPub;
+ if (options.pub instanceof RedisClient) {
+ this.pub = options.pub;
} else {
- options.redisPub || (options.redisPub = {});
- this.pub = redis.createClient(options.redisPub.port, options.redisPub.host, options.redisPub);
+ options.pub || (options.pub = {});
+ this.pub = redis.createClient(options.pub.port, options.pub.host, options.pub.options);
}
this.setFlags();
@@ -195,14 +197,3 @@ Announce.prototype.publish = function (name) {
var args = slice.call(arguments, 1);
this.pub.publish(name, this.pack({ nodeId: this.nodeId, args: args }));
};
-
-
-/**
- * Create an Announce Client
- *
- * @api public
- */
-
-function createClient (options) {
- return new Announce(options);
-}
View
1  index.js
@@ -1 +0,0 @@
-module.exports = require('./lib/announce.js');
View
62 package.json
@@ -1,28 +1,38 @@
{
- "name": "socket.io-announce"
- , "version": "0.1.1"
- , "description": "Socket.io multi-process announcement channel"
- , "keywords": ["socket.io", "store", "redis", "redisstore"]
- , "author": "Daniel D. Shaw <dshaw@dshaw.com> (http://dshaw.com)"
- , "main": "index"
- , "repository": {
- "type": "git"
- , "url": "git://github.com/dshaw/socket.io-announce.git"
- }
- , "directories": {
- "lib": "lib"
- , "test": "test"
- , "examples": "examples"
- }
- , "dependencies": {
- "redis": ">= 0.6.7"
- , "socket.io": ">= 0.8.5"
- }
- , "devDependencies": {
- "tap": ">= 0.0.10"
- }
- , "scripts" : {
- "test" : "tap test/*.js"
- }
- , "engines": { "node": ">= 0.4.0" }
+ "name": "socket.io-announce",
+ "version": "0.1.2",
+ "description": "Socket.io multi-process announcement channel",
+ "keywords": [
+ "socket.io",
+ "store",
+ "redis",
+ "redisstore"
+ ],
+ "author": "Daniel D. Shaw <dshaw@dshaw.com> (http://dshaw.com)",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/dshaw/socket.io-announce.git"
+ },
+ "bugs": {
+ "url": "git://github.com/dshaw/socket.io-announce/issues"
+ },
+ "license": "MIT",
+ "main": "./announce.js",
+ "directories": {
+ "test": "test",
+ "examples": "examples"
+ },
+ "dependencies": {
+ "redis": "~0.7.1",
+ "socket.io": "https://github.com/dshaw/socket.io/tarball/patch/redis71"
+ },
+ "devDependencies": {
+ "tap": "~0.2.5"
+ },
+ "scripts": {
+ "test": "node test/announce.test.js"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ }
}
View
23 test/announce.test.js
@@ -1,19 +1,20 @@
-var path = require('path')
- , sia = require('../index.js')
- , tap = require('tap')
- , test = tap.test
+var sia = require('..')
+ , test = require('tap').test
-test('Announce basic', function (t) {
+test('Announce', function (t) {
var EventEmitter = require('events').EventEmitter
, RedisClient = require('redis').RedisClient
- , announce = sia.createClient()
, Announce = sia
+ , announce = sia()
+
+ t.plan(5)
t.isa(announce, EventEmitter, 'announce should be instanceof EventEmitter')
- t.isa(announce, Announce, "announce should be instanceof Announce")
- t.isa(announce.pub, RedisClient, "pub should be instanceof RedisClient")
+ t.isa(announce, Announce, 'announce should be instanceof Announce')
+ t.isa(announce.pub, RedisClient, 'pub should be instanceof RedisClient')
+
+ t.ok(announce.nodeId, 'nodeId is defined')
+ t.equal(announce.namespace, '', 'default namespace should be empty string')
- t.ok(announce.nodeId, "nodeId is defined")
- t.equal(announce.namespace, '', "default namespace should be empty string")
t.end()
-});
+})

No commit comments for this range

Something went wrong with that request. Please try again.