Merge branch 'master' of github.com:c9/newclient into feature/teams-signup

Conflicts:
	.gitignore
	configs/client-account.js
pull/85/head
Nikolai Onken 2015-04-28 11:00:59 +00:00
commit b4a5c0db74
12 zmienionych plików z 168 dodań i 84 usunięć

Wyświetl plik

@ -122,7 +122,7 @@ var supportedModes = {
Pascal: ["pas|p"],
Perl: ["pl|pm"],
pgSQL: ["pgsql"],
PHP: ["php|phtml"],
PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp"],
Powershell: ["ps1"],
Praat: ["praat|praatscript|psc|proc"],
Prolog: ["plg|prolog"],

Wyświetl plik

@ -144,6 +144,16 @@ module.exports = {
exec("selectleft", 1);
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '("foo")');
editor.setValue("", 1);
exec("selectleft", 1);
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '""');
exec("insertstring", 1, '\\');
exec("insertstring", 1, 'n');
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '"\\n"');
},
"test: xml": function() {
editor = new Editor(new MockRenderer());

Wyświetl plik

@ -269,8 +269,8 @@ var CstyleBehaviour = function() {
if (leftChar == "\\" && token && /escape/.test(token.type))
return null;
var stringBefore = token && /string/.test(token.type);
var stringAfter = !rightToken || /string/.test(rightToken.type);
var stringBefore = token && /string|escape/.test(token.type);
var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
var pair;
if (rightChar == quote) {

Wyświetl plik

@ -17,7 +17,7 @@ function compress(sources, opts) {
if (pkg.file) console.log("Adding '" + pkg.file + "'.");
toplevel = UglifyJS.parse(pkg.source, {
filename: pkg.file.replace(new RegExp("^" + opts.basepath + "/"), ""), //@todo remove prefix
filename: (pkg.file || pkg.id).replace(new RegExp("^" + opts.basepath + "/"), ""), //@todo remove prefix
toplevel: toplevel
});
});

Wyświetl plik

@ -199,19 +199,21 @@ dest = "/build/webkitbuilds/app.nw"
var args = ["local","-s", "local"];
*/
module.exports = function(options, cb) {
var dest = convertPath(options.dest);
var dest = options.dest && convertPath(options.dest);
var root = convertPath(options.root);
var args = options.args;
ignore = options.ignore && function(id) {
return options.ignore.test(id);
};
build(root, args, function(err, result) {
var serverSource = fs.readFileSync(root + "/server.js", "utf8");
serverSource = serverSource.replace(/^(#.*|"use strict";?|\s)*/, function(a) {
return a.trim() + "\n\n" + patchTemplate + "\n\n";
});
fs.writeFileSync(dest + "/server.js", serverSource, "utf8");
fs.writeFileSync(dest + "/module-map.json", JSON.stringify(result.moduleMap), "utf8");
if (dest) {
var serverSource = fs.readFileSync(root + "/server.js", "utf8");
serverSource = serverSource.replace(/^(#.*|"use strict";?|\s)*/, function(a) {
return a.trim() + "\n\n" + patchTemplate + "\n\n";
});
fs.writeFileSync(dest + "/server.js", serverSource, "utf8");
fs.writeFileSync(dest + "/module-map.json", JSON.stringify(result.moduleMap), "utf8");
}
cb(null, result);
});

Wyświetl plik

@ -73,7 +73,7 @@
"c9.ide.ace.repl": "#ada99852fa",
"c9.ide.ace.split": "#0ae0151c78",
"c9.ide.ace.statusbar": "#d7b45bb7c3",
"c9.ide.ace.stripws": "#34426a03d1",
"c9.ide.ace.stripws": "#cf0f42ac59",
"c9.ide.behaviors": "#6aad7006a0",
"c9.ide.closeconfirmation": "#a28bfd8272",
"c9.ide.configuration": "#adf50fdaa2",
@ -83,7 +83,7 @@
"c9.ide.help.support": "#60e88f5680",
"c9.ide.imgeditor": "#08bbc53578",
"c9.ide.immediate": "#6845a93705",
"c9.ide.installer": "#4c25b26f70",
"c9.ide.installer": "#f8f0d11bff",
"c9.ide.mount": "#32e79866ee",
"c9.ide.navigate": "#64156c7f4a",
"c9.ide.newresource": "#f1f0624768",

Wyświetl plik

@ -1,13 +1,13 @@
PACKAGE_PATH=$1
VERSION=$2
CWD=${PWD}
VERSION="$1"
PACKAGE_PATH="$2"
CWD="${PWD}"
if [ ! -d .git ]; then
echo "$CWD is not a git repository" 1>&2
exit 1
fi
if [ ! -e $PACKAGE_PATH ]; then
if [ ! -f "$PACKAGE_PATH" ]; then
echo "Could not find package.json" 1>&2
exit 1
fi

Wyświetl plik

@ -43,6 +43,7 @@ define(function(require, exports, module) {
var verbose = false;
var force = false;
var dryRun = false;
var createTag = false;
// Set up basic auth for api if needed
if (BASICAUTH) api.basicAuth = BASICAUTH;
@ -78,16 +79,23 @@ define(function(require, exports, module) {
"description": "Only build a test version",
"default": false,
"boolean": true
},
"tag" : {
"description": "Create git tag for published version",
"alias": "t",
"default": false,
"boolean": true
}
},
check: function(argv) {
if (argv._.length < 2 && !argv["newversion"] && !argv["dry-run"])
throw new Error("Missing version");
// if (argv._.length < 2 && !argv["newversion"] && !argv["dry-run"])
// throw new Error("Missing version");
},
exec: function(argv) {
verbose = argv["verbose"];
force = argv["force"];
dryRun = argv["dry-run"];
createTag = argv["tag"];
publish(
argv._[1],
@ -108,7 +116,7 @@ define(function(require, exports, module) {
}
});
cmd.addCommand({
cmd.addCommand({
name: "build",
info: " Builds development version of package to load in non-debug mode.",
usage: "[--devel]",
@ -372,7 +380,7 @@ define(function(require, exports, module) {
var version = options.version;
var cwd = process.cwd();
var packagePath = cwd + "/package.json";
fs.readFile(packagePath, function(err, data){
fs.readFile(packagePath, "utf8", function(err, data){
if (err) return callback(new Error("ERROR: Could not find package.json in " + cwd));
var json;
@ -437,7 +445,7 @@ define(function(require, exports, module) {
if (warned && !force && !dryRun)
return callback(new Error("Use --force to ignore these warnings."));
if (!dryRun) {
if (version) {
var v = (json.version || "0.0.1").split(".");
// Update the version field in the package.json file
if (version == "major") {
@ -458,47 +466,26 @@ define(function(require, exports, module) {
json.version = v.join(".");
}
if (dryRun)
return build();
return build();
// Write the package.json file
fs.writeFile(packagePath, JSON.stringify(json, null, " "), function(err){
if (err) return callback(err);
function updatePackageJSON(next) {
if (!version)
return next();
if (dryRun) return build();
SHELLSCRIPT = SHELLSCRIPT
.replace(/\$1/, packagePath)
.replace(/\$2/, json.version);
// commit
proc.spawn("bash", {
args: ["-c", SHELLSCRIPT]
}, function(err, p){
if (err) return callback(err);
if (verbose) {
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);
build();
// Write the package.json file
var indent = data.match(/{\n\r?^ {4}"/) ? 4 : 2;
var newData = JSON.stringify(json, null, indent);
fs.writeFile(cwd + "/.c9/.build/pacage.json", newData, function(err){
if (dryRun)
return next(); // if dry-run is passed only update path in .build
fs.writeFile(packagePath, newData, function(err){
if (err) return callback(err);
return next();
});
});
});
}
// Build the package
// @TODO use a proper package tool
// @TODO add a .c9exclude file that excludes files
var zipFilePath;
function build(){
@ -718,38 +705,62 @@ define(function(require, exports, module) {
});
},
function(next) {
var filename = options.local ? "__installed__.js" : "__packed__.js";
fs.writeFile(filename, result.code, "utf8", next);
if (options.local)
fs.writeFile(cwd + "__installed__.js", result.code, "utf8", callback);
next();
},
function(next) {
// console.log(packedFiles)
if (options.local)
return callback();
zip(packedFiles);
proc.execFile("rm", {
args: ["-rf", ".c9/.build"],
cwd: cwd
}, function() {
mkdirP(cwd + "/.c9/.build");
fs.writeFile(cwd + "/.c9/.build/__installed__.js", result.code, "utf8", next);
});
},
function(next) {
var copy = require("architect-build/copy");
var excludeRe = /^\.(gitignore|hgignore|git|c9|hg)$/;
var excludeMap = Object.create(null);
packedFiles.push(cwd + "/__installed__.js");
packedFiles.forEach(function(p) {
p = "/" + normalizePath(Path.relative(cwd, p));
excludeMap[p] = 1;
});
copy(cwd, cwd + "/.c9/.build", {
exclude: function(name, parent) {
if (excludeRe.test(name))
return true;
var fullPath = parent.substr(cwd.length) + "/" + name;
if (excludeMap[fullPath])
return true;
return false;
}
});
next();
},
updatePackageJSON,
function(next) {
zip();
}
]);
}
function zip(ignore){
function zip(){
zipFilePath = join(os.tmpDir(), json.name + "@" + json.version) + ".tar.gz";
var tarArgs = ["-zcvf", normalizePath(zipFilePath), "."];
var tarArgs = ["-zcvf", normalizePath(zipFilePath)];
var c9ignore = normalizePath(process.env.HOME + "/.c9/.c9ignore");
fs.exists(c9ignore, function (exists) {
if (exists) {
tarArgs.push("--exclude-from=" + c9ignore);
}
ignore.forEach(function(p) {
p = Path.relative(cwd, p);
if (!/^\.+\//.test(p)) {
tarArgs.push("--exclude=./" + normalizePath(p));
}
});
tarArgs.push("--transform='flags=r;s|__packed__|__installed__|'");
// console.log(tarArgs)
tarArgs.push(".");
proc.spawn(TAR, {
args: tarArgs,
cwd: cwd
cwd: cwd + "/.c9/.build"
}, function(err, p){
if (err) return callback(err);
@ -840,7 +851,7 @@ define(function(require, exports, module) {
return callback(new Error("ERROR: Failed to update existing package - "
+ stringifyError(err)));
if (verbose)
console.log("Successfully updated existing package");
console.log("Successfully updated metadata of existing package");
next(pkg);
});
@ -875,15 +886,47 @@ define(function(require, exports, module) {
form.pipe(request);
request.on('response', function(res) {
// TODO better handle version exists error
if (res.statusCode == 412 && !version)
console.error("ERROR: most likely version " + json.version + " already exisits, try increasing version");
if (res.statusCode != 200)
return callback(new Error("ERROR: Unknown Error:" + res.statusCode));
// Create Version Complete
callback(null, json);
commitAndPush();
});
}
});
}
function commitAndPush() {
// Create Version Complete
if (!createTag)
callback(null, json);
proc.spawn("bash", {
args: ["-c", SHELLSCRIPT, "--", json.version, normalizePath(packagePath)]
}, function(err, p){
if (err) return callback(err);
if (verbose) {
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);
});
});
}
});
}
@ -1192,7 +1235,7 @@ define(function(require, exports, module) {
force = false;
});
/***** Register and define API *****/
/***** Register and definfe API *****/
/**
*

Wyświetl plik

@ -0,0 +1,26 @@
/**
* Dummy implementation of experiments.
*/
"use strict";
plugin.consumes = [];
plugin.provides = ["experiment"];
module.exports = plugin;
function plugin(options, imports, register) {
register(null, {
"experiment": {
configure: function() {},
onStart: function() {
var chain = {
variation: function() {
return chain;
}
};
return chain;
}
}
});
}

Wyświetl plik

@ -81,7 +81,12 @@ function main(options, imports, register) {
"main": "msgpack.js"
}]
}]);
statics.addStatics([{
path: dirname(require.resolve("architect-build/build_support/mini_require")),
mount: "/"
}]);
}
/***** Lifecycle *****/

Wyświetl plik

@ -34,11 +34,6 @@ function plugin(options, imports, register) {
mount: "/"
}]);
statics.addStatics([{
path: __dirname + "/../../node_modules/architect-build/build_support",
mount: "/"
}]);
statics.addStatics([{
path: __dirname + "/../../configs",
mount: "/configs"

Wyświetl plik

@ -155,6 +155,9 @@ require([
prefs.add = function(){};
return prefs;
})(),
analytics: {
addTrait: function() {}
},
commands: (function(){
var commands = {};