kopia lustrzana https://github.com/c9/core
Merge pull request +7367 from c9/fix/various
Fix several small issuespull/43/merge
commit
2707be406a
|
@ -66,6 +66,7 @@ function logToFile(message){
|
||||||
module.exports = function setup(fsOptions) {
|
module.exports = function setup(fsOptions) {
|
||||||
var pty;
|
var pty;
|
||||||
if (!fsOptions.nopty) {
|
if (!fsOptions.nopty) {
|
||||||
|
// on darwin trying to load binary for a wrong version crashes the process
|
||||||
[process.env.HOME + "/.c9/node_modules/pty.js", "pty.js", "pty.nw.js"].some(function(p) {
|
[process.env.HOME + "/.c9/node_modules/pty.js", "pty.js", "pty.nw.js"].some(function(p) {
|
||||||
try {
|
try {
|
||||||
pty = require(p);
|
pty = require(p);
|
||||||
|
@ -1465,15 +1466,15 @@ module.exports = function setup(fsOptions) {
|
||||||
}
|
}
|
||||||
if (options.resumeStdin) child.stdin.resume();
|
if (options.resumeStdin) child.stdin.resume();
|
||||||
if (options.hasOwnProperty('stdoutEncoding')) {
|
if (options.hasOwnProperty('stdoutEncoding')) {
|
||||||
child.stdout.setEncoding(options.stdoutEncoding);
|
child.stdout && child.stdout.setEncoding(options.stdoutEncoding);
|
||||||
}
|
}
|
||||||
if (options.hasOwnProperty('stderrEncoding')) {
|
if (options.hasOwnProperty('stderrEncoding')) {
|
||||||
child.stderr.setEncoding(options.stderrEncoding);
|
child.stderr && child.stderr.setEncoding(options.stderrEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
// node 0.10.x emits error events if the file does not exist
|
// node 0.10.x emits error events if the file does not exist
|
||||||
child.on("error", function(err) {
|
child.on("error", function(err) {
|
||||||
child.emit("exit", 127);
|
child.emit("exit", 127);
|
||||||
});
|
});
|
||||||
|
|
||||||
callback(null, {
|
callback(null, {
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
"c9.ide.language.javascript.tern": "#7aab8b0b6a",
|
"c9.ide.language.javascript.tern": "#7aab8b0b6a",
|
||||||
"c9.ide.language.javascript.infer": "#cfec494a3c",
|
"c9.ide.language.javascript.infer": "#cfec494a3c",
|
||||||
"c9.ide.language.jsonalyzer": "#c253f093a0",
|
"c9.ide.language.jsonalyzer": "#c253f093a0",
|
||||||
"c9.ide.collab": "#e9dd74e31e",
|
"c9.ide.collab": "#3fc640077c",
|
||||||
"c9.ide.local": "#a9703b630c",
|
"c9.ide.local": "#a9703b630c",
|
||||||
"c9.ide.find": "#6cc6d3379d",
|
"c9.ide.find": "#6cc6d3379d",
|
||||||
"c9.ide.find.infiles": "#72582de3cd",
|
"c9.ide.find.infiles": "#72582de3cd",
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
"c9.ide.help.support": "#6bcfa8ceff",
|
"c9.ide.help.support": "#6bcfa8ceff",
|
||||||
"c9.ide.imgeditor": "#ed89162aa7",
|
"c9.ide.imgeditor": "#ed89162aa7",
|
||||||
"c9.ide.immediate": "#6845a93705",
|
"c9.ide.immediate": "#6845a93705",
|
||||||
"c9.ide.installer": "#4830bcd2f5",
|
"c9.ide.installer": "#3e6f7a72c9",
|
||||||
"c9.ide.mount": "#896ebf836e",
|
"c9.ide.mount": "#896ebf836e",
|
||||||
"c9.ide.navigate": "#055a1f1a80",
|
"c9.ide.navigate": "#055a1f1a80",
|
||||||
"c9.ide.newresource": "#f1f0624768",
|
"c9.ide.newresource": "#f1f0624768",
|
||||||
|
|
|
@ -197,6 +197,32 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
/***** Methods *****/
|
/***** Methods *****/
|
||||||
|
|
||||||
|
function spawn(command, options, callback) {
|
||||||
|
if (options.stdio == null) {
|
||||||
|
// if verbose, echo stdout
|
||||||
|
// always echo stderr
|
||||||
|
options.stdio = [
|
||||||
|
"pipe",
|
||||||
|
verbose ? process.stdout : "ignore",
|
||||||
|
process.stderr
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
proc.spawn(command, options, function(err, child) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
|
||||||
|
child.on("exit", function(code) {
|
||||||
|
if (code !== 0) {
|
||||||
|
var error = new Error("Command failed: " + command);
|
||||||
|
error.code = code;
|
||||||
|
return callback(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function stringifyError(err){
|
function stringifyError(err){
|
||||||
return (verbose ? JSON.stringify(err, 4, " ") : (typeof err == "string" ? err : err.message));
|
return (verbose ? JSON.stringify(err, 4, " ") : (typeof err == "string" ? err : err.message));
|
||||||
}
|
}
|
||||||
|
@ -551,7 +577,7 @@ define(function(require, exports, module) {
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
if (options.local)
|
if (options.local)
|
||||||
fs.writeFile(cwd + "/__installed__.js", result.code, "utf8", callback);
|
return fs.writeFile(cwd + "/__installed__.js", result.code, "utf8", callback);
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
@ -603,32 +629,19 @@ define(function(require, exports, module) {
|
||||||
tarArgs.push("--exclude-from=" + c9ignore);
|
tarArgs.push("--exclude-from=" + c9ignore);
|
||||||
}
|
}
|
||||||
tarArgs.push(".");
|
tarArgs.push(".");
|
||||||
proc.spawn(TAR, {
|
spawn(TAR, {
|
||||||
args: tarArgs,
|
args: tarArgs,
|
||||||
cwd: cwd + "/.c9/.build"
|
cwd: cwd + "/.c9/.build"
|
||||||
}, function(err, p){
|
}, function(err){
|
||||||
if (err) return callback(err);
|
if (err)
|
||||||
|
return callback(new Error("ERROR: Could not package directory"));
|
||||||
|
|
||||||
|
console.log("Built package", json.name + "@" + json.version +
|
||||||
|
(dryRun ? " at " + zipFilePath : ""));
|
||||||
|
|
||||||
if (verbose) {
|
if (dryRun) return callback();
|
||||||
p.stdout.on("data", function(c){
|
|
||||||
process.stdout.write(c.toString("utf8"));
|
|
||||||
});
|
|
||||||
p.stderr.on("data", function(c){
|
|
||||||
process.stderr.write(c.toString("utf8"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
p.on("exit", function(code){
|
upload();
|
||||||
if (code !== 0)
|
|
||||||
return callback(new Error("ERROR: Could not package directory"));
|
|
||||||
|
|
||||||
console.log("Built package", json.name + "@" + json.version +
|
|
||||||
(dryRun ? " at " + zipFilePath : ""));
|
|
||||||
|
|
||||||
if (dryRun) return callback();
|
|
||||||
|
|
||||||
upload();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -748,28 +761,12 @@ define(function(require, exports, module) {
|
||||||
if (!createTag)
|
if (!createTag)
|
||||||
callback(null, json);
|
callback(null, json);
|
||||||
|
|
||||||
proc.spawn("bash", {
|
spawn("bash", {
|
||||||
args: ["-c", SHELLSCRIPT, "--", json.version, normalizePath(packagePath)]
|
args: ["-c", SHELLSCRIPT, "--", json.version, normalizePath(packagePath)]
|
||||||
}, function(err, p){
|
}, function(err, p){
|
||||||
if (err) return callback(err);
|
if (err) return callback(err);
|
||||||
|
console.log("Created tag and updated package.json to version", json.version);
|
||||||
if (verbose) {
|
callback(null, json);
|
||||||
p.stdout.on("data", function(c){
|
|
||||||
process.stdout.write(c.toString("utf8"));
|
|
||||||
});
|
|
||||||
p.stderr.on("data", function(c){
|
|
||||||
process.stderr.write(c.toString("utf8"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
p.on("exit", function(code, stderr, stdout){
|
|
||||||
if (code !== 0)
|
|
||||||
return callback(new Error("ERROR: publish failed with exit code " + code));
|
|
||||||
|
|
||||||
console.log("Created tag and updated package.json to version", json.version);
|
|
||||||
|
|
||||||
callback(null, json);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue