Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

move bridge to its own plugin #295

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions configs/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ return [
// debug: !options.packed
},
{
packagePath: "./c9.cli.bridge/bridge-client",
port: 17123
packagePath: "./c9.ide.bridge/bridge-client"
},
{
packagePath: "./c9.cli.bridge/clibridge-client"
//port: 17123
},
// "./c9.cli.mount/mount",
{
Expand Down
9 changes: 7 additions & 2 deletions configs/client-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,11 +714,11 @@ module.exports = function(options) {
checkOS: true
},
{
packagePath: "plugins/c9.cli.bridge/bridge",
packagePath: "plugins/c9.cli.bridge/clibridge",
startBridge: options.startBridge
},
{
packagePath: "plugins/c9.cli.bridge/bridge_commands",
packagePath: "plugins/c9.cli.bridge/clibridge_commands",
basePath: workspaceDir
},
{
Expand Down Expand Up @@ -921,6 +921,11 @@ module.exports = function(options) {
preinstalled: hosted && !options.ssh,
});
}

plugins.push({
packagePath: "plugins/c9.ide.bridge/bridge",
startBridge: options.startBridge
});

return plugins;
};
Expand Down
95 changes: 0 additions & 95 deletions plugins/c9.cli.bridge/bridge-client.js

This file was deleted.

109 changes: 0 additions & 109 deletions plugins/c9.cli.bridge/bridge.js

This file was deleted.

46 changes: 46 additions & 0 deletions plugins/c9.cli.bridge/clibridge-client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* File Finder module for the Cloud9 that uses nak
*
* @copyright 2013, Ajax.org B.V.
*/
define(function(require, exports, module) {
main.consumes = ["c9", "Plugin", "net", "bridge.client"];
main.provides = ["bridge.cli.client"];
return main;

function main(options, imports, register) {
var Plugin = imports.Plugin;
var bridgeClient = imports["bridge.client"];

/***** Initialization *****/

var plugin = new Plugin("Ajax.org", main.consumes);
// var emit = plugin.getEmitter();

var send = bridgeClient.setup("cli");

/***** Lifecycle *****/

plugin.on("load", function(){
});

plugin.on("unload", function(){
});

/***** Register and define API *****/

/**
* Bridge To Communicate from CLI to IDE
**/
plugin.freezePublicAPI({
/**
*
*/
send: send
});

register(null, {
"bridge.cli.client": plugin
});
}
});
56 changes: 56 additions & 0 deletions plugins/c9.cli.bridge/clibridge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
define(function(require, exports, module) {
main.consumes = ["c9", "Plugin", "ext", "bridge"];
main.provides = ["clibridge"];
return main;

function main(options, imports, register) {
var Plugin = imports.Plugin;
var c9 = imports.c9;
var ext = imports.ext;
var bridge = imports.bridge;

//var JSONStream = require("./json-stream");

/***** Initialization *****/

var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();

var ENABLED = options.startBridge !== false;

/***** Methods *****/

var cliBridge = bridge.setup("cli");

cliBridge.on("message",function(payload){
emit("message",payload);
});

plugin.on("load", function(){
c9.on("connect", function(){
if (!ENABLED) return;
cliBridge.load(function(){
emit.sticky("ready");
});
}, plugin);
});

plugin.on("unload", cliBridge.unload);

/***** Register and define API *****/

/**
* Bridge To Communicate from CLI to IDE
**/
plugin.freezePublicAPI({
/**
*
*/
write: cliBridge.write
});

register(null, {
clibridge: plugin
});
}
});
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

define(function(require, exports, module) {
main.consumes = [
"Plugin", "bridge", "tabManager", "panels", "tree.favorites", "tree",
"Plugin", "clibridge", "tabManager", "panels", "tree.favorites", "tree",
"fs", "preferences", "settings", "c9", "commands"
];
main.provides = ["bridge.commands"];
return main;

function main(options, imports, register) {
var Plugin = imports.Plugin;
var bridge = imports.bridge;
var bridge = imports.clibridge;
var tabManager = imports.tabManager;
var panels = imports.panels;
var tree = imports.tree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "/vfs-home"],
setup: expect.html.mocked
},
{
consumes: ["bridge", "bridge.client"],
consumes: ["clibridge", "clibridge.client"],
provides: [],
setup: main
}
], architect);

function main(options, imports, register) {
var bridge = imports.bridge;
var client = imports["bridge.client"];
var bridge = imports.clibridge;
var client = imports["clibridge.client"];

describe('bridge', function() {
// this.timeout(10000);
Expand Down
Loading