kopia lustrzana https://github.com/c9/core
Merge pull request +6981 from c9/fix/various
Fix various small issuespull/85/head
commit
1231f2293e
|
@ -35,7 +35,6 @@
|
|||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
"c9.ide.help.support": "#60e88f5680",
|
||||
"c9.ide.imgeditor": "#08bbc53578",
|
||||
"c9.ide.immediate": "#6845a93705",
|
||||
"c9.ide.installer": "#f8f0d11bff",
|
||||
"c9.ide.installer": "#4cd918ed36",
|
||||
"c9.ide.mount": "#32e79866ee",
|
||||
"c9.ide.navigate": "#64156c7f4a",
|
||||
"c9.ide.newresource": "#f1f0624768",
|
||||
|
|
|
@ -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 *****/
|
||||
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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(){
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue