Permalink
Browse files

add 'index.js' that exposes both zookeeper and zk_promise

  • Loading branch information...
1 parent 025715e commit 5f0cad6034b6b7acf026d242040554868d7dcb82 Dave Dopson committed Mar 13, 2012
View
@@ -1,4 +1,5 @@
-var ZooKeeper = require ("./lib/zookeeper");
+#!/usr/bin/env node
+var ZooKeeper = require ("./");
var zk = new ZooKeeper({
connect: "localhost:2181"
,timeout: 200000
View
@@ -0,0 +1,3 @@
+module.exports = require('./zookeeper');
+module.exports.ZooKeeper = module.exports; // for backwards compatibility
+module.exports.Promise = require('./zk_promise');
View
@@ -1,12 +1,13 @@
+var EventEmitter = require('events').EventEmitter;
+var util = require('util');
+var _ = require('underscore');
+
try {
// as of node 0.6.x, node-waf seems to build to a different directory. grr.
var NativeZk = require(__dirname + '/../build/Release/zookeeper_native').ZooKeeper;
} catch(e) {
var NativeZk = require(__dirname + '/../build/default/zookeeper_native').ZooKeeper;
}
-var EventEmitter = require('events').EventEmitter;
-var util = require('util');
-var _ = require('underscore');
// with Node 0.5.x and greater, EventEmitter is pure-js, so we have to make a simple wrapper...
// Partly inspired by https://github.com/bnoordhuis/node-event-emitter
@@ -16,7 +17,6 @@ var _ = require('underscore');
////////////////////////////////////////////////////////////////////////////////
exports = module.exports = ZooKeeper;
-module.exports.ZooKeeper = ZooKeeper; // for compatibility
function ZooKeeper(config) {
var self = this;
if(_.isString(config)) {
View
@@ -17,7 +17,7 @@
"webworker" : ">=0.8.2"
,"underscore" : "*"
}
- ,"main": "lib/zookeeper"
+ ,"main": "lib/index"
,"directories.lib": "build/default/"
,"scripts" : {
"build" : "node-waf configure build"
@@ -1,4 +1,4 @@
-var ZK = require("../lib/zookeeper").ZooKeeper,
+var ZK = require("../lib/zookeeper"),
Buffer = require('buffer').Buffer,
exec = require('child_process').exec;
View
@@ -1,6 +1,6 @@
var assert = require ('assert');
var util = require('util');
-var ZK = require ("../lib/zookeeper").ZooKeeper;
+var ZK = require ("../lib/zookeeper");
if (process.argv.length < 2)
throw new Error ("must supply number of sessions (optionally)");
View
@@ -1,4 +1,4 @@
-var ZK = require ("../lib/zookeeper").ZooKeeper;
+var ZK = require ("../lib/zookeeper");
if (process.argv.length < 3)
throw new Error ("must supply number of nodes to create and number of sessions (optionally)");
@@ -32,7 +32,7 @@ game #2:
*/
var promise = require("../lib/promise");
-var ZK = require("../lib/zk_promise").ZK;
+var ZK = require("../lib/zk_promise");
var NGames = parseInt (process.argv[2] || 1);
var connect = (process.argv[3] || 'localhost:2181');
View
@@ -1,4 +1,4 @@
-var ZK = require ("../lib/zookeeper").ZooKeeper,
+var ZK = require ("../lib/zookeeper"),
exec = require('child_process').exec;
var zk = new ZK();
View
@@ -1,7 +1,7 @@
var assert = require ('assert');
var util = require('util');
-var ZK = require ("../lib/zookeeper").ZooKeeper;
+var ZK = require ("../lib/zookeeper");
if (process.argv.length < 2)
throw new Error ("must supply number of sessions (optionally)");
@@ -1,7 +1,7 @@
var assert = require ('assert');
var util = require('util');
-var ZK = require ("../lib/zookeeper").ZooKeeper;
+var ZK = require ("../lib/zookeeper");
if (process.argv.length < 2)
throw new Error ("must supply number of sessions (optionally)");
View
@@ -2,7 +2,7 @@
var assert = require('assert');
var util = require('util');
-var ZK = require ("../lib/zookeeper").ZooKeeper;
+var ZK = require ("../lib/zookeeper");
onmessage = function(msg) {
postMessage({ echo : msg });

0 comments on commit 5f0cad6

Please sign in to comment.