From 71f2d769d9318d760869a4d7c655cf438583a7ec Mon Sep 17 00:00:00 2001 From: Ruben Daniels Date: Fri, 1 May 2015 16:31:49 +0000 Subject: [PATCH] Fixed tests --- node_modules/vfs-local/localfs.js | 6 ++++++ package.json | 2 +- plugins/c9.cli.bridge/bridge-service.js | 18 +++++++++++++++--- plugins/c9.cli.bridge/bridge_test.js | 4 ++-- plugins/c9.cli.publish/install.js | 1 + 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index 6aefc38f..c076aeaf 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -2339,6 +2339,9 @@ module.exports = function setup(fsOptions) { err.code = "EEXIST"; return callback(err, { api: apis[name] }); } + + if (options.redefine && apis[name] && apis[name].destroy) + apis[name].destroy(); var fn; @@ -2399,6 +2402,9 @@ module.exports = function setup(fsOptions) { } function unextend(name, options, callback) { + if (apis[name] && apis[name].destroy) + apis[name].destroy(); + delete apis[name]; callback(null, {}); } diff --git a/package.json b/package.json index a6e1eb0c..36ece324 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "c9.ide.help.support": "#60e88f5680", "c9.ide.imgeditor": "#08bbc53578", "c9.ide.immediate": "#6845a93705", - "c9.ide.installer": "#2dcd0acc76", + "c9.ide.installer": "#312b28d5e8", "c9.ide.mount": "#32e79866ee", "c9.ide.navigate": "#64156c7f4a", "c9.ide.newresource": "#f1f0624768", diff --git a/plugins/c9.cli.bridge/bridge-service.js b/plugins/c9.cli.bridge/bridge-service.js index 6acda88e..05a86853 100644 --- a/plugins/c9.cli.bridge/bridge-service.js +++ b/plugins/c9.cli.bridge/bridge-service.js @@ -21,10 +21,13 @@ module.exports = function (vfs, options, register) { client.on("error", function(err){ if (err.code == "ECONNREFUSED") { - require("fs").unlink(SOCKET, function(){ + require("fs").unlink(SOCKET, function(){ createListenServer(api); }); } + else if (err.code == "ENOENT") { + createListenServer(api); + } else api.onError(err); }); @@ -42,7 +45,11 @@ module.exports = function (vfs, options, register) { return client; } - function createListenServer(api){ + function createListenServer(api){ + // var timeout = setTimeout(function(){ + // unixServer.close(); + // }, 500); + var unixServer = net.createServer(function(client) { client.setEncoding("utf8"); @@ -98,7 +105,8 @@ module.exports = function (vfs, options, register) { } }; - createListenServer(api); + // createListenServer + createListenClient(api); stream.write = function(data){ if (client) client.write(data); @@ -111,6 +119,10 @@ module.exports = function (vfs, options, register) { stream = null; delete this.api; + }, + + destroy: function(){ + this.disconnect(); } }); }; \ No newline at end of file diff --git a/plugins/c9.cli.bridge/bridge_test.js b/plugins/c9.cli.bridge/bridge_test.js index eae084be..ccb93842 100644 --- a/plugins/c9.cli.bridge/bridge_test.js +++ b/plugins/c9.cli.bridge/bridge_test.js @@ -71,9 +71,9 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "/vfs-home"], it('send and receive messages', function(done) { bridge.on("message", function(e){ if (e.message.hello) { - e.respond({ "hi": true }); + e.respond(null, { "hi": true }); } - }) + }); client.send({ "hello": true }, function(err, message){ if (err) throw err.message; expect(message).property("hi").to.be.ok; diff --git a/plugins/c9.cli.publish/install.js b/plugins/c9.cli.publish/install.js index b1643e22..10be9751 100644 --- a/plugins/c9.cli.publish/install.js +++ b/plugins/c9.cli.publish/install.js @@ -140,6 +140,7 @@ define(function(require, exports, module) { cmd.addCommand({ name: "remove", + alias: "uninstall", info: " Removes a cloud9 package.", usage: "[--verbose] [--global] [--local] ", // @TODO --global options: {