diff --git a/configs/client-default.js b/configs/client-default.js index 8274dc08..6f6d5192 100644 --- a/configs/client-default.js +++ b/configs/client-default.js @@ -98,7 +98,7 @@ module.exports = function(options) { packagePath: "plugins/c9.ide.plugins/debug" }, { - packagePath: "plugins/c9.ide.plugins/market" + packagePath: "plugins/c9.ide.plugins/packages" }, { packagePath: "plugins/c9.ide.plugins/test", @@ -456,7 +456,7 @@ module.exports = function(options) { { packagePath: "plugins/c9.ide.layout.classic/preload", themePrefix: options.themePrefix, - defaultTheme: "dark" + defaultTheme: options.defaultTheme || "dark" }, { packagePath: "plugins/c9.ide.tree/tree", diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index c076aeaf..6e106dad 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -2420,7 +2420,13 @@ module.exports = function setup(fsOptions) { } //////////////////////////////////////////////////////////////////////////////// - + + if (fsOptions.extendApi) { + for (var i in fsOptions.extendApi) { + extend(i, fsOptions.extendApi[i], function() {}); + } + } + return vfs; }; diff --git a/package.json b/package.json index 36ece324..a500a719 100644 --- a/package.json +++ b/package.json @@ -60,12 +60,12 @@ "c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.infer": "#cfec494a3c", "c9.ide.language.jsonalyzer": "#21b64e5820", - "c9.ide.collab": "#504750d8f0", + "c9.ide.collab": "#edef363853", "c9.ide.local": "#2bfd7ff051", "c9.ide.find": "#6cc6d3379d", "c9.ide.find.infiles": "#72582de3cd", "c9.ide.find.replace": "#e4daf722b8", - "c9.ide.run.debug": "#8b903a06d0", + "c9.ide.run.debug": "#ed9d2ba07e", "c9.automate": "#47e2c429c9", "c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.gotoline": "#4d1a93172c", diff --git a/plugins/c9.ide.dialog.common/alert_internal.js b/plugins/c9.ide.dialog.common/alert_internal.js index 2b527375..c76edc94 100644 --- a/plugins/c9.ide.dialog.common/alert_internal.js +++ b/plugins/c9.ide.dialog.common/alert_internal.js @@ -1,11 +1,12 @@ define(function(require, module, exports) { - main.consumes = ["Dialog", "util", "dialog.alert"]; + main.consumes = ["Dialog", "util", "dialog.alert", "metrics"]; main.provides = ["dialog.alert_internal"]; return main; function main(options, imports, register) { var Dialog = imports.Dialog; var util = imports.util; + var metrics = imports.metrics; var alertWrapper = imports["dialog.alert"]; /***** Initialization *****/ @@ -25,6 +26,8 @@ define(function(require, module, exports) { /***** Methods *****/ function show(title, header, msg, onhide, options) { + metrics.increment("dialog.error"); + return plugin.queue(function(){ if (header === undefined) { plugin.title = "Notice"; diff --git a/plugins/c9.ide.dialog.common/error.js b/plugins/c9.ide.dialog.common/error.js index 7a6cfde5..4b4142e6 100644 --- a/plugins/c9.ide.dialog.common/error.js +++ b/plugins/c9.ide.dialog.common/error.js @@ -1,13 +1,14 @@ define(function(require, exports, module) { "use strict"; - main.consumes = ["Plugin", "ui"]; + main.consumes = ["Plugin", "ui", "metrics"]; main.provides = ["dialog.error"]; return main; function main(options, imports, register) { var Plugin = imports.Plugin; var ui = imports.ui; + var metrics = imports.metrics; /***** Initialization *****/ @@ -84,6 +85,8 @@ define(function(require, exports, module) { } function show(message, timeout) { + metrics.increment("dialog.error"); + // Error message container if (!error) { error = document.body.appendChild(document.createElement("div")); diff --git a/plugins/c9.ide.errorhandler/raygun_error_handler.js b/plugins/c9.ide.errorhandler/raygun_error_handler.js index 3c3dcca8..82ddc557 100644 --- a/plugins/c9.ide.errorhandler/raygun_error_handler.js +++ b/plugins/c9.ide.errorhandler/raygun_error_handler.js @@ -8,7 +8,7 @@ define(function(require, exports, module) { "use strict"; main.consumes = [ - "Plugin", "info" + "Plugin", "info", "metrics" ]; main.provides = ["error_handler"]; return main; @@ -16,6 +16,7 @@ define(function(require, exports, module) { function main(options, imports, register) { var Plugin = imports.Plugin; var info = imports.info; + var metrics = imports.metrics; /***** Initialization *****/ @@ -57,7 +58,8 @@ define(function(require, exports, module) { Raygun.setVersion(version + ".0"); } - function reportError(exception, customData, tags) { + function log(exception, customData, tags) { + metrics.increment("errorhandler.log"); if (typeof exception === "string") exception = new Error(exception); if (!exception) @@ -78,8 +80,8 @@ define(function(require, exports, module) { plugin.freezePublicAPI({ /** @deprecated Use log() instead. */ - reportError: reportError, - log: reportError + reportError: log, + log: log }); register(null, { "error_handler" : plugin }); diff --git a/plugins/c9.ide.plugins/installer.js b/plugins/c9.ide.plugins/installer.js index 2e102bae..152e1824 100644 --- a/plugins/c9.ide.plugins/installer.js +++ b/plugins/c9.ide.plugins/installer.js @@ -1,6 +1,6 @@ define(function(require, exports, module) { main.consumes = [ - "Plugin", "proc", "c9", "pubsub", "auth", "util" + "Plugin", "proc", "c9", "pubsub", "auth", "util", "installer" ]; main.provides = ["plugin.installer"]; return main; @@ -12,6 +12,9 @@ define(function(require, exports, module) { var proc = imports.proc; var auth = imports.auth; var pubsub = imports.pubsub; + var installer = imports.installer; + + var async = require("async"); var escapeShell = util.escapeShell; var updates = options.updates; @@ -20,11 +23,10 @@ define(function(require, exports, module) { /***** Initialization *****/ var plugin = new Plugin("Ajax.org", main.consumes); - // var emit = plugin.getEmitter(); + var emit = plugin.getEmitter(); var HASSDK = c9.location.indexOf("sdk=0") === -1; - var queue = []; var installing; var loaded = false; @@ -69,87 +71,66 @@ define(function(require, exports, module) { // return; // } - if (!config.length) return; + if (!config.length) + return callback && callback(); - var found = {}; - config.forEach(function(item){ - if (!found[item.packageName]) - found[item.packageName] = true; - else return; - - queue.push({ name: item.packageName, version: item.version }); - - if (installing) - installing.push(item); - }); - - if (installing) return; - installing = config; - - var i = 0; - function next(err){ - if (err) console.log(err); - - if (!queue[i]) { - installing = false; queue = []; - architect.loadAdditionalPlugins(config, callback); - return; - } - - installPlugin(queue[i].name, queue[i].version, next); - i++; + // Only run one installer at a time + if (installing) { + return plugin.once("finished", function(){ + installPlugins(config, callback); + }); } - next(); + installing = true; + + var found = {}, packages = []; + config.forEach(function(item){ + if (!found[item.name]) + found[item.name] = true; + else return; + + packages.push({ name: item.name, version: item.version }); + }); + + async.eachSeries(packages, function(pkg, next){ + installPlugin(pkg.name, pkg.version, next); + }, function(err){ + installing = false; + emit("finished"); + + if (err) { + console.error(err.message); + return callback && callback(err); + } + + architect.loadAdditionalPlugins(config, callback); + }); } function installPlugin(name, version, callback){ - proc.spawn("bash", { - args: ["-c", ["c9", "install", "--local", "--force", "--accessToken=" + auth.accessToken, escapeShell(name) + "@" + escapeShell(version)].join(" ")] - }, function(err, process){ - if (err) return callback(err); - - process.stdout.on("data", function(c){ - console.log(c); - }); - process.stderr.on("data", function(c){ - console.error(c); + // Headless installation of the plugin + installer.createSession(name, version, function(session, options){ + session.install({ + "bash": "c9 install --local --force --accessToken=" + auth.accessToken + + " " + escapeShell(name) + "@" + escapeShell(version) }); - process.on("exit", function(code){ - if (code) { - var error = new Error(err); - error.code = code; - return callback(error); - } - callback(); - }); - }); + // Force to start immediately + session.start(callback, true); + }, function(){}, 2); // Force to not be administered } function uninstallPlugin(name, callback){ - proc.spawn("c9", { - args: ["remove", "--local", "--force", "--accessToken=" + auth.accessToken, escapeShell(name)] - }, function(err, process){ - if (err) return callback(err); - - var res = null; - process.stdout.on("data", function(c){ - res = c.toString("utf8"); - }); - process.stderr.on("data", function(c){ - err = c.toString("utf8"); + // Headless uninstallation of the plugin + installer.createSession(name, -1, function(session, options){ + session.install({ + "bash": "c9 remove --local --force --accessToken=" + auth.accessToken + + " " + escapeShell(name) }); - process.on("exit", function(code){ - if (code) { - var error = new Error(err); - error.code = code; - return callback(error); - } - callback(null, res); - }); - }); + // Force to start immediately + session.start(callback, true); + }, function(){}, 2); // Force to not be administered } /***** Lifecycle *****/ @@ -160,7 +141,6 @@ define(function(require, exports, module) { plugin.on("unload", function() { loaded = false; installing = false; - queue = []; }); /***** Register and define API *****/ @@ -180,6 +160,11 @@ define(function(require, exports, module) { */ installPlugins: installPlugins, + /** + * + */ + installPlugin: installPlugin, + /** * */ diff --git a/plugins/c9.ide.plugins/manager.js b/plugins/c9.ide.plugins/manager.js index 77294880..63c96f60 100644 --- a/plugins/c9.ide.plugins/manager.js +++ b/plugins/c9.ide.plugins/manager.js @@ -85,7 +85,9 @@ define(function(require, exports, module) { }; var TEMPLATES = { "plugin.simple": "Empty Plugin", - "plugin.default": "Full Plugin" + "plugin.default": "Full Plugin", + "plugin.installer": "Installer Plugin", + "plugin.bundle": "Cloud9 Bundle" }; // @TODO add sorting @@ -102,7 +104,6 @@ define(function(require, exports, module) { // var emit = plugin.getEmitter(); var HASSDK = c9.location.indexOf("sdk=0") === -1; - var ENABLED = c9.location.indexOf("sdk=1") > -1; var model, datagrid, filterbox; var btnUninstall, btnReport, btnReadme, btnCloud9, btnReload; @@ -125,20 +126,18 @@ define(function(require, exports, module) { // updateCommandsFromSettings(); // }, plugin); - if (ENABLED) { - menus.addItemByPath("File/New Plugin", null, 210, plugin); - Object.keys(TEMPLATES).forEach(function(name){ - menus.addItemByPath("File/New Plugin/" + TEMPLATES[name], new ui.item({ - onclick: function(){ - createNewPlugin(name); - } - }), 210, plugin); - }); - - ext.on("register", function(){ - setTimeout(reloadModel); - }); - } + menus.addItemByPath("File/New Plugin", null, 210, plugin); + Object.keys(TEMPLATES).forEach(function(name){ + menus.addItemByPath("File/New Plugin/" + TEMPLATES[name], new ui.item({ + onclick: function(){ + createNewPlugin(name); + } + }), 210, plugin); + }); + + ext.on("register", function(){ + setTimeout(reloadModel); + }); } var drawn; diff --git a/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin.html b/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin.html new file mode 100644 index 00000000..d8688f81 --- /dev/null +++ b/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin.html @@ -0,0 +1 @@ +
Hello World
\ No newline at end of file diff --git a/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin.js b/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin.js new file mode 100644 index 00000000..3dca2f71 --- /dev/null +++ b/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin.js @@ -0,0 +1,155 @@ +define(function(require, exports, module) { + main.consumes = [ + "Plugin", "ui", "commands", "menus", "preferences", "settings" + ]; + main.provides = ["myplugin"]; + return main; + + function main(options, imports, register) { + var Plugin = imports.Plugin; + var ui = imports.ui; + var menus = imports.menus; + var commands = imports.commands; + var settings = imports.settings; + var prefs = imports.preferences; + + /***** Initialization *****/ + + var plugin = new Plugin("Ajax.org", main.consumes); + var emit = plugin.getEmitter(); + + var showing; + function load() { + commands.addCommand({ + name: "mycommand", + bindKey: { mac: "Command-I", win: "Ctrl-I" }, + isAvailable: function(){ return true; }, + exec: function() { + showing ? hide() : show(); + } + }, plugin); + + menus.addItemByPath("Tools/My Menu Item", new ui.item({ + command: "mycommand" + }), 300, plugin); + + settings.on("read", function(e){ + settings.setDefaults("user/my-plugin", [ + ["first", "1"], + ["second", "all"] + ]); + }); + + prefs.add({ + "Example" : { + position: 450, + "My Plugin" : { + position: 100, + "First Setting": { + type: "checkbox", + path: "user/my-plugin/@first", + position: 100 + }, + "Second Setting": { + type: "dropdown", + path: "user/my-plugin/@second", + width: "185", + position: 200, + items: [ + { value: "you", caption: "You" }, + { value: "me", caption: "Me" }, + { value: "all", caption: "All" } + ] + } + } + } + }, plugin); + } + + var drawn = false; + function draw() { + if (drawn) return; + drawn = true; + + // Insert HTML + var markup = require("text!./plugin.html"); + ui.insertHtml(document.body, markup, plugin); + + // Insert CSS + ui.insertCss(require("text!./style.css"), options.staticPrefix, plugin); + + emit("draw"); + } + + /***** Methods *****/ + + function show() { + draw(); + + var div = document.querySelector(".helloworld"); + div.style.display = "block"; + div.innerHTML = settings.get("user/my-plugin/@second"); + + emit("show"); + showing = true; + } + + function hide() { + if (!drawn) return; + + document.querySelector(".helloworld").style.display = "none"; + + emit("hide"); + showing = false; + } + + /***** Lifecycle *****/ + + plugin.on("load", function() { + load(); + }); + plugin.on("unload", function() { + drawn = false; + showing = false; + }); + + /***** Register and define API *****/ + + /** + * This is an example of an implementation of a plugin. + * @singleton + */ + plugin.freezePublicAPI({ + /** + * @property showing whether this plugin is being shown + */ + get showing(){ return showing; }, + + _events: [ + /** + * @event show The plugin is shown + */ + "show", + + /** + * @event hide The plugin is hidden + */ + "hide" + ], + + /** + * Show the plugin + */ + show: show, + + /** + * Hide the plugin + */ + hide: hide, + }); + + register(null, { + "myplugin": plugin + }); + } +}); \ No newline at end of file diff --git a/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin_test.js b/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin_test.js new file mode 100644 index 00000000..3ae2262d --- /dev/null +++ b/plugins/c9.ide.plugins/mock/c9.ide.example3/plugin_test.js @@ -0,0 +1,41 @@ +"use client"; +"use mocha"; + +define(function(require, exports, module) { + main.consumes = ["plugin.test", "myplugin"]; + main.provides = []; + return main; + + function main(options, imports, register) { + var test = imports["plugin.test"]; + var myplugin = imports.myplugin; + + var describe = test.describe; + var it = test.it; + var before = test.before; + var after = test.after; + var beforeEach = test.beforeEach; + var afterEach = test.afterEach; + var assert = test.assert; + var expect = test.expect; + + /***** Initialization *****/ + + describe(myplugin.name, function(){ + this.timeout(2000); + + it("shows a helloworld div", function() { + myplugin.show(); + expect(document.querySelector(".helloworld")).to.ok; + expect(document.querySelector(".helloworld").innerText).to.equal("all"); + }); + + it("hides the div", function() { + myplugin.hide(); + expect(document.querySelector(".helloworld").offsetHeight).to.not.ok; + }); + }); + + register(null, {}); + } +}); \ No newline at end of file diff --git a/plugins/c9.ide.plugins/market.js b/plugins/c9.ide.plugins/packages.js similarity index 63% rename from plugins/c9.ide.plugins/market.js rename to plugins/c9.ide.plugins/packages.js index 592f9bc6..4b466aef 100644 --- a/plugins/c9.ide.plugins/market.js +++ b/plugins/c9.ide.plugins/packages.js @@ -3,7 +3,7 @@ define(function(require, exports, module) { "Editor", "editors", "ui", "commands", "menus", "layout", "tabManager", "util", "settings", "api", "c9" ]; - main.provides = ["plugin.market"]; + main.provides = ["plugin.packages"]; return main; function main(options, imports, register) { @@ -24,17 +24,17 @@ define(function(require, exports, module) { var extensions = []; var packages = {}; - var handle = editors.register("plugin.market", "Market Place", - MarketPlace, extensions); + var handle = editors.register("plugin.packages", "Package Browser", + PackageBrowser, extensions); var emit = handle.getEmitter(); emit.setMaxListeners(1000); - var HASSDK = c9.location.indexOf("sdk=1") > -1; + var HASSDK = c9.location.indexOf("sdk=0") === -1; - function focusOpenMarket(){ + function focusOpenPackages(){ var pages = tabs.getTabs(); for (var i = 0, tab = pages[i]; tab; tab = pages[i++]) { - if (tab.editorType == "plugin.market") { + if (tab.editorType == "plugin.packages") { tabs.focusTab(tab); return true; } @@ -49,29 +49,30 @@ define(function(require, exports, module) { }); commands.addCommand({ - name: "openmarketplace", - hint: "open the market place", + name: "openpackagebrowser", + hint: "open the package browser", group: "General", // bindKey: { mac: "Command-,", win: "Ctrl-," }, exec: function () { var tab = tabs.focussedTab; - if (tab && tab.editor.type == "plugin.market") { + if (tab && tab.editor.type == "plugin.packages") { tab.close(); return; } - if (focusOpenMarket()) + if (focusOpenPackages()) return; tabs.open({ - editorType: "plugin.market", + editorType: "plugin.packages", active: true }, function(){}); } }, handle); - menus.addItemByPath("Cloud9/Plugin Store", new ui.item({ - command: "openmarketplace" - }), 301, handle); + menus.addItemByPath("Cloud9/~", new ui.divider(), 1000, handle); + menus.addItemByPath("Cloud9/Package Browser", new ui.item({ + command: "openpackagebrowser" + }), 1100, handle); }); /***** Methods *****/ @@ -123,10 +124,10 @@ define(function(require, exports, module) { /***** Editor *****/ - function MarketPlace(){ + function PackageBrowser(){ var plugin = new Editor("Ajax.org", main.consumes, extensions); //var emit = plugin.getEmitter(); - var tab; + var tab, iframe; plugin.on("resize", function(e) { emit("resize", e); @@ -136,33 +137,15 @@ define(function(require, exports, module) { tab = e.tab; var htmlNode = e.htmlNode; - api.packages.get("", function(err, list){ - if (c9.standalone) { - err = null; - list = [{ name: "example", apikey:"0000000000000000000000000000=", packagePath: "plugins/c9.example/example" }]; - } - - if (err) return; - - var sHtml = ""; - list.forEach(function(plugin){ // @todo use react instead in an iframe - packages[plugin.name] = plugin; - - sHtml += "
" - + "" + plugin.name + " | " - + "Install In Workspace | " - + "Install To User" - + "
"; - }); - - htmlNode.innerHTML = sHtml; - htmlNode.addEventListener("click", function(e){ - if (e.target.tagName == "A") { - installPlugin(e.target.getAttribute("plugin-name"), - e.target.getAttribute("target"), function(){}); - } - }); - }); + htmlNode.style.paddingTop = 0; + + iframe = htmlNode.appendChild(document.createElement("iframe")); + iframe.style.width = "100%"; + iframe.style.height = "100%"; + iframe.style.border = 0; + iframe.style.backgroundColor = "#fbfbfb"; + + iframe.src = location.origin.replace("ide.", "") + "/profile/packages?nobar=1&pid=" + c9.projectId; }); plugin.on("getState", function(e) { @@ -174,12 +157,11 @@ define(function(require, exports, module) { plugin.on("documentLoad", function(e) { var doc = e.doc; - doc.title = "Plugin Store"; + doc.title = "Package Browser"; function setTheme(){ - // var bg = ui.getStyleRule(".bar-preferences .container .header", "backgroundColor") || "#F0F0F0"; - var bg = "#FFF"; - doc.tab.backgroundColor = bg; //"#2d2d2d"; + var bg = "#fbfbfb"; + doc.tab.backgroundColor = bg; if (util.shadeColor(bg, 1).isLight) doc.tab.classList.remove("dark"); @@ -192,14 +174,7 @@ define(function(require, exports, module) { }); plugin.on("documentActivate", function(e) { - e.doc.tab.on("unload", function(){ - if (parent.parentNode == tab) - tab.removeChild(parent); - }); - tab.appendChild(parent); - - emit("show"); }); /***** Register and define API *****/ @@ -212,13 +187,13 @@ define(function(require, exports, module) { }); - plugin.load(null, "plugin.market"); + plugin.load(null, "plugin.packages"); return plugin; } register(null, { - "plugin.market": handle + "plugin.packages": handle }); } }); \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.bundle/README.md b/plugins/c9.ide.plugins/templates/plugin.bundle/README.md new file mode 100644 index 00000000..143f51ff --- /dev/null +++ b/plugins/c9.ide.plugins/templates/plugin.bundle/README.md @@ -0,0 +1 @@ +This is the Cloud9 bundle example \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.bundle/package.json b/plugins/c9.ide.plugins/templates/plugin.bundle/package.json new file mode 100644 index 00000000..dd39f32a --- /dev/null +++ b/plugins/c9.ide.plugins/templates/plugin.bundle/package.json @@ -0,0 +1,21 @@ +{ + "name": "", + "description": "", + "version": "0.0.1", + "author": "", + "contributors": [ + { + "name": "", + "email": "" + } + ], + "repository": { + "type": "git", + "url": "" + }, + "plugins": {}, + "categories": [ + "misc" + ], + "licenses": [] +} \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.default/README.md b/plugins/c9.ide.plugins/templates/plugin.default/README.md index 6d7f5b94..600c4e28 100644 --- a/plugins/c9.ide.plugins/templates/plugin.default/README.md +++ b/plugins/c9.ide.plugins/templates/plugin.default/README.md @@ -1,3 +1 @@ -# c9.ide.example - This is the Cloud9 default plugin example \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.default/package.json b/plugins/c9.ide.plugins/templates/plugin.default/package.json index 174c0262..3364c37a 100644 --- a/plugins/c9.ide.plugins/templates/plugin.default/package.json +++ b/plugins/c9.ide.plugins/templates/plugin.default/package.json @@ -1,5 +1,5 @@ { - "name": "c9.ide.default", + "name": "", "description": "", "version": "0.0.1", "author": "", diff --git a/plugins/c9.ide.plugins/templates/plugin.installer/README.md b/plugins/c9.ide.plugins/templates/plugin.installer/README.md new file mode 100644 index 00000000..9de9f3a9 --- /dev/null +++ b/plugins/c9.ide.plugins/templates/plugin.installer/README.md @@ -0,0 +1 @@ +This is the Cloud9 installer plugin example \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.installer/install.js b/plugins/c9.ide.plugins/templates/plugin.installer/install.js new file mode 100644 index 00000000..f87bdec5 --- /dev/null +++ b/plugins/c9.ide.plugins/templates/plugin.installer/install.js @@ -0,0 +1,57 @@ +define(function(require, exports, module) { + +module.exports = function(session, options){ + // Dependencies for the collaboration features of Cloud9 + + session.install({ + "name": "SQLite", + "description": "SQLite Database and NPM module", + "cwd": "~/.c9", + "optional": true + }, [ + { + "npm": ["sqlite3@3.0.5"] + }, + { + "tar.gz": { + "url": "https://raw.githubusercontent.com/c9/install/master/packages/sqlite3/linux/sqlite3.tar.gz", + "target": "~/.c9/lib/sqlite3", + "dir": "sqlite3" + } + }, + { + "symlink": { + "source": "~/.c9/lib/sqlite3/sqlite3", + "target": "~/.c9/bin/sqlite3" + } + } + ]); + + session.install({ + "name": "Sequalize", + "description": "Sequalize NPM module", + "cwd": "~/.c9", + "optional": true + }, { + "npm": ["sequelize@2.0.0-beta.0"] + }); + + session.install({ + "name": "Collab Server", + "description": "A small Node.js collaboration server", + "cwd": "~/.c9", + "optional": true + }, { + "tar.gz": { + "url": "https://raw.githubusercontent.com/c9/install/master/packages/extend/c9-vfs-extend.tar.gz", + "target": "~/.c9" + } + }); + + // Show the installation screen + session.start(); +}; + +module.exports.version = 1; + +}); \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.installer/package.json b/plugins/c9.ide.plugins/templates/plugin.installer/package.json new file mode 100644 index 00000000..9013bf77 --- /dev/null +++ b/plugins/c9.ide.plugins/templates/plugin.installer/package.json @@ -0,0 +1,22 @@ +{ + "name": "", + "description": "", + "version": "0.0.1", + "author": "", + "contributors": [ + { + "name": "", + "email": "" + } + ], + "repository": { + "type": "git", + "url": "" + }, + "plugins": {}, + "installer": "install.js", + "categories": [ + "misc" + ], + "licenses": [] +} \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.simple/README.md b/plugins/c9.ide.plugins/templates/plugin.simple/README.md index 566c1196..8ac7218b 100644 --- a/plugins/c9.ide.plugins/templates/plugin.simple/README.md +++ b/plugins/c9.ide.plugins/templates/plugin.simple/README.md @@ -1,3 +1 @@ -# c9.ide.simple - This is the Cloud9 simple plugin example \ No newline at end of file diff --git a/plugins/c9.ide.plugins/templates/plugin.simple/package.json b/plugins/c9.ide.plugins/templates/plugin.simple/package.json index f782d88e..3364c37a 100644 --- a/plugins/c9.ide.plugins/templates/plugin.simple/package.json +++ b/plugins/c9.ide.plugins/templates/plugin.simple/package.json @@ -1,5 +1,5 @@ { - "name": "c9.ide.simple", + "name": "", "description": "", "version": "0.0.1", "author": "", diff --git a/plugins/c9.nodeapi/events.js b/plugins/c9.nodeapi/events.js index 5bf4e755..027cace5 100644 --- a/plugins/c9.nodeapi/events.js +++ b/plugins/c9.nodeapi/events.js @@ -146,7 +146,7 @@ EventEmitter.prototype.addListener = function(type, listener, plugin) { if (m && m > 0 && eventList.length > m) { eventList.warned = true; - console.error('(node) warning: possible EventEmitter memory ' + console.error('warning: possible EventEmitter memory ' + 'leak detected. " + eventList.length + " listeners of type "' + type + '" added. ' + 'Use emitter.setMaxListeners() to increase limit.' ); diff --git a/plugins/c9.vfs.extend/collab-server.js b/plugins/c9.vfs.extend/collab-server.js index 8e77d0fe..89ac7283 100644 --- a/plugins/c9.vfs.extend/collab-server.js +++ b/plugins/c9.vfs.extend/collab-server.js @@ -1,7 +1,4 @@ -// Uglify -// uglifyjs -c -m -o collab-server.js plugins/c9.vfs.extend/collab-server.js -// Deploy to shared space: -// scp -o LogLevel=ERROR -o StrictHostKeyChecking=no -i c9/node_modules/settings/keys/deploy collab-server.js 52ee501f50044657c4000005@project-livec99d49a9ef92.rhcloud.com:/var/lib/openshift/52ee501f50044657c4000005/app-root/data/759814/root/c9-vfs-extend/collab-server.js + "use strict"; var Fs = require("fs"); var Path = require("path"); @@ -2763,48 +2760,10 @@ var exports = module.exports = function(vfs, options, register) { exports.Store = Store; exports.compressDocument = compressDocument; -/* Google diff match patch library: https://code.google.com/p/google-diff-match-patch/ */ - var DIFF_EQUAL = 0; var DIFF_INSERT = 1; var DIFF_DELETE = -1; -function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Match_Threshold=0.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=0.5;this.Patch_Margin=4;this.Match_MaxBits=32} -diff_match_patch.prototype.diff_main=function(a,b,c,d){"undefined"==typeof d&&(d=0>=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error("Null input. (diff_main)");if(a==b)return a?[[0,a]]:[];"undefined"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b),c=a.substring(0,f),a=a.substring(f),b=b.substring(f),f=this.diff_commonSuffix(a,b),g=a.substring(a.length-f),a=a.substring(0,a.length-f),b=b.substring(0,b.length-f),a=this.diff_compute_(a,b,e,d);c&&a.unshift([0,c]);g&&a.push([0,g]);this.diff_cleanupMerge(a);return a}; -diff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[[1,b]];if(!b)return[[-1,a]];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);if(-1!=g)return c=[[1,e.substring(0,g)],[0,f],[1,e.substring(g+f.length)]],a.length>b.length&&(c[0][0]=c[2][0]=-1),c;if(1==f.length)return[[-1,a],[1,b]];return(e=this.diff_halfMatch_(a,b))?(f=e[0],a=e[1],g=e[2],b=e[3],e=e[4],f=this.diff_main(f,g,c,d),c=this.diff_main(a,b,c,d),f.concat([[0,e]],c)):c&&100c);u++){for(var n=-u+q;n<=u-s;n+=2){var l=g+n,m;m=n==-u||n!=u&&j[l-1]d)s+=2;else if(r>e)q+=2;else if(p&&(l=g+k-n,0<=l&&l=t)return this.diff_bisectSplit_(a,b,m,r,c)}}for(n=-u+o;n<=u-v;n+=2){l=g+n;t=n==-u||n!=u&&i[l-1]d)v+=2;else if(m>e)o+=2;else if(!p&&(l=g+k-n,0<=l&&l=t)))return this.diff_bisectSplit_(a,b,m,r,c)}}return[[-1,a],[1,b]]}; -diff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d),a=a.substring(c),b=b.substring(d),f=this.diff_main(f,g,!1,e),e=this.diff_main(a,b,!1,e);return f.concat(e)}; -diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,f=-1,g=d.length;fd?a=a.substring(c-d):c=a.length?[h,j,n,l,g]:null}if(0>=this.Diff_Timeout)return null;var d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.lengthd[4].length?g:d:d:g;var j;a.length>b.length?(g=h[0],d=h[1],e=h[2],j=h[3]):(e=h[0],j=h[1],g=h[2],d=h[3]);h=h[4];return[g,d,e,j,h]}; -diff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,j=0,i=0;f=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,[0,c.substring(0,d)]),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,[0,b.substring(0,e)]),a[f-1][0]=1,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=-1,a[f+1][1]=b.substring(e),f++;f++}f++}}; -diff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_),c=g&&c.match(diff_match_patch.linebreakRegex_),d=h&&d.match(diff_match_patch.linebreakRegex_),i=c&&a.match(diff_match_patch.blanklineEndRegex_),j=d&&b.match(diff_match_patch.blanklineStartRegex_);return i||j?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c=i&&(i=k,g=d,h=e,j=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c-1,1),c--),a[c][1]=h,j?a[c+1][1]=j:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\s/;diff_match_patch.linebreakRegex_=/[\r\n]/;diff_match_patch.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/; -diff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,j=!1,i=!1;fb)break;e=c;f=d}return a.length!=g&&-1===a[g][0]?f:f+(b-e)}; -diff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=//g,f=/\n/g,g=0;g");switch(h){case 1:b[g]=''+j+"";break;case -1:b[g]=''+j+"";break;case 0:b[g]=""+j+""}}return b.join("")}; -diff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;cthis.Match_MaxBits)throw Error("Pattern too long for this browser.");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));for(var j=1<=i;o--){var v=e[a.charAt(o-1)];k[o]=0===s?(k[o+1]<<1|1)&v:(k[o+1]<<1|1)&v|(q[o+1]|q[o])<<1|1|q[o+1];if(k[o]&j&&(v=d(s,o-1),v<=g))if(g=v,h=o-1,h>c)i=Math.max(1,2*c-h);else break}if(d(s+1,c)>g)break;q=k}return h}; -diff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c=2*this.Patch_Margin&&e&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}1!==i&&(f+=k.length);-1!==i&&(g+=k.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c}; -diff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;cthis.Match_MaxBits){if(j=this.match_main(b,h.substring(0,this.Match_MaxBits),g),-1!=j&&(i=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==i||j>=i))j=-1}else j=this.match_main(b,h,g);if(-1==j)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=j-g,g=-1==i?b.substring(j,j+h.length):b.substring(j,i+this.Match_MaxBits),h==g)b=b.substring(0,j)+this.diff_text2(a[f].diffs)+b.substring(j+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);for(var h=0,k,i=0;ie[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs;0==e.length||0!=e[e.length-1][0]?(e.push([0,c]),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c}; -diff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c2*b?(h.length1+=i.length,e+=i.length,j=!1,h.diffs.push([g,i]),d.diffs.shift()):(i=i.substring(0,b-h.length1-this.Patch_Margin),h.length1+=i.length,e+=i.length,0===g?(h.length2+=i.length,f+=i.length):j=!1,h.diffs.push([g,i]),i==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(i.length))}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);i=this.diff_text1(d.diffs).substring(0,this.Patch_Margin);""!==i&&(h.length1+=i.length,h.length2+=i.length,0!==h.diffs.length&&0===h.diffs[h.diffs.length-1][0]?h.diffs[h.diffs.length-1][1]+=i:h.diffs.push([0,i]));j||a.splice(++c,0,h)}}}; -diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c=this.Diff_Timeout?Number.MAX_VALUE:(new Date).getTime()+1E3*this.Diff_Timeout);if(null==a||null==b)throw Error("Null input. (diff_main)");if(a==b)return a?[[0,a]]:[];"undefined"==typeof c&&(c=!0);var e=c,f=this.diff_commonPrefix(a,b),c=a.substring(0,f),a=a.substring(f),b=b.substring(f),f=this.diff_commonSuffix(a,b),g=a.substring(a.length-f),a=a.substring(0,a.length-f),b=b.substring(0,b.length-f),a=this.diff_compute_(a,b,e,d);c&&a.unshift([0,c]);g&&a.push([0,g]);this.diff_cleanupMerge(a);return a}; +diff_match_patch.prototype.diff_compute_=function(a,b,c,d){if(!a)return[[1,b]];if(!b)return[[-1,a]];var e=a.length>b.length?a:b,f=a.length>b.length?b:a,g=e.indexOf(f);if(-1!=g)return c=[[1,e.substring(0,g)],[0,f],[1,e.substring(g+f.length)]],a.length>b.length&&(c[0][0]=c[2][0]=-1),c;if(1==f.length)return[[-1,a],[1,b]];return(e=this.diff_halfMatch_(a,b))?(f=e[0],a=e[1],g=e[2],b=e[3],e=e[4],f=this.diff_main(f,g,c,d),c=this.diff_main(a,b,c,d),f.concat([[0,e]],c)):c&&100c);u++){for(var n=-u+q;n<=u-s;n+=2){var l=g+n,m;m=n==-u||n!=u&&j[l-1]d)s+=2;else if(r>e)q+=2;else if(p&&(l=g+k-n,0<=l&&l=t)return this.diff_bisectSplit_(a,b,m,r,c)}}for(n=-u+o;n<=u-v;n+=2){l=g+n;t=n==-u||n!=u&&i[l-1]d)v+=2;else if(m>e)o+=2;else if(!p&&(l=g+k-n,0<=l&&l=t)))return this.diff_bisectSplit_(a,b,m,r,c)}}return[[-1,a],[1,b]]}; +diff_match_patch.prototype.diff_bisectSplit_=function(a,b,c,d,e){var f=a.substring(0,c),g=b.substring(0,d),a=a.substring(c),b=b.substring(d),f=this.diff_main(f,g,!1,e),e=this.diff_main(a,b,!1,e);return f.concat(e)}; +diff_match_patch.prototype.diff_linesToChars_=function(a,b){function c(a){for(var b="",c=0,f=-1,g=d.length;fd?a=a.substring(c-d):c=a.length?[h,j,n,l,g]:null}if(0>=this.Diff_Timeout)return null;var d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(4>d.length||2*e.lengthd[4].length?g:d:d:g;var j;a.length>b.length?(g=h[0],d=h[1],e=h[2],j=h[3]):(e=h[0],j=h[1],g=h[2],d=h[3]);h=h[4];return[g,d,e,j,h]}; +diff_match_patch.prototype.diff_cleanupSemantic=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=0,h=0,j=0,i=0;f=e){if(d>=b.length/2||d>=c.length/2)a.splice(f,0,[0,c.substring(0,d)]),a[f-1][1]=b.substring(0,b.length-d),a[f+1][1]=c.substring(d),f++}else if(e>=b.length/2||e>=c.length/2)a.splice(f,0,[0,b.substring(0,e)]),a[f-1][0]=1,a[f-1][1]=c.substring(0,c.length-e),a[f+1][0]=-1,a[f+1][1]=b.substring(e),f++;f++}f++}}; +diff_match_patch.prototype.diff_cleanupSemanticLossless=function(a){function b(a,b){if(!a||!b)return 6;var c=a.charAt(a.length-1),d=b.charAt(0),e=c.match(diff_match_patch.nonAlphaNumericRegex_),f=d.match(diff_match_patch.nonAlphaNumericRegex_),g=e&&c.match(diff_match_patch.whitespaceRegex_),h=f&&d.match(diff_match_patch.whitespaceRegex_),c=g&&c.match(diff_match_patch.linebreakRegex_),d=h&&d.match(diff_match_patch.linebreakRegex_),i=c&&a.match(diff_match_patch.blanklineEndRegex_),j=d&&b.match(diff_match_patch.blanklineStartRegex_);return i||j?5:c||d?4:e&&!g&&h?3:g||h?2:e||f?1:0}for(var c=1;c=i&&(i=k,g=d,h=e,j=f)}a[c-1][1]!=g&&(g?a[c-1][1]=g:(a.splice(c-1,1),c--),a[c][1]=h,j?a[c+1][1]=j:(a.splice(c+1,1),c--))}c++}};diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;diff_match_patch.whitespaceRegex_=/\s/;diff_match_patch.linebreakRegex_=/[\r\n]/;diff_match_patch.blanklineEndRegex_=/\n\r?\n$/;diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/; +diff_match_patch.prototype.diff_cleanupEfficiency=function(a){for(var b=!1,c=[],d=0,e=null,f=0,g=!1,h=!1,j=!1,i=!1;fb)break;e=c;f=d}return a.length!=g&&-1===a[g][0]?f:f+(b-e)}; +diff_match_patch.prototype.diff_prettyHtml=function(a){for(var b=[],c=/&/g,d=//g,f=/\n/g,g=0;g");switch(h){case 1:b[g]=''+j+"";break;case -1:b[g]=''+j+"";break;case 0:b[g]=""+j+""}}return b.join("")}; +diff_match_patch.prototype.diff_text1=function(a){for(var b=[],c=0;cthis.Match_MaxBits)throw Error("Pattern too long for this browser.");var e=this.match_alphabet_(b),f=this,g=this.Match_Threshold,h=a.indexOf(b,c);-1!=h&&(g=Math.min(d(0,h),g),h=a.lastIndexOf(b,c+b.length),-1!=h&&(g=Math.min(d(0,h),g)));for(var j=1<=i;o--){var v=e[a.charAt(o-1)];k[o]=0===s?(k[o+1]<<1|1)&v:(k[o+1]<<1|1)&v|(q[o+1]|q[o])<<1|1|q[o+1];if(k[o]&j&&(v=d(s,o-1),v<=g))if(g=v,h=o-1,h>c)i=Math.max(1,2*c-h);else break}if(d(s+1,c)>g)break;q=k}return h}; +diff_match_patch.prototype.match_alphabet_=function(a){for(var b={},c=0;c=2*this.Patch_Margin&&e&&(this.patch_addContext_(a,h),c.push(a),a=new diff_match_patch.patch_obj,e=0,h=d,f=g)}1!==i&&(f+=k.length);-1!==i&&(g+=k.length)}e&&(this.patch_addContext_(a,h),c.push(a));return c}; +diff_match_patch.prototype.patch_deepCopy=function(a){for(var b=[],c=0;cthis.Match_MaxBits){if(j=this.match_main(b,h.substring(0,this.Match_MaxBits),g),-1!=j&&(i=this.match_main(b,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits),-1==i||j>=i))j=-1}else j=this.match_main(b,h,g);if(-1==j)e[f]=!1,d-=a[f].length2-a[f].length1;else if(e[f]=!0,d=j-g,g=-1==i?b.substring(j,j+h.length):b.substring(j,i+this.Match_MaxBits),h==g)b=b.substring(0,j)+this.diff_text2(a[f].diffs)+b.substring(j+h.length);else if(g=this.diff_main(h,g,!1),h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=!1;else{this.diff_cleanupSemanticLossless(g);for(var h=0,k,i=0;ie[0][1].length){var f=b-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=a[a.length-1];e=d.diffs;0==e.length||0!=e[e.length-1][0]?(e.push([0,c]),d.length1+=b,d.length2+=b):b>e[e.length-1][1].length&&(f=b-e[e.length-1][1].length,e[e.length-1][1]+=c.substring(0,f),d.length1+=f,d.length2+=f);return c}; +diff_match_patch.prototype.patch_splitMax=function(a){for(var b=this.Match_MaxBits,c=0;c2*b?(h.length1+=i.length,e+=i.length,j=!1,h.diffs.push([g,i]),d.diffs.shift()):(i=i.substring(0,b-h.length1-this.Patch_Margin),h.length1+=i.length,e+=i.length,0===g?(h.length2+=i.length,f+=i.length):j=!1,h.diffs.push([g,i]),i==d.diffs[0][1]?d.diffs.shift():d.diffs[0][1]=d.diffs[0][1].substring(i.length))}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);i=this.diff_text1(d.diffs).substring(0,this.Patch_Margin);""!==i&&(h.length1+=i.length,h.length2+=i.length,0!==h.diffs.length&&0===h.diffs[h.diffs.length-1][0]?h.diffs[h.diffs.length-1][1]+=i:h.diffs.push([0,i]));j||a.splice(++c,0,h)}}}; +diff_match_patch.prototype.patch_toText=function(a){for(var b=[],c=0;c