From c7f8f8259daae31b03ae27afea20b21c542ec667 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 11 Apr 2015 14:10:23 +0400 Subject: [PATCH 1/8] restore commit 'tweak install-sdk.sh script' --- scripts/install-sdk.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/install-sdk.sh b/scripts/install-sdk.sh index 15199f95..2a7fda84 100755 --- a/scripts/install-sdk.sh +++ b/scripts/install-sdk.sh @@ -66,7 +66,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; @@ -79,7 +79,7 @@ updateAllPackages() { updateNodeModules() { echo "${magenta}--- Running npm install --------------------------------------------${resetColor}" safeInstall(){ - deps=`"$NODE" -e 'console.log(Object.keys(require("./package.json").dependencies).join(" "))'`; + deps=(`"$NODE" -e 'console.log(Object.keys(require("./package.json").dependencies).join(" "))'`) for m in $deps; do echo $m; "$NPM" install --loglevel warn $m || true done @@ -124,6 +124,10 @@ installGlobalDeps() { NPM=npm NODE=node +# cleanup build cache since c9.static doesn't do this automatically yet +rm -rf ./build/standalone + +# pull the latest version updateCore || true installGlobalDeps From 8ec0d8e5fefb491a371e73f2107ad9ed504bae69 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 21 Apr 2015 23:59:39 +0400 Subject: [PATCH 2/8] fix scrollbar regression --- node_modules/ace_tree/lib/ace_tree/css/tree.css | 1 - 1 file changed, 1 deletion(-) diff --git a/node_modules/ace_tree/lib/ace_tree/css/tree.css b/node_modules/ace_tree/lib/ace_tree/css/tree.css index 5fafd0d5..ab21e51f 100644 --- a/node_modules/ace_tree/lib/ace_tree/css/tree.css +++ b/node_modules/ace_tree/lib/ace_tree/css/tree.css @@ -35,7 +35,6 @@ overflow-x: hidden; overflow-y: auto; right: 0; - top: 0; bottom: 0; } From 42a1dc5592220d7f542a44ea741fd9a06fd8c817 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 22 Apr 2015 00:11:51 +0400 Subject: [PATCH 3/8] selectorText of some css rules can be undefined --- plugins/c9.ide.ui/lib_apf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/c9.ide.ui/lib_apf.js b/plugins/c9.ide.ui/lib_apf.js index 617b89bb..f02c69ac 100644 --- a/plugins/c9.ide.ui/lib_apf.js +++ b/plugins/c9.ide.ui/lib_apf.js @@ -9683,7 +9683,7 @@ var ID = "id", for (j = rules.length - 1; j >= 0; j--) { var rule = rules[j]; - if (!rule.style || !rule.selectorText.match("\." + className + "$")) + if (!rule.style || !(rule.selectorText || "").match("\." + className + "$")) continue; for (style in rule.style) { From 2f1192cf17ca5f0f9c3e170de5380357fecd0f2b Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 22 Apr 2015 01:29:15 +0400 Subject: [PATCH 4/8] do not set cwd to missing folder --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a9fcc448..25f37ceb 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "c9.ide.help.support": "#60e88f5680", "c9.ide.imgeditor": "#08bbc53578", "c9.ide.immediate": "#6845a93705", - "c9.ide.installer": "#d5310aa5c5", + "c9.ide.installer": "#af09bc759a", "c9.ide.mount": "#cb45b621f1", "c9.ide.navigate": "#64156c7f4a", "c9.ide.newresource": "#f1f0624768", From c4dbbcc0ea058b313bddf7e68e17324912a2dd5c Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 22 Apr 2015 01:55:32 +0400 Subject: [PATCH 5/8] fix typo, increase default width --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25f37ceb..1fc3ff18 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "c9.ide.help.support": "#60e88f5680", "c9.ide.imgeditor": "#08bbc53578", "c9.ide.immediate": "#6845a93705", - "c9.ide.installer": "#af09bc759a", + "c9.ide.installer": "#4cd918ed36", "c9.ide.mount": "#cb45b621f1", "c9.ide.navigate": "#64156c7f4a", "c9.ide.newresource": "#f1f0624768", From 7b69f069dc28a1f8e58cd8255d3b262397ae03f6 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 22 Apr 2015 01:58:53 +0400 Subject: [PATCH 6/8] add tab commands to the list of exceptions --- plugins/c9.ide.keys/commands.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/plugins/c9.ide.keys/commands.js b/plugins/c9.ide.keys/commands.js index f1e30fe9..2f8e7fda 100644 --- a/plugins/c9.ide.keys/commands.js +++ b/plugins/c9.ide.keys/commands.js @@ -339,10 +339,10 @@ define(function(require, exports, module) { commands.previoustab, commands.nextpane, commands.previouspane, - commands.exit || {}, - commands.hidesearchreplace || {}, - commands.hidesearchinfiles || {}, - commands.toggleconsole || {}, + commands.exit, + commands.hidesearchreplace, + commands.hidesearchinfiles, + commands.toggleconsole, commands.runlast, commands.run, commands.resume, @@ -355,8 +355,19 @@ define(function(require, exports, module) { commands.new, commands.build, commands.switchterminal, - commands.findinfiles - ]; + commands.findinfiles, + commands.tab1, + commands.tab2, + commands.tab3, + commands.tab4, + commands.tab5, + commands.tab6, + commands.tab7, + commands.tab8, + commands.tab9, + commands.tab0, + commands.reopenLastTab, + ].filter(Boolean); } function getExceptionBindings(){ From a34c7e88bff1364bc32e37a9430ed63417e42146 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 22 Apr 2015 03:25:29 +0400 Subject: [PATCH 7/8] fix c9 install --- plugins/c9.cli.publish/publish.js | 134 ++++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 34 deletions(-) diff --git a/plugins/c9.cli.publish/publish.js b/plugins/c9.cli.publish/publish.js index eec65672..2ab55d97 100644 --- a/plugins/c9.cli.publish/publish.js +++ b/plugins/c9.cli.publish/publish.js @@ -81,7 +81,7 @@ define(function(require, exports, module) { } }, check: function(argv) { - if (argv._.length < 2 && !argv["newversion"]) + if (argv._.length < 2 && !argv["newversion"] && !argv["dry-run"]) throw new Error("Missing version"); }, exec: function(argv) { @@ -100,7 +100,7 @@ define(function(require, exports, module) { console.error("\nTry running with --verbose flag for more information"); process.exit(1); } - else { + else if (!dryRun) { console.log("Succesfully published version", data.version); process.exit(0); } @@ -108,6 +108,55 @@ define(function(require, exports, module) { } }); + cmd.addCommand({ + name: "build", + info: " Builds development version of package to load in non-debug mode.", + usage: "[--devel]", + options: { + "devel" : { + "description": "", + "alias": "d", + "default": false, + "boolean": true + } + }, + exec: function(argv) { + if (argv["devel"]) { + var code = function(argument) { + /* TODO explain */ + define("plugins/PACKAGE_NAME/__installed__", [],[ + "plugins/PACKAGE_NAME/__debug__" + ]); + define("plugins/PACKAGE_NAME/__debug__",[], function(require, exports, module) { + main.consumes = ["plugin.debug"]; + main.provides = []; + return main; + + function main(options, imports, register) { + var debug = imports["plugin.debug"]; + debug.loadPackage("PACKAGE_NAME"); + } + }); + }.toString(); + var cwd = process.cwd(); + var packageName = basename(cwd); + var indent = code.match(/\n\r?(\s*)/)[1].length; + code = code + .replace(/\r/g, "") + .replace(new RegExp("^ {" + indent + "}", "gm"), "") + .replace(/^.*?{|}$/g, "") + .trim() + .replace(/PACKAGE_NAME/g, packageName); + + fs.writeFileSync(cwd + "/__installed__.js", code, "utf8") + } else { + dryRun = true + publish({local: true}, function(err, data){}); + } + + } + }); + cmd.addCommand({ name: "unpublish", info: "Disables a cloud9 package.", @@ -316,7 +365,11 @@ define(function(require, exports, module) { }); } - function publish(version, callback) { + function publish(options, callback) { + if (typeof options != "object") + options = {version: options}; + + var version = options.version; var cwd = process.cwd(); var packagePath = cwd + "/package.json"; fs.readFile(packagePath, function(err, data){ @@ -381,31 +434,35 @@ define(function(require, exports, module) { if (failed) return callback(new Error()); - if (warned && !force) + if (warned && !force && !dryRun) return callback(new Error("Use --force to ignore these warnings.")); - var v = (json.version || "0.0.1").split("."); - - // Update the version field in the package.json file - if (version == "major") { - v[0]++; - v[1] = 0; - v[2] = 0; + if (!dryRun) { + var v = (json.version || "0.0.1").split("."); + // Update the version field in the package.json file + if (version == "major") { + v[0]++; + v[1] = 0; + v[2] = 0; + } + else if (version == "minor") { + v[1]++; + v[2] = 0; + } + else if (version == "patch" || version == "build") v[2]++; + else if (version.match(/^\d+\.\d+\.\d+$/)) + v = version.split("."); + else + return callback(new Error("Invalid version. Semver required: " + version)); + + json.version = v.join("."); } - else if (version == "minor") { - v[1]++; - v[2] = 0; - } - else if (version == "patch" || version == "build") v[2]++; - else if (version.match(/^\d+\.\d+\.\d+$/)) - v = version.split("."); - else - return callback(new Error("Invalid version. Semver required: " + version)); - json.version = v.join("."); + if (dryRun) + return build(); // Write the package.json file - fs.writeFile(packagePath, JSON.stringify(json, 1, " "), function(err){ + fs.writeFile(packagePath, JSON.stringify(json, null, " "), function(err){ if (err) return callback(err); if (dryRun) return build(); @@ -414,6 +471,7 @@ define(function(require, exports, module) { .replace(/\$1/, packagePath) .replace(/\$2/, json.version); + // commit proc.spawn("bash", { args: ["-c", SHELLSCRIPT] }, function(err, p){ @@ -550,6 +608,8 @@ define(function(require, exports, module) { }); } + packedFiles.push(cwd + "/__installed__.js"); + if (json.installer) { var path = join(cwd, json.installer); var installerCode = fs.readFileSync(path, "utf8"); @@ -658,22 +718,19 @@ define(function(require, exports, module) { }); }, function(next) { - fs.writeFile("__packed__.js", result.code, "utf8", next); + var filename = options.local ? "__installed__.js" : "__packed__.js"; + fs.writeFile(filename, result.code, "utf8", next); }, function(next) { // console.log(packedFiles) + if (options.local) + return callback(); zip(packedFiles); } ]); } - function normalizePath(p) { - if (process.platform == "win32") - p = p.replace(/\\/g, "/").replace(/^(\w):/, "/$1"); - return p; - } - function zip(ignore){ zipFilePath = join(os.tmpDir(), json.name + "@" + json.version) + ".tar.gz"; var tarArgs = ["-zcvf", normalizePath(zipFilePath), "."]; @@ -709,9 +766,10 @@ define(function(require, exports, module) { if (code !== 0) return callback(new Error("ERROR: Could not package directory")); - console.log("Built package", json.name + "@" + json.version); + console.log("Built package", json.name + "@" + json.version + + (dryRun ? " at " + zipFilePath : "")); - if (dryRun) return callback(1); + if (dryRun) return callback(); upload(); }); @@ -932,15 +990,17 @@ define(function(require, exports, module) { console.log("Downloading package to", gzPath); request.on('response', function(res) { - if (res.statusCode != 200) + if (res.statusCode != 200) return callback(new Error("Unknown Error:" + res.statusCode)); - + }); + + file.on('finish', function(err) { if (verbose) console.log("Unpacking", gzPath, "to", packagePath); // Untargz package proc.spawn(TAR, { - args: ["-C", packagePath, "-zxvf", gzPath] + args: ["-C", normalizePath(packagePath), "-zxvf", normalizePath(gzPath)] }, function(err, p){ if (err) return callback(err); @@ -1108,6 +1168,12 @@ define(function(require, exports, module) { prevDir = curDir + '/'; } } + + function normalizePath(p) { + if (process.platform == "win32") + p = p.replace(/\\/g, "/").replace(/^(\w):/, "/$1"); + return p; + } /***** Lifecycle *****/ From 06daf4402409dc10b6df6ec3c918561a5c144108 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 22 Apr 2015 03:28:58 +0400 Subject: [PATCH 8/8] do not open html files as django --- plugins/c9.ide.ace/modes.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/c9.ide.ace/modes.js b/plugins/c9.ide.ace/modes.js index 5c14a6e5..b8bfa886 100644 --- a/plugins/c9.ide.ace/modes.js +++ b/plugins/c9.ide.ace/modes.js @@ -26,7 +26,8 @@ Object.keys(modesByName).forEach(function(name) { mode.order = 0; mode.extensions.split("|").forEach(function(ext) { - fileExtensions[ext] = name; + if (!fileExtensions[ext]) + fileExtensions[ext] = name; }); });