Skip to content

Commit

Permalink
Made package npm-ready
Browse files Browse the repository at this point in the history
  • Loading branch information
ysimonson committed May 31, 2012
1 parent a4a418e commit 8650439
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -10,7 +10,7 @@ Servers

To create a new server:

var zerorpc = require("zerorpc/server");
var zerorpc = require("zerorpc");
var server = new zerorpc.Server();

The constructor optionally takes in an options object. Allowable options:
Expand All @@ -32,7 +32,7 @@ Methods:

Full example:

var zerorpc = require("zerorpc/server");
var zerorpc = require("zerorpc");

var server = new zerorpc.Server();
server.bind("tcp://0.0.0.0:4242");
Expand Down Expand Up @@ -64,7 +64,7 @@ Clients

To create a new client:

var zerorpc = require("zerorpc/client");
var zerorpc = require("zerorpc");
var client = new zerorpc.Client();

The constructor optionally takes in an options object. Allowable options:
Expand All @@ -89,9 +89,9 @@ Methods:

Full example:

var zerorpc = require("zerorpc/client");
var zerorpc = require("zerorpc");

var client = new client.Client();
var client = new zerorpc.Client();
client.connect("tcp://127.0.0.1:4242");

client.on("error", function(error) {
Expand All @@ -105,7 +105,7 @@ Full example:
console.log("UPDATE:", res);
}

if(done) {
if(!more) {
console.log("Done.");
}
});
28 changes: 28 additions & 0 deletions index.js
@@ -0,0 +1,28 @@
// Open Source Initiative OSI - The MIT License (MIT):Licensing
//
// The MIT License (MIT)
// Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

var server = require("./lib/server"),
client = require("./lib/client");

exports.Server = server.Server;
exports.Client = client.Client;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions package.json
@@ -0,0 +1,40 @@
{
"name": "zerorpc",
"version": "0.1.0",
"main": "./index.js",
"author": "dotCloud <opensource@dotcloud.com>",
"description": "A port of ZeroRPC to node.js",

"contributors": [{
"name": "Francois-Xavier Bourlet",
"email": "fx@dotcloud.com"
},{
"name": "Yusuf Simonson",
"email": "yusuf@dotcloud.com"
}],

"repository": {
"type": "git",
"url": "https://github.com/dotcloud/zerorpc-node"
},

"keywords": [
"zerorpc",
"rpc",
"distributed",
"communication"
],

"dependencies": {
"underscore": "1.3.3",
"msgpack2": "0.1.7",
"node-uuid": "1.3.3",
"zmq": "2.0.3"
},

"devDependencies": {
"nodeunit": "0.7.4"
},

"license": "MIT"
}
11 changes: 5 additions & 6 deletions test/integration.js
Expand Up @@ -21,10 +21,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

var server = require("../src/server"),
client = require("../src/client");
var zerorpc = require("..");

var rpcServer = new server.Server();
var rpcServer = new zerorpc.Server();
rpcServer.bind("tcp://0.0.0.0:4242");

rpcServer.expose({
Expand Down Expand Up @@ -75,10 +74,10 @@ rpcServer.expose({
}
});

var rpcClient = new client.Client();
var rpcClient = new zerorpc.Client();
rpcClient.connect("tcp://localhost:4242");

var badRpcClient = new client.Client();
var badRpcClient = new zerorpc.Client();
badRpcClient.connect("tcp://localhost:4040");

function attachError(emitter) {
Expand Down Expand Up @@ -166,7 +165,7 @@ exports.testStreamError = function(test) {
exports.testClose = function(test) {
test.expect(1);

var closingClient = new client.Client();
var closingClient = new zerorpc.Client();
closingClient.connect("tcp://localhost:4242");

var hit = false;
Expand Down

0 comments on commit 8650439

Please sign in to comment.