Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
XadillaX committed Aug 5, 2015
2 parents 627feed + 9b0945d commit af20017
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
57 changes: 57 additions & 0 deletions bin/illyria.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#! /usr/bin/env node
/**
* XadillaX created at 2015-08-05 14:14:18 With ♥
*
* Copyright (c) 2015 Huaban.com, all rights
* reserved.
*/
var opts = require("nomnom").script("illyria").option("host", {
abbr: "h",
default: "127.0.0.1",
help: "the server host"
}).option("port", {
abbr: "p",
default: 3721,
help: "the server port"
}).option("module", {
abbr: "m",
required: true,
help: "the send module"
}).option("function", {
abbr: "f",
required: true,
help: "the send function"
}).option("data", {
abbr: "d",
default: "{}",
help: "the send data"
}).option("runTimeout", {
abbr: "t",
default: 10000,
help: "the run timeout"
}).parse();

var Illyria = require("../");
var TermColor = require("term-color");

var client = Illyria.createClient(opts.host, opts.port);
client.connect(function() {
var data;
try {
data = JSON.parse(opts.data);
} catch(e) {
data = opts.data;
}

client.send(opts.module, opts.function, data, function(err, data) {
if(err) {
console.error(TermColor.red("Failed!"));
console.error(err.message);
process.exit(4);
} else {
console.log(TermColor.green("Succeeded!"));
console.log(data);
process.exit(0);
}
});
});
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "illyria",
"version": "2.2.2",
"version": "2.2.3",
"description": "The next generation Illyria RPC SDK for node.js.",
"main": "index.js",
"scripts": {
Expand All @@ -15,6 +15,9 @@
"RPC",
"server"
],
"bin": {
"illyria": "bin/illyria.js"
},
"author": "libin <bin.li@upai.com> (http://huaban.com/)",
"contributors": [
"XadillaX <kaidi.zhu@huaban.com> (http://xcoder.in/)",
Expand All @@ -27,7 +30,9 @@
"eventemitter2": "^0.4.14",
"msgpack": "^0.2.6",
"node-zookeeper-client": "^0.2.2",
"sugar": "^1.4.1"
"nomnom": "^1.8.1",
"sugar": "^1.4.1",
"term-color": "^1.0.1"
},
"devDependencies": {
"coveralls": "^2.11.2",
Expand Down

0 comments on commit af20017

Please sign in to comment.