kopia lustrzana https://github.com/c9/core
Merge pull request +9869 from c9/fix/various
Fix several small issuespull/223/head
commit
61016b8616
2
bin/c9
2
bin/c9
|
@ -6,8 +6,6 @@ var architect = require("architect");
|
||||||
// Add ability to load AMD modules
|
// Add ability to load AMD modules
|
||||||
require("amd-loader");
|
require("amd-loader");
|
||||||
|
|
||||||
var verbose = process.argv.indexOf("--verbose") + 1
|
|
||||||
|| process.argv.indexOf("-v") + 1;
|
|
||||||
|
|
||||||
architect.resolveConfig(require("../configs/cli.js")(),
|
architect.resolveConfig(require("../configs/cli.js")(),
|
||||||
__dirname + "/../plugins", function (err, config) {
|
__dirname + "/../plugins", function (err, config) {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
module.exports = function(options) {
|
module.exports = function(options) {
|
||||||
|
|
||||||
// workaround for api difference between node and c9 events modules
|
// workaround for api difference between node and c9 events modules
|
||||||
var EventEmitter = require("events").EventEmitter;
|
var EventEmitter = require("../plugins/c9.nodeapi/events").EventEmitter;
|
||||||
var emit_ = EventEmitter.prototype.emit
|
var Module = require("module");
|
||||||
EventEmitter.prototype.emit = function() {
|
var _resolveFilename_orig = Module._resolveFilename
|
||||||
emit_.apply(this, arguments);
|
Module._resolveFilename = function(id, parent) {
|
||||||
return true;
|
if (id == "events" && parent && /c9.core[\\/]ext\.js/.test(parent.id))
|
||||||
}
|
id = "../c9.nodeapi/events";
|
||||||
|
return _resolveFilename_orig.call(Module, id, parent);
|
||||||
|
};
|
||||||
|
|
||||||
var PID = process.env.C9_PID || 526;
|
var PID = process.env.C9_PID || 526;
|
||||||
var APIHOST = process.env.C9_APIHOST || "api.c9.io"; // "api.c9.io";
|
var APIHOST = process.env.C9_APIHOST || "api.c9.io"; // "api.c9.io";
|
||||||
|
|
|
@ -350,7 +350,7 @@ module.exports = function setup(fsOptions) {
|
||||||
|
|
||||||
// This helper function doesn't follow node conventions in the callback,
|
// This helper function doesn't follow node conventions in the callback,
|
||||||
// there is no err, only entry.
|
// there is no err, only entry.
|
||||||
function createStatEntry(file, fullpath, callback) {
|
function createStatEntry(file, fullpath, callback, _loop) {
|
||||||
fs.lstat(fullpath, function (err, stat) {
|
fs.lstat(fullpath, function (err, stat) {
|
||||||
var entry = {
|
var entry = {
|
||||||
name: file
|
name: file
|
||||||
|
@ -378,26 +378,29 @@ module.exports = function setup(fsOptions) {
|
||||||
return callback(entry);
|
return callback(entry);
|
||||||
}
|
}
|
||||||
fs.readlink(fullpath, function (err, link) {
|
fs.readlink(fullpath, function (err, link) {
|
||||||
if (entry.name == link) {
|
|
||||||
entry.linkStatErr = "ELOOP: recursive symlink";
|
|
||||||
return callback(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
entry.linkErr = err.stack;
|
entry.linkErr = err.stack;
|
||||||
return callback(entry);
|
return callback(entry);
|
||||||
}
|
}
|
||||||
|
var fullLinkPath = pathResolve(dirname(fullpath), link);
|
||||||
|
if (!_loop) {
|
||||||
|
_loop = {fullLinkPath: fullpath, max: 100};
|
||||||
|
}
|
||||||
|
if (fullLinkPath.toLowerCase() == _loop.fullLinkPath.toLowerCase() || _loop.max --< 0) {
|
||||||
|
entry.linkErr = "ELOOP: recursive symlink";
|
||||||
|
return callback(entry);
|
||||||
|
}
|
||||||
entry.link = link;
|
entry.link = link;
|
||||||
resolvePath(pathResolve(dirname(fullpath), link), {alreadyRooted: true}, function (err, newpath) {
|
resolvePath(fullLinkPath, {alreadyRooted: true}, function (err, newpath) {
|
||||||
if (err) {
|
if (err) {
|
||||||
entry.linkStatErr = err;
|
entry.linkErr = err;
|
||||||
return callback(entry);
|
return callback(entry);
|
||||||
}
|
}
|
||||||
createStatEntry(basename(newpath), newpath, function (linkStat) {
|
createStatEntry(basename(newpath), newpath, function (linkStat) {
|
||||||
entry.linkStat = linkStat;
|
entry.linkStat = linkStat;
|
||||||
linkStat.fullPath = newpath.substr(base.length) || "/";
|
linkStat.fullPath = newpath.substr(base.length) || "/";
|
||||||
return callback(entry);
|
return callback(entry);
|
||||||
});
|
}, _loop);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ define(function(require, exports, module) {
|
||||||
var force = false;
|
var force = false;
|
||||||
var dryRun = false;
|
var dryRun = false;
|
||||||
var createTag = false;
|
var createTag = false;
|
||||||
|
var compress = false;
|
||||||
|
|
||||||
// Set up basic auth for api if needed
|
// Set up basic auth for api if needed
|
||||||
if (BASICAUTH) api.basicAuth = BASICAUTH;
|
if (BASICAUTH) api.basicAuth = BASICAUTH;
|
||||||
|
@ -85,6 +86,11 @@ define(function(require, exports, module) {
|
||||||
"alias": "t",
|
"alias": "t",
|
||||||
"default": false,
|
"default": false,
|
||||||
"boolean": true
|
"boolean": true
|
||||||
|
},
|
||||||
|
"compress" : {
|
||||||
|
"description": "Minify output with uglify.js",
|
||||||
|
"default": true,
|
||||||
|
"boolean": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
check: function(argv) {
|
check: function(argv) {
|
||||||
|
@ -125,9 +131,17 @@ define(function(require, exports, module) {
|
||||||
"alias": "d",
|
"alias": "d",
|
||||||
"default": false,
|
"default": false,
|
||||||
"boolean": true
|
"boolean": true
|
||||||
|
},
|
||||||
|
"compress" : {
|
||||||
|
"description": "Minify output with uglify.js",
|
||||||
|
"default": false,
|
||||||
|
"boolean": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
exec: function(argv) {
|
exec: function(argv) {
|
||||||
|
compress = argv["compress"];
|
||||||
|
verbose = argv["verbose"];
|
||||||
|
force = argv["force"];
|
||||||
if (argv["devel"]) {
|
if (argv["devel"]) {
|
||||||
var code = function(argument) {
|
var code = function(argument) {
|
||||||
/* TODO explain */
|
/* TODO explain */
|
||||||
|
@ -159,13 +173,14 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dryRun = true;
|
dryRun = true;
|
||||||
publish({local: true}, function(err){
|
publish({local: true}, function(err, result){
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
if (!verbose)
|
if (!verbose)
|
||||||
console.error("\nTry running with --verbose flag for more information");
|
console.error("\nTry running with --verbose flag for more information");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
console.log("Done!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,6 +201,7 @@ define(function(require, exports, module) {
|
||||||
check: function(argv) {},
|
check: function(argv) {},
|
||||||
exec: function(argv) {
|
exec: function(argv) {
|
||||||
verbose = argv["verbose"];
|
verbose = argv["verbose"];
|
||||||
|
compress = argv["compress"];
|
||||||
|
|
||||||
unpublish(
|
unpublish(
|
||||||
function(err, data){
|
function(err, data){
|
||||||
|
@ -574,7 +590,7 @@ define(function(require, exports, module) {
|
||||||
enableBrowser: true,
|
enableBrowser: true,
|
||||||
includeConfig: false,
|
includeConfig: false,
|
||||||
noArchitect: true,
|
noArchitect: true,
|
||||||
compress: !dryRun,
|
compress: compress,
|
||||||
obfuscate: true,
|
obfuscate: true,
|
||||||
oneLine: true,
|
oneLine: true,
|
||||||
filter: [],
|
filter: [],
|
||||||
|
|
|
@ -561,8 +561,8 @@ define(function(require, exports, module) {
|
||||||
node.size = stat.size;
|
node.size = stat.size;
|
||||||
if (stat.mtime != undefined)
|
if (stat.mtime != undefined)
|
||||||
node.mtime = stat.mtime;
|
node.mtime = stat.mtime;
|
||||||
if (original_stat)
|
if (original_stat || stat.linkErr)
|
||||||
node.link = stat.fullPath;
|
node.link = stat.fullPath || stat.linkErr;
|
||||||
node.isFolder = isFolder;
|
node.isFolder = isFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue