diff --git a/.gitignore b/.gitignore index 26d542fd..1d4bcfff 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ plugins/c9.vfs.standalone/www/charts plugins/c9.ide.language.javascript.tern/util/sigs_ts plugins/c9.account.billing/node_modules/ plugins/c9.account/node_modules/ +plugins/c9.api.project/coverage/ scripts/build build/output build/standalone/ diff --git a/configs/client-default.js b/configs/client-default.js index ef29d895..3c5cbac5 100644 --- a/configs/client-default.js +++ b/configs/client-default.js @@ -14,7 +14,6 @@ module.exports = function(options) { var collab = options.collab; var packaging = options.packaging; var staticPrefix = options.staticPrefix; - var ssh = options.ssh; var nodeBin = options.nodeBin || ["node"]; var nodePath = options.nodePath || ""; @@ -392,7 +391,34 @@ module.exports = function(options) { }, { packagePath: "plugins/c9.ide.console/console", - staticPrefix: staticPrefix + "/plugins/c9.ide.layout.classic" + staticPrefix: staticPrefix + "/plugins/c9.ide.layout.classic", + defaultState: options.project.scmurl ? { + type: "pane", + nodes: [{ + type: "tab", + editorType: "terminal", + active: "true", + document: { + changed: false, + meta: { + timestamp: Date.now() + }, + filter: true, + title: "bash - \"Cloning ...\"", + tooltip: "bash - \"Cloning ...\"", + terminal: { + id: "clone", + cwd: "" + } + } + }, { + type: "tab", + editorType: "immediate", + document: { + title: "Immediate" + } + }] + } : null }, // Layout & Panels diff --git a/node_modules/c9/ssh.js b/node_modules/c9/ssh.js index 3dddbeb9..7d8f7917 100644 --- a/node_modules/c9/ssh.js +++ b/node_modules/c9/ssh.js @@ -5,9 +5,12 @@ * @license http://github.com/ajaxorg/node-sftp/blob/master/LICENSE MIT License */ +"use strict"; + var child_process = require("child_process"); var fs = require("fs"); -var uuid = require("node-uuid"); +var tmp = require("tmp"); +var debug = require("debug")("ssh"); exports.buildArgs = function(prvkeyFile, host) { var args = [ @@ -35,37 +38,42 @@ exports.buildArgs = function(prvkeyFile, host) { exports.spawnWithKeyFile = function(prvkeyFile, host, command, args) { var sshArgs = exports.buildArgs(prvkeyFile, host); - var args = sshArgs.concat(command ? [command] : []).concat(args || []); - console.log("executing: ssh " + args.join(" ")); + args = sshArgs.concat(command ? [command] : []).concat(args || []); + debug("executing: ssh " + args.join(" ")); return child_process.spawn("ssh", args); }; exports.writeKeyFile = function(prvkey, callback) { - var filename = Util.DEFAULT_TMPDIR + "/" + uuid(); - fs.writeFile(filename, prvkey, function(err) { - if (err) - return callback(err); - - fs.chmod(filename, "0600", function(err) { - callback(err, filename); + tmp.tmpName(function(err, filename) { + if (err) return callback(err); + + fs.writeFile(filename, prvkey, function(err) { + if (err) return callback(err); + + fs.chmod(filename, "0600", function(err) { + callback(err, filename); + }); }); }); }; exports.writeKeyFiles = function(prvkey, pubkey, callback) { - var filename = Util.DEFAULT_TMPDIR + "/" + uuid(); - fs.writeFile(filename, prvkey, function(err) { - if (err) - return callback(err); - - fs.chmod(filename, "0600", function(err) { - fs.writeFile(filename + ".pub", pubkey, function(err) { - if (err) - return callback(err); - - fs.chmod(filename + ".pub", "0600", function(err) { - callback(err, filename); + tmp.tmpName(function(err, filename) { + if (err) return callback(err); + + fs.writeFile(filename, prvkey, function(err) { + if (err) return callback(err); + + fs.chmod(filename, "0600", function(err) { + if (err) return callback(err); + + fs.writeFile(filename + ".pub", pubkey, function(err) { + if (err) return callback(err); + + fs.chmod(filename + ".pub", "0600", function(err) { + callback(err, filename); + }); }); }); }); @@ -74,6 +82,8 @@ exports.writeKeyFiles = function(prvkey, pubkey, callback) { exports.spawn = function(prvkey, host, command, args, callback) { exports.writeKeyFile(prvkey, function(err, filename) { + if (err) return callback(err); + var child = exports.spawnWithKeyFile(filename, host, command, args); child.on("exit", function(code) { @@ -106,33 +116,31 @@ exports.exec = function(prvkey, host, command, args, callback) { }; exports.generateKeyPair = function(email, callback) { - var tmp = process.env.TMP || process.env.TMPDIR || process.env.TMP_DIR || "/tmp"; - var filename = tmp + "/" + uuid(); - var phrase = ""; - - var command = "ssh-keygen -t rsa " + - "-f \"" + filename + "\" " + - "-P \"" + phrase + "\" " + - "-C \"" + email + "\" "; - - child_process.exec(command, function (err, stdout, stderr) { - if (err) - return callback(err); - - fs.readFile(filename + ".pub", function (err, pubkey) { - if (err) - return callback(err); - - fs.readFile(filename, function (err, prvkey) { - if (err) - return callback(err); - - fs.unlink(filename + ".pub", function() { - fs.unlink(filename, function() { - callback(null, pubkey.toString(), prvkey.toString()); + tmp.tmpName(function(err, filename) { + if (err) return callback(err); + + var phrase = ""; + + var command = "ssh-keygen -t rsa " + + "-f \"" + filename + "\" " + + "-P \"" + phrase + "\" " + + "-C \"" + email + "\" "; + + child_process.exec(command, function (err, stdout, stderr) { + if (err) return callback(err); + + fs.readFile(filename + ".pub", function (err, pubkey) { + if (err) return callback(err); + + fs.readFile(filename, function (err, prvkey) { + if (err) return callback(err); + + fs.unlink(filename + ".pub", function() { + fs.unlink(filename, function() { + callback(null, pubkey.toString(), prvkey.toString()); + }); }); }); - }); }); }); @@ -140,9 +148,9 @@ exports.generateKeyPair = function(email, callback) { exports.validateSSHKey = function(prvkey, host, callback) { exports.exec(prvkey, host, "", [], function(err, stdout, stderr) { - //console.log("out >> " + stdout) - //console.log("err >> " + stderr) - //console.log(err) + // console.log("out >> " + stdout); + // console.log("err >> " + stderr); + // console.log(err); callback(null, !stderr.match(/Permission denied \(.*publickey/)); }); }; diff --git a/node_modules/frontdoor/lib/types.js b/node_modules/frontdoor/lib/types.js index 9256c8aa..1980238a 100644 --- a/node_modules/frontdoor/lib/types.js +++ b/node_modules/frontdoor/lib/types.js @@ -53,6 +53,7 @@ exports.RegExp.prototype.parse = function(value) { return value.toString(); }; exports.RegExp.prototype.check = function(value) { + if (typeof value !== "string") return false; value = value.toString(); var match = value.match(this.re); return match && value === match[0];