From cb9e4b38e461ada6b8304e2eb93a1f2c5a0d4af5 Mon Sep 17 00:00:00 2001 From: c9bot Date: Mon, 9 Mar 2015 13:11:33 +0000 Subject: [PATCH 1/6] c9-auto-bump 3.0.1039 --- local/install.sh | 242 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 36 +++---- 2 files changed, 261 insertions(+), 17 deletions(-) create mode 100755 local/install.sh diff --git a/local/install.sh b/local/install.sh new file mode 100755 index 00000000..4075cb6c --- /dev/null +++ b/local/install.sh @@ -0,0 +1,242 @@ +#!/bin/bash -e +set -e +has() { + type "$1" > /dev/null 2>&1 + return $? +} + +# Redirect stdout ( > ) into a named pipe ( >() ) running "tee" +exec > >(tee /tmp/installlog.txt) + +# Without this, only stdout would be captured - i.e. your +# log file would not contain any error messages. +exec 2>&1 + +NODE_VERSION=v0.10.28 +APPSUPPORT_USER=$HOME/.c9 +SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +RUNTIME=$SCRIPT/.. +INSTALL_DIR=/tmp/c9-`date '+%s'` +ORIGINAL_USER=`basename $HOME` +OSX_INSTALLER_PATH=$2 + +start() { + if [ $# -lt 1 ]; then + start base + return + fi + + # Try to figure out the os and arch for binary fetching + local uname="$(uname -a)" + local os= + local arch="$(uname -m)" + case "$uname" in + Linux\ *) os=linux ;; + Darwin\ *) os=darwin ;; + SunOS\ *) os=sunos ;; + FreeBSD\ *) os=freebsd ;; + esac + case "$uname" in + *x86_64*) arch=x64 ;; + *i*86*) arch=x86 ;; + *armv6l*) arch=arm-pi ;; + esac + + if [ $os != "linux" ] && [ $os != "darwin" ]; then + echo "Unsupported Platform: $os $arch" 1>&2 + exit 1 + fi + + if [ $arch != "x64" ] && [ $arch != "x86" ]; then + echo "Unsupported Architecture: $os $arch" 1>&2 + exit 1 + fi + + if [ $os == "darwin" ]; then + APPSUPPORT_USER="$HOME/Library/Application Support/Cloud9" + APPTARGET=$OSX_INSTALLER_PATH + APPSUPPORT="/Library/Application Support/Cloud9" + RUNTIME="${APPTARGET}/Contents/Resources/app.nw" + fi + + case $1 in + "help" ) + echo + echo "Cloud9 Installer" + echo + echo "Usage:" + echo " install help Show this message" + echo " install install [name [name ...]] Download and install a set of packages" + echo " install ls List available packages" + echo + ;; + + "ls" ) + echo "!node - Node.js" + echo "!tmux_install - TMUX" + echo "!nak - NAK" + echo "!vfsextend - VFS extend" + echo "!ptyjs - pty.js" + echo "!c9cli - C9 CLI" + echo "!sc - Sauce Connect" + echo "coffee - Coffee Script" + echo "less - Less" + echo "sass - Sass" + echo "typescript - TypeScript" + echo "stylus - Stylus" + # echo "go - Go" + # echo "heroku - Heroku" + # echo "rhc - RedHat OpenShift" + # echo "gae - Google AppEngine" + ;; + + "install" ) + shift + + # make sure dirs are around + mkdir -p "$APPSUPPORT/bin" + mkdir -p "$APPSUPPORT/node_modules" + cd "$APPSUPPORT" + + cp -a "$SCRIPT" "$INSTALL_DIR" + + # install packages + while [ $# -ne 0 ] + do + time eval ${1} $os $arch + shift + done + + # finalize + #pushd $APPSUPPORT/node_modules/.bin + #for FILE in $APPSUPPORT/node_modules/.bin/*; do + # if [ `uname` == Darwin ]; then + # sed -i "" -E s:'#!/usr/bin/env node':"#!$NODE":g $(readlink $FILE) + # else + # sed -i -E s:'#!/usr/bin/env node':"#!$NODE":g $(readlink $FILE) + # fi + #done + #popd + + VERSION=`cat $RUNTIME/version || echo 1` + echo 1 > "$APPSUPPORT/installed" + echo $VERSION > "$APPSUPPORT/version" + + # set chown/chmod of application dirs for update + echo "Testing existence of APPTARGET (${APPTARGET})" + if [ -d "$APPTARGET" ]; then + echo "Updating permissions of APPTARGET (${APPTARGET})" + chown -R root:admin "$APPTARGET" || chown -R root:staff "$APPTARGET" + chmod -R 775 "$APPTARGET" + fi + + echo "Testing existence of APPSUPPORT (${APPSUPPORT})" + if [ -d "$APPSUPPORT" ]; then + echo "Updating permissions of APPSUPPORT (${APPSUPPORT})" + chown -R root:admin "$APPSUPPORT" || chown -R root:staff "$APPSUPPORT" + chmod -R 775 "$APPSUPPORT" + fi + + echo "Testing existence of APPSUPPORT_USER (${APPSUPPORT_USER})" + if [ -n "$ORIGINAL_USER" ] && [ -d "$APPSUPPORT_USER" ]; then + echo "Updating permissions of APPSUPPORT_USER (${APPSUPPORT_USER})" + chown -R $ORIGINAL_USER "$APPSUPPORT_USER" + fi + + rm -Rf $INSTALL_DIR + + echo :Done. + ;; + + "base" ) + echo "Installing base packages. Use '`basename $0` help' for more options" + start install node tmux_install nak ptyjs sc vfsextend c9cli + ;; + + * ) + start base + ;; + esac +} + +# NodeJS + +node(){ + # clean up + rm -rf node + rm -rf node-$NODE_VERSION* + + echo :Installing Node $NODE_VERSION + + cd "$INSTALL_DIR" + tar xvfz node-$NODE_VERSION-$1-$2.tar.gz + rm -Rf "$APPSUPPORT/node" + mv node-$NODE_VERSION-$1-$2 "$APPSUPPORT/node" +} + +tmux_install(){ + echo :Installing TMUX + mkdir -p "$APPSUPPORT/bin" + + if [ $os = "darwin" ]; then + cd "$INSTALL_DIR" + python rudix.py -i libevent-2.0.21-0.pkg + python rudix.py -i tmux-1.9-0.pkg + + if ! type "/usr/local/bin/tmux"; then + echo "Installation Failed" + exit 100 + fi + + ln -sf "/usr/local/bin/tmux" "$APPSUPPORT/bin/tmux" + # Linux + else + echo "Unsupported" + fi +} + +vfsextend(){ + echo :Installing VFS extend + cd "$INSTALL_DIR" + tar xvfz c9-vfs-extend.tar.gz + rm -Rf "$APPSUPPORT/c9-vfs-extend" + mv c9-vfs-extend "$APPSUPPORT" +} + +sc(){ + echo :Installing Sauce Connect + cd "$INSTALL_DIR" + tar xvzf sc-4.0-latest.tar.gz + rm -rf "$APPSUPPORT/sc" + mv sc-4.0-latest "$APPSUPPORT/sc" +} + +nak(){ + echo :Installing Nak + cd "$INSTALL_DIR" + tar -zxvf nak.tar.gz + mkdir -p "$APPSUPPORT/node_modules/.bin" + rm -Rf "$APPSUPPORT/node_modules/nak" + mv nak "$APPSUPPORT/node_modules" + ln -s "$APPSUPPORT/node_modules/nak/bin/nak" "$APPSUPPORT/node_modules/.bin/nak" &2> /dev/null +} + +ptyjs(){ + echo :Installing pty.js + cd "$INSTALL_DIR" + tar -zxvf pty-$NODE_VERSION-$1-$2.tar.gz + mkdir -p "$APPSUPPORT/node_modules" + rm -Rf "$APPSUPPORT/node_modules/pty.js" + mv pty.js "$APPSUPPORT/node_modules" +} + +c9cli(){ + if [ -d "/usr/local/bin/" ]; then + chmod +x "$RUNTIME/bin/c9" + ln -s -f "$RUNTIME/bin/c9" /usr/local/bin/c9 + else + echo "unable to add c9cli to the path" + fi +} + +start $@ diff --git a/package.json b/package.json index 96cc49bd..7a893a9e 100644 --- a/package.json +++ b/package.json @@ -49,23 +49,24 @@ }, "licenses": [], "c9plugins": { - "c9.ide.language": "#34de5e56ae", + "c9.ide.language": "#4a23a36945", "c9.ide.language.css": "#afda1f867c", "c9.ide.language.generic": "#87a4a44671", "c9.ide.language.html": "#fa4833e117", "c9.ide.language.html.diff": "#a7311cfc9f", - "c9.ide.language.javascript": "#26cf518b28", + "c9.ide.language.javascript": "#8479d0a9c1", "c9.ide.language.javascript.immediate": "#9a2cce9121", - "c9.ide.language.javascript.eslint": "#1baacc275b", - "c9.ide.language.javascript.tern": "#a65ad88dd9", + "c9.ide.language.javascript.eslint": "#8832423ad1", + "c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.infer": "#ebb2daf81a", - "c9.ide.language.jsonalyzer": "#c5dfe5fb7e", - "c9.ide.collab": "#e2a500a964", + "c9.ide.language.jsonalyzer": "#a1057f20db", + "c9.ide.collab": "#7b09419b5c", "c9.ide.local": "#2bfd7ff051", "c9.ide.find": "#989c06e6a7", "c9.ide.find.infiles": "#f98dfef554", "c9.ide.find.replace": "#e4daf722b8", - "c9.ide.run.debug": "#a3e0f7b134", + "c9.ide.run.debug": "#6b7ab83781", + "c9.automate": "#86bf1ee1ca", "c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.gotoline": "#4d1a93172c", "c9.ide.ace.keymaps": "#6c4bb65b1f", @@ -73,32 +74,33 @@ "c9.ide.ace.split": "#0ae0151c78", "c9.ide.ace.statusbar": "#d7b45bb7c3", "c9.ide.ace.stripws": "#34426a03d1", - "c9.ide.behaviors": "#3dbcad4203", + "c9.ide.behaviors": "#6aad7006a0", "c9.ide.closeconfirmation": "#a28bfd8272", "c9.ide.configuration": "#b8470f4107", "c9.ide.dialog.wizard": "#a588b64050", "c9.ide.fontawesome": "#781602c5d8", - "c9.ide.format": "#1ae38e60e6", + "c9.ide.format": "#f51451ac57", "c9.ide.help.support": "#60e88f5680", "c9.ide.imgeditor": "#08bbc53578", "c9.ide.immediate": "#e9ba147cc2", "c9.ide.installer": "#24e7d6f399", "c9.ide.mount": "#32e79866ee", - "c9.ide.navigate": "#eab638cc2f", + "c9.ide.navigate": "#64156c7f4a", "c9.ide.newresource": "#9a7464cc47", "c9.ide.openfiles": "#28a4f5af16", - "c9.ide.preview": "#3c4dded23f", - "c9.ide.preview.browser": "#be197b0464", - "c9.ide.preview.markdown": "#bf952685f6", + "c9.ide.preview": "#dba2f4214d", + "c9.ide.preview.browser": "#ac18aaf31d", + "c9.ide.preview.markdown": "#ab8d30ad9f", "c9.ide.pubsub": "#92ec19ed3a", "c9.ide.readonly": "#f6f07bbe42", "c9.ide.recentfiles": "#7c099abf40", - "c9.ide.remote": "#37773d905b", - "c9.ide.run": "#f5a056e6ce", + "c9.ide.remote": "#cd45e81d2f", + "c9.ide.run": "#e510a39b4b", "c9.ide.run.build": "#6726030127", + "c9.ide.run.debug.xdebug": "#b91d23f48b", "c9.ide.save": "#a32a8f4346", - "c9.ide.terminal.monitor": "#df9936daa2", - "c9.ide.theme.flat": "#5c7c27ab74", + "c9.ide.terminal.monitor": "#b0b4d03280", + "c9.ide.theme.flat": "#b1d65fa9bb", "c9.ide.threewaymerge": "#229382aa0b", "c9.ide.undo": "#b028bcb4d5", "c9.ide.upload": "#0bd010d3dc", From 5dff95e0e2fbc9cf4a4b4acd0d9ac0c81cd79ac7 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 9 Mar 2015 13:41:41 +0000 Subject: [PATCH 2/6] don't use client side plugin style --- plugins/c9.ide.server/plugins.js | 215 ++++++++++++++----------------- 1 file changed, 95 insertions(+), 120 deletions(-) diff --git a/plugins/c9.ide.server/plugins.js b/plugins/c9.ide.server/plugins.js index ae1f5601..e9089348 100644 --- a/plugins/c9.ide.server/plugins.js +++ b/plugins/c9.ide.server/plugins.js @@ -4,131 +4,106 @@ * @copyright 2013, Ajax.org B.V. */ -define(function(require, exports, module) { - "use strict"; - - main.consumes = ["Plugin", "connect.static"]; - main.provides = ["c9.static.plugins"]; - return main; +"use strict"; +main.consumes = [ + "connect.static" +]; +main.provides = ["c9.static.plugins"]; - function main(options, imports, register) { - var Plugin = imports.Plugin; - var statics = imports["connect.static"]; - var fs = require("fs"); - - var whitelist = options.whitelist; - var blacklist = options.blacklist; - - /***** Initialization *****/ - - var plugin = new Plugin("Ajax.org", main.consumes); - - var loaded = false; - function load(){ - if (loaded) return false; - loaded = true; - - var requirePaths = { - ace: "lib/ace/lib/ace", - ace_tree: "lib/ace_tree/lib/ace_tree", - treehugger: "lib/treehugger/lib/treehugger", - acorn: "lib/treehugger/lib/treehugger/js", - tern: "lib/tern", - ui: "lib/ui", - c9: "lib/c9", - frontdoor: "lib/frontdoor", - }; - - if (whitelist === "*") { - statics.addStatics([{ - path: __dirname + "/../../node_modules", - mount: "/lib" - }]); +module.exports = main; + +function main(options, imports, register) { + var statics = imports["connect.static"]; + var fs = require("fs"); - statics.addStatics([{ - path: __dirname + "/../../plugins", - mount: "/plugins", - rjs: requirePaths - }]); - } else { - [ - "ace_tree", - "acorn", - "tern", - "treehugger", - "pivottable", - "architect", - "source-map", - "rusha", - "c9", - "ui", - "emmet", - "frontdoor", - "mocha", // TESTING - "chai", // TESTING - ].forEach(function(name) { - statics.addStatics([{ - path: __dirname + "/../../node_modules/" + name, - mount: "/lib/" + name - }]); - }); - - statics.addStatics([{ - path: __dirname + "/../../node_modules/ace", - mount: "/lib/ace", - rjs: requirePaths - }]); - - statics.addStatics(fs.readdirSync(__dirname + "/../") - .filter(function(path) { - if (path in blacklist) - return false; - else if (path in whitelist) - return true; - else if (path.indexOf("c9.ide.") === 0) - return true; - else if (path.indexOf("c9.account") === 0) - return true; - else - return false; - }) - .map(function(path) { - return { - path: __dirname + "/../../plugins/" + path, - mount: "/plugins/" + path - }; - }) - ); - } - - statics.addStatics([{ - path: __dirname + "/www", - mount: "/" - }]); - - statics.addStatics([{ - path: __dirname + "/../../docs", - mount: "/docs" - }]); + var whitelist = options.whitelist; + var blacklist = options.blacklist; + + var requirePaths = { + ace: "lib/ace/lib/ace", + ace_tree: "lib/ace_tree/lib/ace_tree", + treehugger: "lib/treehugger/lib/treehugger", + acorn: "lib/treehugger/lib/treehugger/js", + tern: "lib/tern", + ui: "lib/ui", + c9: "lib/c9", + frontdoor: "lib/frontdoor", + }; + + if (whitelist === "*") { + statics.addStatics([{ + path: __dirname + "/../../node_modules", + mount: "/lib" + }]); - } - - /***** Lifecycle *****/ - - plugin.on("load", function(){ - load(); - }); - plugin.on("unload", function(){ - loaded = false; + statics.addStatics([{ + path: __dirname + "/../../plugins", + mount: "/plugins", + rjs: requirePaths + }]); + } else { + [ + "ace_tree", + "acorn", + "tern", + "treehugger", + "pivottable", + "architect", + "source-map", + "rusha", + "c9", + "ui", + "emmet", + "frontdoor", + "mocha", // TESTING + "chai", // TESTING + ].forEach(function(name) { + statics.addStatics([{ + path: __dirname + "/../../node_modules/" + name, + mount: "/lib/" + name + }]); }); - /***** Register and define API *****/ + statics.addStatics([{ + path: __dirname + "/../../node_modules/ace", + mount: "/lib/ace", + rjs: requirePaths + }]); - plugin.freezePublicAPI({}); - - register(null, { - "c9.static.plugins": plugin - }); + statics.addStatics(fs.readdirSync(__dirname + "/../") + .filter(function(path) { + if (path in blacklist) + return false; + else if (path in whitelist) + return true; + else if (path.indexOf("c9.ide.") === 0) + return true; + else if (path.indexOf("c9.account") === 0) + return true; + else + return false; + }) + .map(function(path) { + return { + path: __dirname + "/../../plugins/" + path, + mount: "/plugins/" + path + }; + }) + ); } -}); \ No newline at end of file + + statics.addStatics([{ + path: __dirname + "/www", + mount: "/" + }]); + + statics.addStatics([{ + path: __dirname + "/../../docs", + mount: "/docs" + }]); + + register(null, { + "c9.static.plugins": {} + }); +} \ No newline at end of file From 435927d9932d0a3ba793c47a55139f319e0a1486 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Mon, 16 Mar 2015 15:15:51 +0100 Subject: [PATCH 3/6] Merge pull request +6605 from c9/netlimit Add automation of bandwidth limiting script --- package.json | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 088f9328..d1268343 100644 --- a/package.json +++ b/package.json @@ -49,23 +49,24 @@ }, "licenses": [], "c9plugins": { - "c9.ide.language": "#854575579b", + "c9.ide.language": "#4a23a36945", "c9.ide.language.css": "#afda1f867c", "c9.ide.language.generic": "#87a4a44671", "c9.ide.language.html": "#fa4833e117", "c9.ide.language.html.diff": "#a7311cfc9f", - "c9.ide.language.javascript": "#26cf518b28", + "c9.ide.language.javascript": "#8479d0a9c1", "c9.ide.language.javascript.immediate": "#9a2cce9121", - "c9.ide.language.javascript.eslint": "#1baacc275b", - "c9.ide.language.javascript.tern": "#a65ad88dd9", + "c9.ide.language.javascript.eslint": "#8832423ad1", + "c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.infer": "#ebb2daf81a", - "c9.ide.language.jsonalyzer": "#c5dfe5fb7e", - "c9.ide.collab": "#b94018ab2b", + "c9.ide.language.jsonalyzer": "#a1057f20db", + "c9.ide.collab": "#7b09419b5c", "c9.ide.local": "#2bfd7ff051", "c9.ide.find": "#989c06e6a7", "c9.ide.find.infiles": "#f98dfef554", "c9.ide.find.replace": "#e4daf722b8", "c9.ide.run.debug": "#379e508be6", + "c9.automate": "#86bf1ee1ca", "c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.gotoline": "#4d1a93172c", "c9.ide.ace.keymaps": "#6c4bb65b1f", @@ -78,7 +79,7 @@ "c9.ide.configuration": "#b8470f4107", "c9.ide.dialog.wizard": "#a588b64050", "c9.ide.fontawesome": "#781602c5d8", - "c9.ide.format": "#1ae38e60e6", + "c9.ide.format": "#f51451ac57", "c9.ide.help.support": "#60e88f5680", "c9.ide.imgeditor": "#08bbc53578", "c9.ide.immediate": "#e9ba147cc2", @@ -87,18 +88,19 @@ "c9.ide.navigate": "#64156c7f4a", "c9.ide.newresource": "#9a7464cc47", "c9.ide.openfiles": "#28a4f5af16", - "c9.ide.preview": "#3c4dded23f", - "c9.ide.preview.browser": "#be197b0464", - "c9.ide.preview.markdown": "#bf952685f6", + "c9.ide.preview": "#dba2f4214d", + "c9.ide.preview.browser": "#ac18aaf31d", + "c9.ide.preview.markdown": "#ab8d30ad9f", "c9.ide.pubsub": "#92ec19ed3a", "c9.ide.readonly": "#f6f07bbe42", "c9.ide.recentfiles": "#7c099abf40", - "c9.ide.remote": "#37773d905b", - "c9.ide.run": "#f5a056e6ce", + "c9.ide.remote": "#cd45e81d2f", + "c9.ide.run": "#71c5562e42", "c9.ide.run.build": "#915e48b363", + "c9.ide.run.debug.xdebug": "#b91d23f48b", "c9.ide.save": "#a32a8f4346", - "c9.ide.terminal.monitor": "#df9936daa2", - "c9.ide.theme.flat": "#5c7c27ab74", + "c9.ide.terminal.monitor": "#b0b4d03280", + "c9.ide.theme.flat": "#b1d65fa9bb", "c9.ide.threewaymerge": "#229382aa0b", "c9.ide.undo": "#b028bcb4d5", "c9.ide.upload": "#0bd010d3dc", From e885854dd6abbf20ec310d79d762eb0b96bf6cac Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 16 Mar 2015 16:40:10 +0000 Subject: [PATCH 4/6] git ignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index af2db3dc..87b41971 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ plugins/c9.proxy/proxy.cfg plugins/c9.proxy/haproxy plugins/c9.proxy/haproxy-* **/.module-cache/ +plugins/c9.account.billing/node_modules/ +plugins/c9.account/node_modules/ .c9revisions .settings From 8d01ba39ef2ee64856b81be5ccc1d9c110e01822 Mon Sep 17 00:00:00 2001 From: Nikolai Onken Date: Tue, 24 Mar 2015 16:37:38 +0000 Subject: [PATCH 5/6] Merge branch 'master' of github.com:c9/newclient into merge-account-profile Conflicts: plugins/c9.ide.server/plugins.js --- .eslintrc | 2 +- .gitignore | 1 + README.md | 2 +- docs/CODING_STANDARDS.md | 4 +- node_modules/ace/lib/ace/virtual_renderer.js | 1 + .../lib/ace_tree/mouse/default_handlers.js | 6 +- node_modules/c9/inline-mocha.js | 4 +- node_modules/vfs-local/localfs.js | 20 +- package.json | 12 +- plugins/c9.fs/fs.cache.xml.js | 11 +- plugins/c9.fs/fs.js | 7 + plugins/c9.ide.errorhandler/raygun.js | 5 +- .../simple_error_handler.js | 57 +++-- .../c9.ide.layout.classic/less/blackdg.less | 2 +- .../themes/default-dark-gray.less | 1 + .../themes/default-dark.less | 1 + .../themes/default-flat-light.less | 7 +- .../themes/default-light-gray.less | 1 + .../themes/default-light.less | 1 + plugins/c9.ide.server/plugins.js | 215 ++++++++++-------- plugins/c9.ide.terminal/link_handler.js | 4 + plugins/c9.ide.terminal/terminal.js | 2 + plugins/c9.ide.tree/tree.js | 21 +- plugins/c9.ide.watcher/gui.js | 5 +- plugins/c9.preview/preview.handler.js | 2 +- plugins/c9.vfs.client/endpoint.js | 55 +++-- plugins/c9.vfs.client/vfs_client.js | 5 +- scripts/install-sdk.sh | 2 +- 28 files changed, 273 insertions(+), 183 deletions(-) diff --git a/.eslintrc b/.eslintrc index 38c2858d..b9137a94 100644 --- a/.eslintrc +++ b/.eslintrc @@ -17,7 +17,7 @@ rules: no-cond-assign: [1, "except-parens"] no-debugger: 3 no-dupe-keys: 3 - no-eval: 2 + no-eval: 3 no-func-assign: 1 no-invalid-regexp: 1 no-irregular-whitespace: 3 diff --git a/.gitignore b/.gitignore index 87b41971..1ee326ab 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ plugins/c9.ide.layout.classic/less/*.css plugins/c9.vfs.standalone/www/less.html plugins/c9.ide.run/todo plugins/c9.vfs.standalone/www/charts +plugins/c9.ide.language.javascript.tern/util/sigs_ts scripts/build build/output build/standalone/ diff --git a/README.md b/README.md index 32811a8f..c16e3ba8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ Cloud9 3.0 SDK for Plugin Development -======================================= +====================================== This is the core repository for the Cloud9 v3 SDK. The SDK allows you to run a version of Cloud9 that allows you to develop plugins and create a custom IDE based on Cloud9. diff --git a/docs/CODING_STANDARDS.md b/docs/CODING_STANDARDS.md index 1a85839d..6a6eea2d 100644 --- a/docs/CODING_STANDARDS.md +++ b/docs/CODING_STANDARDS.md @@ -19,7 +19,7 @@ Base Tabs vs Spaces -------------- -We use 4 spaces of indenteation. +We use 4 spaces of indentation. Line Termination ---------------- @@ -100,7 +100,7 @@ Your opening braces go on the same line as the statement. Also, notice the use of whitespace before and after the condition statement. -Closing braces are always followed by a new line. This is releavant for `else`, `catch` and `finally`. +Closing braces are always followed by a new line. This is relevant for `else`, `catch` and `finally`. *Right*: diff --git a/node_modules/ace/lib/ace/virtual_renderer.js b/node_modules/ace/lib/ace/virtual_renderer.js index fc054046..8002c750 100644 --- a/node_modules/ace/lib/ace/virtual_renderer.js +++ b/node_modules/ace/lib/ace/virtual_renderer.js @@ -1038,6 +1038,7 @@ var VirtualRenderer = function(container, theme) { }; this.$updateLines = function() { + if (!this.$changedLines) return; var firstRow = this.$changedLines.firstRow; var lastRow = this.$changedLines.lastRow; this.$changedLines = null; diff --git a/node_modules/ace_tree/lib/ace_tree/mouse/default_handlers.js b/node_modules/ace_tree/lib/ace_tree/mouse/default_handlers.js index 5c9fa478..2cab0499 100644 --- a/node_modules/ace_tree/lib/ace_tree/mouse/default_handlers.js +++ b/node_modules/ace_tree/lib/ace_tree/mouse/default_handlers.js @@ -65,15 +65,15 @@ function DefaultHandlers(mouseHandler) { var editor = this.editor; var node = e.getNode(); - var title; + var title, provider = editor.provider; if (!node) { title = ""; - } else if (editor.provider.columns) { + } else if (provider.columns) { var pos = e.getDocumentPosition(); var columnData = editor.renderer.$headingLayer.findColumn(pos.x); title = columnData ? columnData.column.getText(node) : ""; } else { - title = editor.provider.getText(node); + title = provider.getTooltipText ? provider.getTooltipText(node) : provider.getText(node); } if (editor.container.title != title) diff --git a/node_modules/c9/inline-mocha.js b/node_modules/c9/inline-mocha.js index a5c92d7d..09ce9dc0 100644 --- a/node_modules/c9/inline-mocha.js +++ b/node_modules/c9/inline-mocha.js @@ -1,10 +1,10 @@ -module.exports = function(module, reporter) { +module.exports = function(module, reporter, options) { if (typeof module !== "undefined" && module === require.main) { if (typeof global.onload === "undefined") global.onload = undefined; var file = module.filename; var Mocha = require("mocha"); - var mocha = new Mocha(); + var mocha = new Mocha(options || {}); mocha.reporter(reporter || "spec"); var suite = mocha.suite; suite.emit('pre-require', global, file, mocha); diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index 2245553c..6168cdd1 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -1380,23 +1380,21 @@ module.exports = function setup(fsOptions) { }); callback(done); - function loop(watchers, path, event, callback) { + function done(callback) { if (!watchers.length) return callback(); - + + // Notify each watcher of changes and reactivate it var watcher = watchers.pop(); - watcher.handleWatchEvent(event, basename(path), true); - + fs.stat(path, function(err, stat) { + if (err || !stat) return; + stat.vfsWrite = true; + watcher.sendToAllListeners("change", basename(path), stat); + }); watcher.resume(function() { - loop(watchers, path, event, callback); + done(callback); }); } - - function done(callback) { - loop(watchers, path, "change", function() { - loop(dirWatchers, parentDir, "directory", callback); - }); - } } function connect(port, options, callback) { diff --git a/package.json b/package.json index 3890a486..a58adde9 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "send": "~0.1.4", "simple-mime": "~0.0.8", "tern": "git://github.com/lennartcl/tern.git#97464df789dbb4d81ca4579383a02b320c69563d", - "tern_from_ts": "git://github.com/cloud9ide/tern_from_ts.git#b8b3d555e545aa41ed8d0df054ef38416a578faa", + "tern_from_ts": "git://github.com/cloud9ide/tern_from_ts.git#6a0107e602b0d044fe1753533cf31f52cf5fb95a", "through": "2.2.0", "tmp": "~0.0.20", "uglify-js": "2.4.16", @@ -49,17 +49,17 @@ }, "licenses": [], "c9plugins": { - "c9.ide.language": "#4a23a36945", + "c9.ide.language": "#de3c644b88", "c9.ide.language.css": "#afda1f867c", "c9.ide.language.generic": "#87a4a44671", "c9.ide.language.html": "#fa4833e117", "c9.ide.language.html.diff": "#a7311cfc9f", - "c9.ide.language.javascript": "#8479d0a9c1", + "c9.ide.language.javascript": "#ec9ecf31cf", "c9.ide.language.javascript.immediate": "#9a2cce9121", "c9.ide.language.javascript.eslint": "#8832423ad1", "c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.infer": "#ebb2daf81a", - "c9.ide.language.jsonalyzer": "#a1057f20db", + "c9.ide.language.jsonalyzer": "#d82c60fcb9", "c9.ide.collab": "#7b09419b5c", "c9.ide.local": "#2bfd7ff051", "c9.ide.find": "#989c06e6a7", @@ -94,8 +94,8 @@ "c9.ide.pubsub": "#92ec19ed3a", "c9.ide.readonly": "#f6f07bbe42", "c9.ide.recentfiles": "#7c099abf40", - "c9.ide.remote": "#cd45e81d2f", - "c9.ide.run": "#e510a39b4b", + "c9.ide.remote": "#f531d62cfb", + "c9.ide.run": "#3349df7c52", "c9.ide.run.build": "#915e48b363", "c9.ide.run.debug.xdebug": "#b91d23f48b", "c9.ide.save": "#a32a8f4346", diff --git a/plugins/c9.fs/fs.cache.xml.js b/plugins/c9.fs/fs.cache.xml.js index 0d359039..fcc3b9d7 100644 --- a/plugins/c9.fs/fs.cache.xml.js +++ b/plugins/c9.fs/fs.cache.xml.js @@ -289,14 +289,14 @@ define(function(require, exports, module) { var newPath = e.args[1]; var parent = findNode(dirname(newPath)); - //Validation + // Validation var toNode = findNode(newPath); - if (parent) { //Dir is in cache + if (parent) { // Dir is in cache if (toNode) deleteNode(toNode); - createNode(newPath, null, node); // Move node + createNode(newPath, null, node); // Move node recurPathUpdate(node, oldPath, newPath); e.undo = function(){ @@ -480,6 +480,11 @@ define(function(require, exports, module) { } function createNode(path, stat, updateNode, updating) { + if (!/^[!~/]/.test(path)) { + var e = new Error("Refusing to add a node with misformed path to fs.cache"); + return reportError(e, { path: path }); + } + if (orphans[path]) { updateNode = orphans[path]; delete orphans[path]; diff --git a/plugins/c9.fs/fs.js b/plugins/c9.fs/fs.js index 11f66b81..cd8c8270 100644 --- a/plugins/c9.fs/fs.js +++ b/plugins/c9.fs/fs.js @@ -62,6 +62,13 @@ define(function(require, exports, module) { if (typeof args[args.length - 1] != "function") throw new Error("Missing callback for " + name); + + if (!/^[!~/]/.test(path)) { + var e = new Error("Invalid path passed to fs"); + e.data = { name: name, path: path }; + setTimeout(function() { throw e }); + return args[args.length - 1](e); + } var original_callback = args.pop(); diff --git a/plugins/c9.ide.errorhandler/raygun.js b/plugins/c9.ide.errorhandler/raygun.js index fd3732a4..9931997f 100644 --- a/plugins/c9.ide.errorhandler/raygun.js +++ b/plugins/c9.ide.errorhandler/raygun.js @@ -1419,7 +1419,8 @@ window.TraceKit = TraceKit; var blackListedErrors = { 'Error with empty message': {}, - 'Script error.': {} + 'Script error.': {}, + 'DealPly is not defined': { factor: 10e5 } }; function processUnhandledException(stackTrace, options) { var stack = [], @@ -1479,7 +1480,7 @@ window.TraceKit = TraceKit; if (blackListedErrors.hasOwnProperty(message)) { var count = (blackListedErrors[message].count || 0) + 1; blackListedErrors[message].count = count; - if (count % 10 !== 1) { + if (count % (blackListedErrors[message].factor || 10) !== 1) { return; } finalCustomData.$blackList = blackListedErrors[message]; diff --git a/plugins/c9.ide.errorhandler/simple_error_handler.js b/plugins/c9.ide.errorhandler/simple_error_handler.js index 9d56cefe..d9b71362 100644 --- a/plugins/c9.ide.errorhandler/simple_error_handler.js +++ b/plugins/c9.ide.errorhandler/simple_error_handler.js @@ -50,29 +50,29 @@ define(function(require, exports, module) { oldOnError.apply(this, arguments); }; - //Catch all APF Routed errors -// ui.addEventListener("error", function(e) { -// var errorInfo = { -// agent : navigator.userAgent, -// type : "APF Error", -// message : e.message, -// tgt : e.currentTarget && e.currentTarget.serialize(), -// url : e.url, -// state : e.state, -// e : e.error, -// workspaceId : plugin.workspaceId -// }; -// -// emit("error", errorInfo); -// -// http.request("/api/debug", { -// method : "POST", -// contentType : "application/json", -// body : errorInfo -// }, function(err) { -// if (err) console.error(err); -// }); -// }); + // Catch all APF Routed errors + // ui.addEventListener("error", function(e) { + // var errorInfo = { + // agent : navigator.userAgent, + // type : "APF Error", + // message : e.message, + // tgt : e.currentTarget && e.currentTarget.serialize(), + // url : e.url, + // state : e.state, + // e : e.error, + // workspaceId : plugin.workspaceId + // }; + + // emit("error", errorInfo); + + // http.request("/api/debug", { + // method : "POST", + // contentType : "application/json", + // body : errorInfo + // }, function(err) { + // if (err) console.error(err); + // }); + // }); } } @@ -87,8 +87,11 @@ define(function(require, exports, module) { // }); } - function reportError(exception) { - console.error(exception.stack || exception); + function reportError(exception, customData) { + if (customData) + console.error(exception, customData); + else + console.error(exception.stack || exception); submitError(exception); } @@ -98,6 +101,10 @@ define(function(require, exports, module) { load(); }); + plugin.on("unload", function(){ + loaded = false; + }); + /***** Register and define API *****/ plugin.freezePublicAPI({ diff --git a/plugins/c9.ide.layout.classic/less/blackdg.less b/plugins/c9.ide.layout.classic/less/blackdg.less index 5ae75cbc..a7d86c6c 100644 --- a/plugins/c9.ide.layout.classic/less/blackdg.less +++ b/plugins/c9.ide.layout.classic/less/blackdg.less @@ -211,7 +211,7 @@ left : -2px; vertical-align : top; margin-right : 2px !important; - margin-left : 1px !important; + margin-left : @datagrid-row-toggler-loading !important; } .blackdg .loading.selected .toggler{ background : url("@{datagrid-selected-spinner}") no-repeat 0 0; diff --git a/plugins/c9.ide.layout.classic/themes/default-dark-gray.less b/plugins/c9.ide.layout.classic/themes/default-dark-gray.less index fade7e71..1a58adf5 100644 --- a/plugins/c9.ide.layout.classic/themes/default-dark-gray.less +++ b/plugins/c9.ide.layout.classic/themes/default-dark-gray.less @@ -705,6 +705,7 @@ @datagrid-row-padding: 2px 0 2px 4px; @datagrid-row-height: 18px; @datagrid-row-toggler: -1px 4px -3px 3px; +@datagrid-row-toggler-loading: 1px; @datagrid-editor-box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.5) inset; diff --git a/plugins/c9.ide.layout.classic/themes/default-dark.less b/plugins/c9.ide.layout.classic/themes/default-dark.less index 0b161787..ec2edd6a 100644 --- a/plugins/c9.ide.layout.classic/themes/default-dark.less +++ b/plugins/c9.ide.layout.classic/themes/default-dark.less @@ -705,6 +705,7 @@ @datagrid-row-padding: 2px 0 2px 4px; @datagrid-row-height: 18px; @datagrid-row-toggler: -1px 4px -3px 3px; +@datagrid-row-toggler-loading: 1px; @datagrid-editor-box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.5) inset; diff --git a/plugins/c9.ide.layout.classic/themes/default-flat-light.less b/plugins/c9.ide.layout.classic/themes/default-flat-light.less index f9f5b220..11eaa05a 100644 --- a/plugins/c9.ide.layout.classic/themes/default-flat-light.less +++ b/plugins/c9.ide.layout.classic/themes/default-flat-light.less @@ -363,7 +363,7 @@ @pane-button-running-top: 6px; @pane-button-running-animation: rotation 2s infinite steps(16); @pane-button-save-image: "@{image-path}/tab-save-spinner-active_flat_light.png"; -@pane-button-save-image-width: 360px; +@pane-button-save-image-width: 336px; @pane-button-save-image-height: 14px; @pane-button-save-width: 14px; @pane-button-save-height: 14px; @@ -705,6 +705,7 @@ @datagrid-row-padding: 5px 0 5px 7px; @datagrid-row-height: 24px; @datagrid-row-toggler: -1px 4px -3px -2px; +@datagrid-row-toggler-loading: -4px; @datagrid-editor-box-shadow: none; @@ -1493,8 +1494,8 @@ @share-textbox-border-color: @textbox-border-color; @share-textbox-width: 378px; @share-textbox-margin: 5px 0 0 0; -@share-access-right: 150px; -@share-access-top: 36px; +@share-access-right: 140px; +@share-access-top: 66px; @share-invite-button-width: 120px; @share-invite-button-height: 30px; @share-invite-button-right: 10px; diff --git a/plugins/c9.ide.layout.classic/themes/default-light-gray.less b/plugins/c9.ide.layout.classic/themes/default-light-gray.less index a4eaba3d..15e2ea44 100644 --- a/plugins/c9.ide.layout.classic/themes/default-light-gray.less +++ b/plugins/c9.ide.layout.classic/themes/default-light-gray.less @@ -705,6 +705,7 @@ @datagrid-row-padding: 2px 0 2px 4px; @datagrid-row-height: 18px; @datagrid-row-toggler: -1px 4px -3px 3px; +@datagrid-row-toggler-loading: 1px; @datagrid-editor-box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.5) inset; diff --git a/plugins/c9.ide.layout.classic/themes/default-light.less b/plugins/c9.ide.layout.classic/themes/default-light.less index efd55c6d..bc2cbbba 100644 --- a/plugins/c9.ide.layout.classic/themes/default-light.less +++ b/plugins/c9.ide.layout.classic/themes/default-light.less @@ -705,6 +705,7 @@ @datagrid-row-padding: 2px 0 2px 4px; @datagrid-row-height: 18px; @datagrid-row-toggler: -1px 4px -3px 3px; +@datagrid-row-toggler-loading: 1px; @datagrid-editor-box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.5) inset; diff --git a/plugins/c9.ide.server/plugins.js b/plugins/c9.ide.server/plugins.js index e9089348..a6132247 100644 --- a/plugins/c9.ide.server/plugins.js +++ b/plugins/c9.ide.server/plugins.js @@ -4,106 +4,133 @@ * @copyright 2013, Ajax.org B.V. */ -"use strict"; +define(function(require, exports, module) { + "use strict"; + + main.consumes = ["Plugin", "connect.static"]; + main.provides = ["c9.static.plugins"]; + return main; -main.consumes = [ - "connect.static" -]; -main.provides = ["c9.static.plugins"]; -module.exports = main; - -function main(options, imports, register) { - var statics = imports["connect.static"]; - var fs = require("fs"); + function main(options, imports, register) { + var Plugin = imports.Plugin; + var statics = imports["connect.static"]; + var fs = require("fs"); + + var whitelist = options.whitelist; + var blacklist = options.blacklist; + + /***** Initialization *****/ + + var plugin = new Plugin("Ajax.org", main.consumes); + + var loaded = false; + function load(){ + if (loaded) return false; + loaded = true; + + var requirePaths = { + ace: "lib/ace/lib/ace", + ace_tree: "lib/ace_tree/lib/ace_tree", + treehugger: "lib/treehugger/lib/treehugger", + acorn: "lib/treehugger/lib/treehugger/js", + tern: "lib/tern", + tern_from_ts: "lib/tern_from_ts", + ui: "lib/ui", + c9: "lib/c9", + frontdoor: "lib/frontdoor", + }; + + if (whitelist === "*") { + statics.addStatics([{ + path: __dirname + "/../../node_modules", + mount: "/lib" + }]); - var whitelist = options.whitelist; - var blacklist = options.blacklist; - - var requirePaths = { - ace: "lib/ace/lib/ace", - ace_tree: "lib/ace_tree/lib/ace_tree", - treehugger: "lib/treehugger/lib/treehugger", - acorn: "lib/treehugger/lib/treehugger/js", - tern: "lib/tern", - ui: "lib/ui", - c9: "lib/c9", - frontdoor: "lib/frontdoor", - }; - - if (whitelist === "*") { - statics.addStatics([{ - path: __dirname + "/../../node_modules", - mount: "/lib" - }]); - - statics.addStatics([{ - path: __dirname + "/../../plugins", - mount: "/plugins", - rjs: requirePaths - }]); - } else { - [ - "ace_tree", - "acorn", - "tern", - "treehugger", - "pivottable", - "architect", - "source-map", - "rusha", - "c9", - "ui", - "emmet", - "frontdoor", - "mocha", // TESTING - "chai", // TESTING - ].forEach(function(name) { + statics.addStatics([{ + path: __dirname + "/../../plugins", + mount: "/plugins", + rjs: requirePaths + }]); + } else { + [ + "ace_tree", + "acorn", + "tern", + "tern_from_ts", + "treehugger", + "pivottable", + "architect", + "source-map", + "rusha", + "c9", + "ui", + "emmet", + "frontdoor", + "mocha", // TESTING + "chai", // TESTING + ].forEach(function(name) { + statics.addStatics([{ + path: __dirname + "/../../node_modules/" + name, + mount: "/lib/" + name + }]); + }); + + statics.addStatics([{ + path: __dirname + "/../../node_modules/ace", + mount: "/lib/ace", + rjs: requirePaths + }]); + + statics.addStatics(fs.readdirSync(__dirname + "/../") + .filter(function(path) { + if (path in blacklist) + return false; + else if (path in whitelist) + return true; + else if (path.indexOf("c9.ide.") === 0) + return true; + else if (path.indexOf("c9.account") === 0) + return true; + else + return false; + }) + .map(function(path) { + return { + path: __dirname + "/../../plugins/" + path, + mount: "/plugins/" + path + }; + }) + ); + } + statics.addStatics([{ - path: __dirname + "/../../node_modules/" + name, - mount: "/lib/" + name + path: __dirname + "/www", + mount: "/" }]); + + statics.addStatics([{ + path: __dirname + "/../../docs", + mount: "/docs" + }]); + + } + + /***** Lifecycle *****/ + + plugin.on("load", function(){ + load(); + }); + plugin.on("unload", function(){ + loaded = false; }); - statics.addStatics([{ - path: __dirname + "/../../node_modules/ace", - mount: "/lib/ace", - rjs: requirePaths - }]); + /***** Register and define API *****/ - statics.addStatics(fs.readdirSync(__dirname + "/../") - .filter(function(path) { - if (path in blacklist) - return false; - else if (path in whitelist) - return true; - else if (path.indexOf("c9.ide.") === 0) - return true; - else if (path.indexOf("c9.account") === 0) - return true; - else - return false; - }) - .map(function(path) { - return { - path: __dirname + "/../../plugins/" + path, - mount: "/plugins/" + path - }; - }) - ); + plugin.freezePublicAPI({}); + + register(null, { + "c9.static.plugins": plugin + }); } - - statics.addStatics([{ - path: __dirname + "/www", - mount: "/" - }]); - - statics.addStatics([{ - path: __dirname + "/../../docs", - mount: "/docs" - }]); - - register(null, { - "c9.static.plugins": {} - }); -} \ No newline at end of file +}); \ No newline at end of file diff --git a/plugins/c9.ide.terminal/link_handler.js b/plugins/c9.ide.terminal/link_handler.js index c8366150..4569d8b0 100644 --- a/plugins/c9.ide.terminal/link_handler.js +++ b/plugins/c9.ide.terminal/link_handler.js @@ -158,6 +158,10 @@ define(function(require, exports, module) { if (!/(https?|ftp|file):/.test(href)) { href = "http://" + href; } + href = href.replace(/(^https?:\/\/)(0.0.0.0|localhost)(?=:|\/|$)/, function(_, protocol, host) { + host = c9.hostname || window.location.host; + return protocol + host.replace(/:\d+/, ""); + }); if (e.metaKey || e.ctrlKey) window.open(href); else diff --git a/plugins/c9.ide.terminal/terminal.js b/plugins/c9.ide.terminal/terminal.js index 497bd688..606e211f 100644 --- a/plugins/c9.ide.terminal/terminal.js +++ b/plugins/c9.ide.terminal/terminal.js @@ -738,6 +738,8 @@ define(function(require, exports, module) { terminal.on("afterWrite", function() { clearTmuxBorders(terminal); }); + + session.getEmitter().sticky("terminalReady", session); } /***** Lifecycle *****/ diff --git a/plugins/c9.ide.tree/tree.js b/plugins/c9.ide.tree/tree.js index 915fb80c..c63148eb 100644 --- a/plugins/c9.ide.tree/tree.js +++ b/plugins/c9.ide.tree/tree.js @@ -227,7 +227,7 @@ define(function(require, exports, module) { // Fetch UI elements container = plugin.getElement("container"); - winFilesViewer = options.aml + winFilesViewer = options.aml; // Create the Ace Tree tree = new Tree(container.$int); @@ -244,6 +244,16 @@ define(function(require, exports, module) { return ""; }; + fsCache.model.getTooltipText = function(node) { + var size = node.size; + return node.label + (node.link ? " => " + node.link + "\n" : "") + + (size ? " | " + ( + size < 0x400 ? size + " bytes" : + size < 0x100000 ? (size / 0x400).toFixed(2) + "KB" : + (size / 0x100000).toFixed(2) + "MB" + ) : ""); + }; + if (settings.get("user/general/@treestyle") == "alternative") ui.setStyleClass(container.$int, "alternative"); @@ -951,10 +961,15 @@ define(function(require, exports, module) { if (node === false || path.charAt(0) == "!") return increment(); + if (!/^[!~/]/.test(path)) { + console.error("invalid path", path); + delete expandedList[path]; + return increment(); + } + if (node && node.status == "loaded") { expandNode(node); - increment(); - return; + return increment(); } fs.readdir(path, function(err, data) { diff --git a/plugins/c9.ide.watcher/gui.js b/plugins/c9.ide.watcher/gui.js index 2f14b6ca..a4489de9 100644 --- a/plugins/c9.ide.watcher/gui.js +++ b/plugins/c9.ide.watcher/gui.js @@ -330,7 +330,10 @@ define(function(require, exports, module) { } function updateChangedPath(err, path, data) { - var doc = changedPaths[path].tab.document; + var tab = changedPaths[path].tab || tabManager.findTab(path); + if (!tab) + return changedPaths[path] && changedPaths[path].resolve(); + var doc = tab.document; doc.setBookmarkedValue(data, true); doc.meta.timestamp = Date.now() - settings.timeOffset; changedPaths[path].resolve(); diff --git a/plugins/c9.preview/preview.handler.js b/plugins/c9.preview/preview.handler.js index 3e827c63..c307b04b 100644 --- a/plugins/c9.preview/preview.handler.js +++ b/plugins/c9.preview/preview.handler.js @@ -311,7 +311,7 @@ define(function(require, exports, module) { "content-length": data.length + inject.length, "content-type": request.headers["content-type"], "etag": request.headers.etag, - "date": request.headers.data, + "date": request.headers.date, "access-control-allow-origin": "https://ide." + ideHost }); res.write(data); diff --git a/plugins/c9.vfs.client/endpoint.js b/plugins/c9.vfs.client/endpoint.js index 345511de..102b5723 100644 --- a/plugins/c9.vfs.client/endpoint.js +++ b/plugins/c9.vfs.client/endpoint.js @@ -1,7 +1,7 @@ define(function(require, exports, module) { "use strict"; - main.consumes = ["Plugin", "auth", "http", "api"]; + main.consumes = ["Plugin", "auth", "http", "api", "error_handler"]; main.provides = ["vfs.endpoint"]; return main; @@ -10,6 +10,7 @@ define(function(require, exports, module) { var auth = imports.auth; var http = imports.http; var api = imports.api; + var errorHandler = imports.error_handler; /***** Initialization *****/ @@ -43,29 +44,32 @@ define(function(require, exports, module) { var servers; var pendingServerReqs = []; - if (options.getServers) - options.getServers(initDefaultServers); - else - initDefaultServers(); + initDefaultServers(); options.pid = options.pid || 1; /***** Methods *****/ function initDefaultServers(baseURI) { - options.getServers = undefined; - var loc = require("url").parse(baseURI || document.baseURI || window.location.href); - var defaultServers = [{ - url: loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "") + "/vfs", - region: "default" - }]; - servers = (urlServers || options.servers || defaultServers).map(function(server) { - server.url = server.url.replace(/\/*$/, ""); - return server; - }); - pendingServerReqs.forEach(function(cb) { - cb(null, servers); - }); + if (options.getServers) + return options.getServers(init); + init(); + + function init() { + options.getServers = undefined; + var loc = require("url").parse(baseURI || document.baseURI || window.location.href); + var defaultServers = [{ + url: loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "") + "/vfs", + region: "default" + }]; + servers = (urlServers || options.servers || defaultServers).map(function(server) { + server.url = server.url.replace(/\/*$/, ""); + return server; + }); + pendingServerReqs.forEach(function(cb) { + cb(null, servers); + }); + } } function getServers(callback) { @@ -90,10 +94,14 @@ define(function(require, exports, module) { } function getVfsEndpoint(version, callback) { - getServers(function(err, servers) { - if (err) return callback(err); + getServers(function(err, _servers) { + if (err) { + errorHandler.reportError(err); + initDefaultServers(); + _servers = servers; + } - getVfsUrl(version, servers, function(err, vfsid, url, region) { + getVfsUrl(version, _servers, function(err, vfsid, url, region) { if (err) return callback(err); callback(null, { @@ -166,7 +174,7 @@ define(function(require, exports, module) { var server = servers[i]; auth.request(server.url + "/" + options.pid, { method: "POST", - timeout: 20000, + timeout: 120000, body: { version: version }, @@ -206,6 +214,9 @@ define(function(require, exports, module) { return; } else if (err.code == 403) { + if (res.error.blocked) + callback(fatalError(res.error.message, "dashboard")); + // forbidden. User doesn't have access // wait a while before trying again setTimeout(function() { diff --git a/plugins/c9.vfs.client/vfs_client.js b/plugins/c9.vfs.client/vfs_client.js index 1d542898..b44e2c30 100644 --- a/plugins/c9.vfs.client/vfs_client.js +++ b/plugins/c9.vfs.client/vfs_client.js @@ -7,7 +7,7 @@ define(function(require, exports, module) { "use strict"; - main.consumes = ["Plugin", "auth", "vfs.endpoint", "dialog.error", "dialog.alert"]; + main.consumes = ["Plugin", "auth", "vfs.endpoint", "dialog.error", "dialog.alert", "error_handler"]; main.provides = ["vfs"]; return main; @@ -33,6 +33,7 @@ define(function(require, exports, module) { var showError = errorDialog.show; var hideError = errorDialog.hide; var showAlert = imports["dialog.alert"].show; + var errorHandler = imports.error_handler; var eio = require("engine.io"); var Consumer = require("vfs-socket/consumer").Consumer; @@ -123,6 +124,7 @@ define(function(require, exports, module) { }); function disconnect() { + pingUrl = null; reconnect(function(err) { if (err && err.fatal) return; @@ -275,6 +277,7 @@ define(function(require, exports, module) { consumer.connect(transport, function(err, _vfs) { // TODO if (err) { + errorHandler.reportError(new Error("Error connecting to VFS", { err: err })); console.error("error connecting to VFS", err); return; } diff --git a/scripts/install-sdk.sh b/scripts/install-sdk.sh index 0ef7f71b..88794bf0 100755 --- a/scripts/install-sdk.sh +++ b/scripts/install-sdk.sh @@ -63,7 +63,7 @@ updatePackage() { } updateAllPackages() { - c9packages=(`"$NODE" -e 'console.log(Object.keys(require("./package.json").c9plugins).join(" "))'`); + c9packages=`"$NODE" -e 'console.log(Object.keys(require("./package.json").c9plugins).join(" "))'`; count=${#c9packages[@]} i=0 for m in ${c9packages[@]}; do echo $m; From eaa97797cec1458032eabb147e33f791472dd7d6 Mon Sep 17 00:00:00 2001 From: Nikolai Onken Date: Fri, 27 Mar 2015 09:50:09 +0000 Subject: [PATCH 6/6] Merge branch 'master' of github.com:c9/newclient into merge-account-profile Conflicts: plugins/c9.account.billing/component/PaymentMethod.js plugins/c9.account.billing/component/PaymentMethod.jsx plugins/c9.account.billing/components/paymentmethod/Create.js plugins/c9.account.billing/jsx/paymentmethod/Create.jsx plugins/c9.account.billing/style.css plugins/c9.account.provisioning/subscription/normalizeSubscriptionData.js plugins/c9.account.react/less/billing.less --- .eslintrc | 1 - configs/api.standalone.js | 226 ------------------ plugins/c9.ide.download/download.js | 94 ++++++++ .../images/rightclickmenu_background.png | Bin 191 -> 0 bytes .../images/rightclickmenu_bottom.png | Bin 530 -> 0 bytes .../images/rightclickmenu_top.png | Bin 386 -> 0 bytes .../c9.ide.layout.classic/images/rundebug.png | Bin 3869 -> 0 bytes plugins/c9.ide.tree/favorites.js | 4 +- 8 files changed, 97 insertions(+), 228 deletions(-) delete mode 100644 configs/api.standalone.js create mode 100644 plugins/c9.ide.download/download.js delete mode 100755 plugins/c9.ide.layout.classic/images/rightclickmenu_background.png delete mode 100755 plugins/c9.ide.layout.classic/images/rightclickmenu_bottom.png delete mode 100755 plugins/c9.ide.layout.classic/images/rightclickmenu_top.png delete mode 100755 plugins/c9.ide.layout.classic/images/rundebug.png diff --git a/.eslintrc b/.eslintrc index b9137a94..e6595427 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,7 +23,6 @@ rules: no-irregular-whitespace: 3 no-negated-in-lhs: 1 no-regex-spaces: 3 - no-reserved-keys: 3 no-unreachable: 1 use-isnan: 2 valid-typeof: 1 diff --git a/configs/api.standalone.js b/configs/api.standalone.js deleted file mode 100644 index c36cdca8..00000000 --- a/configs/api.standalone.js +++ /dev/null @@ -1,226 +0,0 @@ -#!/usr/bin/env node -"use strict"; - -module.exports.addApi = function(plugins, config) { - config.apiUrl = ""; - var apiPlugins = [{ - setup: function(options, imports, register) { - mockRedis(options, imports, register); - }, - provides: ["mq", "db", "mailer"], - consumes: ["api"] - }, { - packagePath: "./c9.logtimestamp/logtimestamp", - mode: config.mode - }, - "./c9.error/logger.raygun_mock", - "./c9.api/ping", - { - packagePath: "./c9.api/health", - revision: config.manifest.revision, - version: config.manifest.version, - }, - "./c9.api/user", - "./c9.api/project", - "./c9.api/applications", - "./c9.api/session", - "./c9.api/collab", - "./c9.api/settings", - "./c9.api/vfs", - "./c9.api/preview", - "connect-architect/connect.bodyparser", - "connect-architect/connect.query", - "./c9.passport/passport", - "./c9.passport/bearer", - "./c9.passport/basic"]; - - return plugins.concat(apiPlugins); -}; - -function mockRedis(options, imports, register) { - var api = imports.api; - if (api.bindUser) - return; - - api.bindUser = function(call) { - return function(req, res, next) { - call(req.user, req.params, function(err, json) { - if (err) return next(err); - res.json(json); - }); - }; - }; - api.authenticate = function() { - return function(req, res, next) { - req.user = new User(req.query.access_token); - next(); - }; - }; - var users = { - "-1": { - name: "John Doe", email: "johndoe@example.org", - } - }; - - var projects = [{ - owner: -1, members: ["rw", -1, 1, 2, 3, "r", 4, 5] - }]; - - function User(id) { - if (typeof id == "object") - id = id.id; - if (!/^\d+/.test(id)) - id = -1; - var u = users[id]; - if (!u) { - u = users[id] = { - name: "user" + id, - email: "user" + id + "@c9.io", - fullname: "User " + id - }; - } - - u.id = id; - return { - name: u.name, - fullname: u.fullname, - email: u.email, - id: id - }; - } - - function Project(id) { - if (typeof id == "object") - id = id.id; - var p = projects[id]; - if (!p) - return console.log(id); - return { - isPrivate: function() { - return false; - }, - owner: new User(p.owner), - getMembers: function(cb) { - var memebers = [], acl; - var ownerId = this.owner.id; - p.members.forEach(function(memberId) { - if (typeof memberId == "string") - return (acl = memberId); - memebers.push(new Member(memberId, acl, ownerId)); - }); - cb && cb(null, memebers); - return memebers; - }, - id: id - }; - } - - function Member(id, acl, ownerId) { - return { - user: id, - status: "", - acl: acl, - role: id == ownerId ? "a" : "c", - save: function(project, cb) { - cb(); - }, - remove: function(project, cb) { - var p = projects[project.id]; - var i = p.members.indexOf(id); - if (i != -1) - p.members.splice(i, 1); - cb(); - } - }; - } - - function DB(type) { - var key, query; - var dbApi = { - findOne: function(keyv, cb) { - key = keyv; - if (cb) - return dbApi.exec(cb); - return dbApi; - }, - populate: function(queryV) { - query = queryV; - return dbApi; - }, - exec: function(cb) { - var result; - switch (type) { - case "Project": - result = new Project(0); - break; - case "User": - result = new User(key.uid); - break; - case "AccessToken": - if (query == "user") { - var id = /\d/.test(key.token) ? key.token : -1; - result = {user: new User(id)}; - } - break; - case "WorkspaceMember": - var p = key.project; - var user = new User(key.user); - result = p.getMembers().filter(function(m) { - return m.user == user.id; - })[0]; - break; - default: - console.log(":((("); - } - cb(null, result); - return dbApi; - }, - }; - dbApi.ROLE_NONE = "n"; - dbApi.ROLE_VISITOR = "v"; // @deprecated - dbApi.ROLE_COLLABORATOR = "c"; - dbApi.ROLE_ADMIN = "a"; - dbApi.ACL_RW = "rw"; - dbApi.ACL_R = "r"; - dbApi.COLLABSTATE_PENDING_ADMIN = "pending-admin"; - dbApi.COLLABSTATE_PENDING_USER = "pending-user"; // @deprecated - dbApi.COLLABSTATE_PENDING_NONE = "pending-none"; - return dbApi; - } - - var pubsub = { - publish: function() { - - } - }; - - function noop() { return {}; } - - register(null, { - "mq": { - connection: noop, - close: noop, - onReady: noop, - onceReady: noop, - }, - "db": { - User: new DB("User"), - Project: new DB("Project"), - Remote: new DB("Remote"), - AccessToken: new DB("AccessToken"), - WorkspaceMember: new DB("WorkspaceMember"), - Vfs: new DB("Vfs"), - DockerHost: new DB("DockerHost"), - Container: new DB("Container"), - Image: new DB("Image"), - Lock: new DB("Lock"), - Nonce: new DB("Nonce"), - // PubSub as part of the database infrastructure - getSubscriber: function() { return pubsub }, - getPublisher: function() { return pubsub }, - }, - mailer: { - - } - }); -} diff --git a/plugins/c9.ide.download/download.js b/plugins/c9.ide.download/download.js new file mode 100644 index 00000000..05c3fdfa --- /dev/null +++ b/plugins/c9.ide.download/download.js @@ -0,0 +1,94 @@ +define(function(require, exports, module) { + "use strict"; + + main.consumes = [ + "Plugin", "c9", "ui", "menus", "tree", "info", "vfs" + ]; + main.provides = ["download"]; + return main; + + function main(options, imports, register) { + var Plugin = imports.Plugin; + var ui = imports.ui; + var c9 = imports.c9; + var menus = imports.menus; + var tree = imports.tree; + var vfs = imports.vfs; + var info = imports.info; + + /***** Initialization *****/ + + var plugin = new Plugin("Ajax.org", main.consumes); + + var loaded = false; + function load(){ + if (loaded) return false; + loaded = true; + + menus.addItemByPath("File/Download Project", new ui.item({ + onclick: downloadProject + }), 1300, plugin); + + // Context Menu + tree.getElement("mnuCtxTree", function(mnuCtxTree) { + menus.addItemToMenu(mnuCtxTree, new ui.item({ + match: "folder|project", + isAvailable: function(){ + return tree.selectedNode; + }, + caption: "Download", + onclick: download + }), 140, plugin); + }); + } + + function download() { + if (!c9.has(c9.STORAGE)) + return; + + var node = tree.selectedNode; + if (!node) return; + + var paths = tree.selectedNodes.map(function(node) { + return node.path; + }); + if (node.isFolder && node.path == "/") + downloadProject(); + else if (paths.length > 1) + vfs.download(paths); + else if (node.isFolder) + downloadFolder(node.path); + else + downloadFile(node.path); + + } + + function downloadProject() { + vfs.download("/", info.getWorkspace().name + ".tar.gz"); + } + + function downloadFolder(path) { + vfs.download(path.replace(/\/*$/, "/")); + } + + function downloadFile(path) { + vfs.download(path.replace(/\/*$/, ""), null, true); + } + + /***** Lifecycle *****/ + + plugin.on("load", function(){ + load(); + }); + + /***** Register and define API *****/ + + plugin.freezePublicAPI({ + + }); + + register(null, { + download: plugin + }); + } +}); \ No newline at end of file diff --git a/plugins/c9.ide.layout.classic/images/rightclickmenu_background.png b/plugins/c9.ide.layout.classic/images/rightclickmenu_background.png deleted file mode 100755 index 9a02e18e0b8de606e0f1e085c0b9411599359d9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 191 zcmeAS@N?(olHy`uVBq!ia0vp^CxMuegAGWQ)OOtgQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JiV{6t978H@y*YD{v%!GJ^ei(e0i!~1Txqps^l zhY&`$`)cQE2?&~}a?Ugi!__gy(e=9Td)n{!Z{@L%;#2V#`&>L!d#k2!!V*LOKuPWU zI|TuTh9osej>jXG5n4MW$$(_Mc5E-=R`pZy3wz6MF>J$db^JSzHHH=fL5)w5qg0Dk zC-x`%o4;>yD}{+-t)MLG#WRC|1Oo{)`?17;q&bScF899~x3W?2EMU-p01{}4kVsG- zx`yH)OGrq~A+3<-0u7Les0FPgaz)imqUt8s*(Bs5cR9n&iZ~~_#9(v~ubzRRId_t5 zj1p%7OH|!tgrxEzCk#7a%c0EZeE<0j|N%Z|T+ zB0GgM?g0t3bV$hP8g~Qxb(2d-6ezy|0XU#F!9rFCnS?~k;T2zK?bQ4M!H)m~0Kr%a Un7C|zv;Y7A07*qoM6N<$g3KD~F#rGn diff --git a/plugins/c9.ide.layout.classic/images/rightclickmenu_top.png b/plugins/c9.ide.layout.classic/images/rightclickmenu_top.png deleted file mode 100755 index b51256ceb7a31729435f0cf6689b78aafb1e5a44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 386 zcmV-|0e$|7P)xpxEpI}DoKPO zR)}C5bI1aEkRyta^GX!21d$?;kb}{gd9QmP(<;K5{rZww65zD`wMzz zS(b+oq{zZvuqa+-1(`WG952lCY@Bl`y!R>coCCc*`0>Wv9LG^&-}e+e-nPx;b1pKA zmDxv2LP`*iEd~S7I_E)4qI;1n$b|g^12A3mFYH6~jTo`9+Sqt*FE}S+$UWP%ye?v$73AdQU~&pDc?DT{Rk)%8Tuu)B&jX=l zBYIqeTN_^ZCl@W!f_RZg1UL*97#Ii*RD|M*o-lcJb@gKn1qE3eLe?(`M?#WiaegAd z6b#XRC?bYH!r*b>V@0Gp-k+oep;h{yEno@%%HsU~X%nqsFfx(=lZVP3Z|N5hf%yNS zSnR)OKaw^2zxDo~!hW_v1T@SV?T7a#qG$(qP2@Ng0d7Doy8{er5#lAf}%oS~YLyu6XT zo}s$Fo{_$avVo$4ii)z{FRmdT<&Q<nV^so&Is%v{_5aYtd z&MpJc-n9p73V{1=QSq7Yhi&%#e$r*j>~xo~wU~?+M6M|%6FAh#eSLlSwXw$gXL)%q ztpB(H5f}e6A}l#3<}H4?QU^VwlMJV>0-MHhvD`_wzrLN+NTjQ8Mrph>+sLh@;yFcr zipjmdIOsmye6@k>%M45$)7^}vQmKIb8$h(!!hqehg7_W+l-60CRLS_BXMCain!#IN zhnCw32@S}EyqugHquRq(gMEJM0?HPrHBnQGDs}XknzI#=a|;XEmr|!s!nyX^CyMbS zOd4HMt%&ooJ#|kP!Uhe_*>tU{bj1^w7Tn=76LiL`ytkDFh5RDBA_DZnUma+-c-I)^ z+7_qV4cVc~4<4v{Rt@EI{C-e$*^WM1!RvK(vJ$04(LTsa6M!Tn4I2iHXfn zu%oq+C$is^Raf`hiKo?>7Jqya6&3ZVwN<~UgoV$x)y3OK=I7lPKg{lZ2-gRJan|)D z$HY`y>8nazDn?iB`rhq(R>entWfo=fZr{ia6~iC?{E@Y_xjD%Qj5Jy*DJhBFUK(<} zj>RIB81idP$9h7!_Hu8lfb!Ew8+Xj(Sgve#nt*PGx6IBii#)I1kB5{#JIQtZ=1ar)un`G)7+}anQ-pd4Pcaw;!!K_ z3-U(=&ix3c<~pd;i}mINe#QCaHeDa?jLghguIEgSY=BpcNfOrjwWcsF=!MYtL&p>TpYFC+ncewnx+J08FbI+{XP9#0Js=9hEwtbT5pxS%6Q`(&C!rHfK9v;C(UTuwcU=t3p zx97&*eWe~ub;p zTI1-MdCkT*incQX%^U{8*r5R`Wnn8z9 zMnUQ3qNno3@Nm|ZNWoapA6%rHJGIG$LW+RLeO@mCFFYIvTKs3aGS=?Wmr*D_e++jf z={fc)WSdRxiu#kocd zxs>!{X3{Tj<<~9uaF1k&?56yzV3PFzvNhMczuOKJc(37LN`2Sc3)7O6j6->caw!3z zY}r;dPU?D?f64KFVi7M4g}Z>YlZs!O>TUfwH(+IqOuTNG%yKmi3Ikj<}|J&!gj zA3aZ4UVs#5ak?;kI4jNd49ev|)oZXPnU3#H#5bOAJ!g1pmpbzeFvd!@W$&7ONTA)6 z&0zF?#GT!0q)$(fYq51UTeIYb9u*kMkYwD70^Ts#5O45Z{4b1czxm1s)Kzs_#;Edb_(rAmZ1L11Je7wE4VVe zaykV>scm$_LkLP?#p8D+pwRcDMS^_`5~`|yStJ@OnhuD!v>5h913ErN(G~7K)#tb) ze0yqnah&Qm))X1DoO9|AC1-)qx9^oOqmqJRO##b1pndI~&$26l<-#Q=k{RBfr;t9%;=|2pT3xwn`hn|85#uA0gdVEFv0;B zEK*>=sES*J04l%8H+Wnl^U2z>>Q`oEH=OJu6>nb_sFv8+I@r0Fhx?Ws{W`l3C7|nr zg|@}qx}|piQXinLG;>GP2=+#$A(R>L6v zOCleGE*tF|EB#b1xdA_oKmL&*xy_m{SggNzKP7_WPdOPwpxm)2+4$TgpQzs11e+(KM z8|#o>j9#J#%Jn z=bp09{8)_%KGvvU*Elr?C82C!Y|!&SW4D))kx}O}H~dXvX&(sRF~9rqdg$V#e&6|2 z;}W|k&t1f%d#u>##Tz@_Dz|-x@3@y+#jQb;4=YreLR?D`6Lf^|Z7TK4{OT%>_`V?s zW}gmT2#*~a%*x1^fvc;R7MQrIMW{xT!?-;zp(YhlbQMAn;NJF2Kw*~6XQ2~TMVSNr zWAl;%f_2G4Q+kK-%@mu?wE}kc1|J8fWTctEnR@nSgIyUxwVw~4fnXvcD2|2-BmB(d z6J~Jq>8XvQ z981T(%9WsyKjSkBQ^W{o_<6gh*TvR_ocfoTQ(GprtvV@}YMd=DMfh`#D%o<}TRhw3 zE%L<2EU!Op$f^E*HBK4&_$`_eOirb%K0-&|ax;-sq^BgdRFiUcXv=%XJ}GBAyOKyZs@H*$?bY!VU9T;F7n1RAct8Zyy9k*ES-tq>`wczxMDZe=fzq1QYyk&fDYCpJ=$J)S9#TRg0KGkkr0Q0>vwhs8UNPR@h( eO#2U|n*ozMLQIovP9w)ZtR_b0hGqJ0QU3$&SJ)u{ diff --git a/plugins/c9.ide.tree/favorites.js b/plugins/c9.ide.tree/favorites.js index 01f112af..bd430aec 100644 --- a/plugins/c9.ide.tree/favorites.js +++ b/plugins/c9.ide.tree/favorites.js @@ -93,7 +93,8 @@ define(function(require, exports, module) { status: "loaded", map: {}, children: [], - noSelect: true + noSelect: true, + $sorted: true }] }; @@ -230,6 +231,7 @@ define(function(require, exports, module) { favRoot.children.splice(index, 0, favNode); fsCache.refresh(favRoot); emit("favoriteReorder"); + update(favNode); } }, true);