diff --git a/README.md b/README.md index 989805aa..32811a8f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ During the alpha stage, expect many things to break, not work or simply fail. #### Creating Plugins #### -The best and easiest way to create plugins is on c9.io. Please check out this tutorial for how to [get started writing plugins.](http://cloud9-sdk.readme.io/v0.1/docs/getting-started) +The best and easiest way to create plugins is on c9.io. Please check out this tutorial for how to [get started writing plugins.](http://cloud9-sdk.readme.io/v0.1/docs/getting-started-with-cloud9-plugins) We also have a tutorial for how to get started working on the core plugins. [Check out that tutorial here.](http://cloud9-sdk.readme.io/v0.1/docs/contributing-to-existing-packages) @@ -79,4 +79,4 @@ To protect the interests of the Cloud9 contributors and users we require contrib If you want to contribute to the Cloud9 SDK and/or open source plugins please go to the online form, fill it out and submit it. -Happy coding, Cloud9 \ No newline at end of file +Happy coding, Cloud9 diff --git a/build/build-local.sh b/build/build-local.sh index 920b3a84..4f85a5f2 100755 --- a/build/build-local.sh +++ b/build/build-local.sh @@ -24,6 +24,7 @@ case "$uname" in *x86_64*) arch=x64 ;; *i*86*) arch=x86 ;; *armv6l*) arch=arm-pi ;; + *armv7l*) arch=arm-pi ;; esac showStatus () { printf "\e[1A\e[0K\r%s\n" $1; } diff --git a/build/build-standalone.sh b/build/build-standalone.sh index 37e1100c..bda190f1 100755 --- a/build/build-standalone.sh +++ b/build/build-standalone.sh @@ -24,6 +24,7 @@ case "$uname" in *x86_64*) arch=x64 ;; *i*86*) arch=x86 ;; *armv6l*) arch=arm-pi ;; + *armv7l*) arch=arm-pi ;; esac showStatus () { printf "\e[1A\e[0K\r%s\n" $1; } @@ -89,7 +90,7 @@ console.log('Client Plugins:'); }); console.log('CLI Plugins:'); - plugins = require('./configs/cli'); + plugins = require('./configs/cli')(); copy.dirs('$SOURCE', '$APPDIR', pluginDirs(plugins), { exclude: /^mock$/, }); diff --git a/node_modules/ace/lib/ace/keyboard/vim.js b/node_modules/ace/lib/ace/keyboard/vim.js index d3066bf1..e775b1eb 100644 --- a/node_modules/ace/lib/ace/keyboard/vim.js +++ b/node_modules/ace/lib/ace/keyboard/vim.js @@ -733,10 +733,14 @@ CodeMirror.defineExtension = function(name, fn) { CodeMirror.prototype[name] = fn; }; dom.importCssString(".normal-mode .ace_cursor{\ - border: 0!important;\ + border: 1px solid red;\ background-color: red;\ opacity: 0.5;\ -}.ace_dialog {\ +}\ +.normal-mode .ace_hidden-cursors .ace_cursor{\ + background-color: transparent;\ +}\ +.ace_dialog {\ position: absolute;\ left: 0; right: 0;\ background: white;\ @@ -762,23 +766,6 @@ dom.importCssString(".normal-mode .ace_cursor{\ font-family: monospace;\ }", "vimMode"); (function() { - function dialogDiv(cm, template, bottom) { - var wrap = cm.ace.container; - var dialog; - dialog = wrap.appendChild(document.createElement("div")); - if (bottom) - dialog.className = "ace_dialog ace_dialog-bottom"; - else - dialog.className = "ace_dialog ace_dialog-top"; - - if (typeof template == "string") { - dialog.innerHTML = template; - } else { // Assuming it's a detached DOM element. - dialog.appendChild(template); - } - return dialog; - } - function closeNotification(cm, newVal) { if (cm.state.currentNotificationClose) cm.state.currentNotificationClose(); @@ -5814,7 +5801,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ }, true); } return isHandled; - }; + } exports.CodeMirror = CodeMirror; var getVim = Vim.maybeInitVimState_; exports.handler = { @@ -5828,9 +5815,9 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (!vim.insertMode) { var isbackwards = !sel.cursor ? session.selection.isBackwards() || session.selection.isEmpty() - : Range.comparePoints(sel.cursor, sel.start) <= 0 + : Range.comparePoints(sel.cursor, sel.start) <= 0; if (!isbackwards && left > w) - left -= w + left -= w; } if (!vim.insertMode && vim.status) { h = h / 2; @@ -5991,16 +5978,16 @@ dom.importCssString(".normal-mode .ace_cursor{\ } } } - } + }; var renderVirtualNumbers = { getText: function(session, row) { - return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9? "\xb7" : "" ))) + "" + return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9? "\xb7" : "" ))) + ""; }, getWidth: function(session, lastLineNumber, config) { return session.getLength().toString().length * config.characterWidth; }, update: function(e, editor) { - editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER) + editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER); }, attach: function(editor) { editor.renderer.$gutterLayer.$renderer = this; @@ -6042,7 +6029,7 @@ dom.importCssString(".normal-mode .ace_cursor{\ if (cm.ace.inVirtualSelectionMode) cm.ace.on("beforeEndOperation", delayedExecAceCommand); else - delayedExecAceCommand(null, cm.ace) + delayedExecAceCommand(null, cm.ace); }; function delayedExecAceCommand(op, ace) { ace.off("beforeEndOperation", delayedExecAceCommand); diff --git a/node_modules/c9/passcrypt.js b/node_modules/c9/passcrypt.js index 05295bf8..081f7e00 100644 --- a/node_modules/c9/passcrypt.js +++ b/node_modules/c9/passcrypt.js @@ -5,7 +5,13 @@ */ var hashing = require('./hashing'); -var bcrypt = require('bcrypt'); +var bcrypt; +try { + bcrypt = require('bcrypt'); +} catch (e) { + console.error("Failed to load brcrypt - binary version mismatch?", e.stack); + process.exit(1); +} var SALT_LENGTH = 8; exports.encrypt = function(password, callback) { diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index 93701c70..36d0f3aa 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -129,7 +129,21 @@ module.exports = function setup(fsOptions) { } else { fsOptions.defaultEnv = process.env; } - + + // Fetch environment variables from the login shell + if (!isWin) { + _execFile(BASH, ["-lc", "printenv -0"], function(error, stdout, stderr) { + if (!error && !stderr && stdout) { + var env = fsOptions.defaultEnv; + stdout.split("\x00").forEach(function(entry) { + var i = entry.indexOf("="); + if (i != -1) + env[entry.slice(0, i)] = entry.slice(i + 1); + }); + } + }); + } + // Storage for extension APIs var apis = {}; // Storage for event handlers diff --git a/package.json b/package.json index c97cc1b3..21f15344 100644 --- a/package.json +++ b/package.json @@ -59,16 +59,16 @@ "c9.ide.language.javascript.eslint": "#cf4b2d05af", "c9.ide.language.javascript.tern": "#a65ad88dd9", "c9.ide.language.javascript.infer": "#ebb2daf81a", - "c9.ide.language.jsonalyzer": "#722983bf96", + "c9.ide.language.jsonalyzer": "#5262f6b4b9", "c9.ide.collab": "#74e0a2d340", "c9.ide.local": "#2bfd7ff051", "c9.ide.find": "#989c06e6a7", "c9.ide.find.infiles": "#28b3cfcb47", "c9.ide.find.replace": "#43a6b95e6a", - "c9.ide.run.debug": "#8421e5e3a5", + "c9.ide.run.debug": "#789019f9a7", "c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.gotoline": "#4d1a93172c", - "c9.ide.ace.keymaps": "#1e42293fb9", + "c9.ide.ace.keymaps": "#2477fd8ac6", "c9.ide.ace.repl": "#ada99852fa", "c9.ide.ace.split": "#0ae0151c78", "c9.ide.ace.statusbar": "#d7b45bb7c3", @@ -94,7 +94,7 @@ "c9.ide.readonly": "#f6f07bbe42", "c9.ide.recentfiles": "#7c099abf40", "c9.ide.remote": "#37773d905b", - "c9.ide.run": "#0a8cc7f0a9", + "c9.ide.run": "#d3873e1447", "c9.ide.run.build": "#6726030127", "c9.ide.save": "#a32a8f4346", "c9.ide.terminal.monitor": "#df9936daa2", diff --git a/plugins/c9.core/ext.js b/plugins/c9.core/ext.js index 0dcead7a..fe7d79c9 100644 --- a/plugins/c9.core/ext.js +++ b/plugins/c9.core/ext.js @@ -124,12 +124,6 @@ define(function(require, exports, module) { return usedBy } - function loadRemotePlugin(id, options, callback) { - vfs.extend(id, options, function(err, meta) { - callback(err, meta && meta.api); - }); - } - function unloadAllPlugins(exclude) { if (lut.settings) lut.settings.unload(null, true); @@ -160,6 +154,12 @@ define(function(require, exports, module) { } } + function loadRemotePlugin(id, options, callback) { + vfs.extend(id, options, function(err, meta) { + callback(err, meta && meta.api); + }); + } + function fetchRemoteApi(id, callback) { vfs.use(id, {}, function(err, meta) { callback(err, meta && meta.api); diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js index b6919a99..c45d1371 100644 --- a/plugins/c9.ide.ace/ace.js +++ b/plugins/c9.ide.ace/ace.js @@ -2075,7 +2075,7 @@ define(function(require, exports, module) { /***** Lifecycle *****/ - //@todo set selection, scroll and file in header + // @todo set selection, scroll and file in header plugin.on("load", function(){ @@ -2102,7 +2102,7 @@ define(function(require, exports, module) { doc.on("setValue", function set(e) { var aceSession = c9Session.session; if (!aceSession) - return; //This is probably a deconstructed document + return; // This is probably a deconstructed document // The first value that is set should clear the undo stack // additional times setting the value should keep it. @@ -2115,7 +2115,7 @@ define(function(require, exports, module) { hideProgress(); } - if (e.state) + if (e.state) // There is nowhere where e.state is set. Dead code? setState(doc, e.state); if (currentDocument === doc) diff --git a/plugins/c9.ide.console/console.js b/plugins/c9.ide.console/console.js index c3d01435..8ee3b85f 100644 --- a/plugins/c9.ide.console/console.js +++ b/plugins/c9.ide.console/console.js @@ -185,7 +185,7 @@ define(function(require, module, exports) { tabs.on("paneCreate", function(e) { if (hidden && container && ui.isChildOf(container, e.pane.aml)) { - e.pane.visible = false; + e.pane._visible = false; } }); @@ -297,7 +297,7 @@ define(function(require, module, exports) { maxHeight = window.innerHeight - 70; getPanes().forEach(function(pane) { - pane.visible = !shouldHide; + pane._visible = !shouldHide; }); if (!shouldHide && !tabs.focussedTab) { diff --git a/plugins/c9.ide.editors/document.js b/plugins/c9.ide.editors/document.js index 5326b831..25f217ea 100644 --- a/plugins/c9.ide.editors/document.js +++ b/plugins/c9.ide.editors/document.js @@ -330,7 +330,7 @@ define(function(require, module, exports) { get editor(){ return editor; }, set editor(v) { editor = v; - emit("setEditor", {editor: v}); + emit("setEditor", { editor: v }); }, /** * Whether the document is fully loaded @@ -340,7 +340,7 @@ define(function(require, module, exports) { set ready(v) { if (ready) throw new Error("Permission Denied"); ready = true; - emit.sticky("ready"); + emit.sticky("ready", { doc: plugin }); }, /** * The tooltip displayed when hovering over the tab button @@ -349,7 +349,7 @@ define(function(require, module, exports) { get tooltip(){ return tooltip; }, set tooltip(v) { tooltip = v; - emit("setTooltip", {tooltip: v}); + emit("setTooltip", { tooltip: v }); }, /** * The title of the document (displayed as caption of the tab button) @@ -358,18 +358,18 @@ define(function(require, module, exports) { get title(){ return title; }, set title(v) { title = v; - emit("setTitle", {title: v}); + emit("setTitle", { title: v }); }, /** * Sets or retrieves the serialized value of this document. - * Setting this document will not change the undo stack. Set + * Setting this property will not change the undo stack. Set * this property only to initialize the document or to reset * the value of this document. Requesting the value of this * document will cause it to serialize it's full state. * @property {String} value */ get value(){ - var calculated = emit("getValue", {value: value}); + var calculated = emit("getValue", { value: recentValue || value }); if (typeof calculated != "string") calculated = value; @@ -380,7 +380,7 @@ define(function(require, module, exports) { }, set value(v) { value = recentValue = v; - emit("setValue", {value: v}); + emit("setValue", { value: v }); hasValue = true; }, /** diff --git a/plugins/c9.ide.editors/editor.js b/plugins/c9.ide.editors/editor.js index cb7f573f..d51d8646 100644 --- a/plugins/c9.ide.editors/editor.js +++ b/plugins/c9.ide.editors/editor.js @@ -205,7 +205,8 @@ define(function(require, module, exports) { /***** Register and define API *****/ - plugin.freezePublicAPI.baseclass(); + // This is a base class + plugin.baseclass(); /** * Editor base class for Cloud9 Editors. Each file that is opened diff --git a/plugins/c9.ide.editors/pane.js b/plugins/c9.ide.editors/pane.js index 359bcc24..851de469 100644 --- a/plugins/c9.ide.editors/pane.js +++ b/plugins/c9.ide.editors/pane.js @@ -657,20 +657,18 @@ define(function(require, module, exports) { * @readonly */ get group(){ - function getGroup(amlPane) { - var pNode = amlPane.parentNode; + var pNode = amlPane.parentNode; + + if (pNode.localName.indexOf("splitbox") == -1) + return false; - if (pNode.localName.indexOf("splitbox") == -1) - return false; - - var result = pNode.childNodes.map(function(aml) { - return aml.cloud9pane; - }); - // result.__defineGetter__("group", function(){ - // return getGroup(pNode) - // }); - return result; - } + var result = []; + pNode.childNodes.forEach(function(aml) { + if (aml.cloud9pane) + result.push(aml.cloud9pane); + }); + + return result; }, /** @@ -703,7 +701,8 @@ define(function(require, module, exports) { * @readonly */ get visible(){ return visible; }, - set visible(v){ visible = v; }, + set visible(v){ amlPane.setProperty("visible", v); visible = v; }, + set _visible(v){ visible = v; }, /** * Retrieves the meta object for this panel diff --git a/plugins/c9.ide.editors/undomanager.js b/plugins/c9.ide.editors/undomanager.js index e5c6f5d9..c88355c2 100644 --- a/plugins/c9.ide.editors/undomanager.js +++ b/plugins/c9.ide.editors/undomanager.js @@ -137,7 +137,7 @@ define(function(require, module, exports) { } function findItem(compressedItem) { - return emit("itemFind", {state: compressedItem}); + return emit("itemFind", { state: compressedItem }); } function reset(){ @@ -205,8 +205,8 @@ define(function(require, module, exports) { * } * * var undoManager = new UndoManager(); - * undoManager.add(new Item("a", 0)); // data = ["a"] - * undoManager.add(new Item("b", 1)); // data = ["a", "b"] + * undoManager.add(new Item("a").redo()); // data = ["a"] + * undoManager.add(new Item("b").redo()); // data = ["a", "b"] * * undoManager.undo(); // data = ["a"]; * undoManager.undo(); // data = []; diff --git a/plugins/c9.ide.keys/commands.js b/plugins/c9.ide.keys/commands.js index 2232c6ce..0815c7df 100644 --- a/plugins/c9.ide.keys/commands.js +++ b/plugins/c9.ide.keys/commands.js @@ -288,12 +288,12 @@ define(function(require, exports, module) { return commands; } - function reset(noReload){ + function reset(noReload, toDefault){ commandManager.commandKeyBinding = {}; Object.keys(commands).forEach(function(name) { var cmd = commands[name]; - bindKey(cmd.originalBindKey, cmd); + bindKey(toDefault ? cmd.originalBindKey : cmd.bindKey, cmd); }); if (noReload) diff --git a/plugins/c9.ide.keys/editor.js b/plugins/c9.ide.keys/editor.js index 7a2f5118..e6c90708 100644 --- a/plugins/c9.ide.keys/editor.js +++ b/plugins/c9.ide.keys/editor.js @@ -173,9 +173,10 @@ define(function(require, exports, module) { "By resetting your keybindings to their " + "defaults you will lose all custom keybindings.", function(){ + settings.setJson("user/key-bindings", []); settings.set("user/ace/@keyboardmode", "default"); settings.set("user/key-bindings/@platform", "auto"); - reset(); + commands.reset(false, true); }, function(){}); }, position: 90 diff --git a/plugins/c9.vfs.client/endpoint.js b/plugins/c9.vfs.client/endpoint.js index faee60f3..95e20d6e 100644 --- a/plugins/c9.vfs.client/endpoint.js +++ b/plugins/c9.vfs.client/endpoint.js @@ -16,7 +16,7 @@ define(function(require, exports, module) { var plugin = new Plugin("Ajax.org", main.consumes); var emit = plugin.getEmitter(); - var urlServers; + var urlServers, lastVfs; var query = require("url").parse(document.location.href, true).query; if (query.vfs) { if (!query.vfs.match(/^https:\/\/.*\/vfs$/)) @@ -164,7 +164,6 @@ define(function(require, exports, module) { return callback(new Error("Disconnected: Could not reach your workspace. Please try again later.")); var server = servers[i]; - auth.request(server.url + "/" + options.pid, { method: "POST", timeout: 120000, @@ -268,22 +267,24 @@ define(function(require, exports, module) { }; var data = JSON.stringify(vfs); - var oldData = window.sessionStorage.getItem("vfsid"); + + var oldData = lastVfs || window.sessionStorage.getItem("vfsid"); if (oldData && oldData !== data) deleteOldVfs(); - - try { - window.sessionStorage.setItem("vfsid", data); - } catch(e) { - // could throw a quota exception - } + + lastVfs = data; + return vfs; } function recallVfs() { var vfs; try { - vfs = JSON.parse(window.sessionStorage.getItem("vfsid")); + vfs = JSON.parse(lastVfs || window.sessionStorage.getItem("vfsid")); + if (!lastVfs) { + window.sessionStorage.removeItem("vfsid"); + lastVfs = JSON.stringify(vfs); + } } catch (e) {} if (!vfs) @@ -300,10 +301,11 @@ define(function(require, exports, module) { function deleteOldVfs() { var vfs; try { - vfs = JSON.parse(window.sessionStorage.getItem("vfsid")); + vfs = JSON.parse(lastVfs || window.sessionStorage.getItem("vfsid")); } catch (e) {} window.sessionStorage.removeItem("vfsid"); + lastVfs = null; if (!vfs) return; auth.request(vfs.vfsid, { @@ -315,13 +317,29 @@ define(function(require, exports, module) { if (err) console.error(vfs.vfsid, "deleted", err); }); } - + function fatalError(msg, action) { var err = new Error(msg); err.fatal = true; err.action = action || "reload"; return err; } + + function saveToSessionStorage() { + try { + window.sessionStorage.setItem("vfsid", lastVfs); + } catch(e) { + // could throw a quota exception + } + } + + plugin.on("load", function() { + window.addEventListener("unload", saveToSessionStorage); + }); + + plugin.on("unload", function() { + window.removeEventListener("unload", saveToSessionStorage); + }); /***** Register and define API *****/ diff --git a/scripts/install-sdk.sh b/scripts/install-sdk.sh index 18bf05d4..1a860986 100755 --- a/scripts/install-sdk.sh +++ b/scripts/install-sdk.sh @@ -18,6 +18,7 @@ case "$uname" in *x86_64*) arch=x64 ;; *i*86*) arch=x86 ;; *armv6l*) arch=arm-pi ;; + *armv7l*) arch=arm-pi ;; esac if ! [[ -f ~/.c9/installed ]] && ! [[ $os == "windows" ]]; then @@ -77,4 +78,4 @@ npm install || true echo "Success!" -echo "run 'node server.js -p 8181 -l 0.0.0.0' to launch Cloud9" \ No newline at end of file +echo "run 'node server.js -p 8181 -l 0.0.0.0' to launch Cloud9" diff --git a/scripts/setup-local-dev.sh b/scripts/setup-local-dev.sh index db8a7b04..64eec9d7 100755 --- a/scripts/setup-local-dev.sh +++ b/scripts/setup-local-dev.sh @@ -24,6 +24,7 @@ case "$uname" in *x86_64*) arch=x64 ;; *i*86*) arch=x86 ;; *armv6l*) arch=arm-pi ;; + *armv7l*) arch=arm-pi ;; esac