mirror of
https://github.com/linuxserver/core.git
synced 2026-02-20 05:07:19 +08:00
Merge remote-tracking branch 'origin/master' into fix/clone-newclient
This commit is contained in:
commit
e970517228
@ -39,7 +39,7 @@ To update the SDK to the latest version run:
|
||||
git pull origin master
|
||||
scripts/install-sdk.sh
|
||||
|
||||
Please note that Cloud9 v3 currently requires Node.js 0.12 or 0.10.
|
||||
Please note that Cloud9 v3 is currently developed with Node.js 0.12 and 0.10. Newer versions of node should work too.
|
||||
|
||||
#### Starting Cloud9 ####
|
||||
|
||||
|
||||
@ -748,7 +748,10 @@ module.exports = function(options) {
|
||||
});
|
||||
}
|
||||
if (!hosted) {
|
||||
plugins.push("plugins/c9.ide.analytics/mock_analytics");
|
||||
plugins.push(
|
||||
"plugins/c9.ide.analytics/mock_analytics",
|
||||
"plugins/c9.ide.services/linked-services-mock"
|
||||
);
|
||||
}
|
||||
|
||||
// Collab
|
||||
|
||||
2
node_modules/c9/urls_test.js
generated
vendored
2
node_modules/c9/urls_test.js
generated
vendored
@ -6,7 +6,7 @@
|
||||
require("c9/inline-mocha")(module);
|
||||
if (typeof define === "undefined") {
|
||||
require("amd-loader");
|
||||
require("../../test/setup_paths");
|
||||
require("./setup_paths");
|
||||
}
|
||||
|
||||
var assert = require("assert-diff");
|
||||
|
||||
33
node_modules/vfs-child/parent.js
generated
vendored
33
node_modules/vfs-child/parent.js
generated
vendored
@ -1,6 +1,7 @@
|
||||
var Consumer = require('vfs-socket/consumer').Consumer;
|
||||
var inherits = require('util').inherits;
|
||||
var spawn = require('child_process').spawn;
|
||||
var fs = require("fs");
|
||||
|
||||
exports.Parent = Parent;
|
||||
|
||||
@ -23,30 +24,36 @@ function Parent(fsOptions) {
|
||||
// Override Consumer's connect since the transport logic is internal to this module
|
||||
this.connect = connect.bind(this);
|
||||
function connect(callback) {
|
||||
var _self = this;
|
||||
try {
|
||||
if (!fs.existsSync(nodeBin[0]))
|
||||
return tryNext(new Error("Couldn't find valid node binary"));
|
||||
child = spawn(nodeBin[0], args, options).on("error", tryNext);
|
||||
}
|
||||
catch (e) {
|
||||
return tryNext(e);
|
||||
return done(e);
|
||||
}
|
||||
child.stdin.readable = true;
|
||||
Consumer.prototype.connect.call(this, [child.stdout, child.stdin], tryNext);
|
||||
Consumer.prototype.connect.call(this, [child.stdout, child.stdin], done);
|
||||
child.on("exit", disconnect);
|
||||
child.stdin.resume();
|
||||
var _self = this;
|
||||
// try all possible locations of node before giving up
|
||||
function tryNext(err, vfs) {
|
||||
if (!child) return;
|
||||
child.removeListener("error", tryNext);
|
||||
child.on("error", function ignore() {});
|
||||
if (err && err.code == "ENOENT" && nodeBin.length > 1) {
|
||||
child = null;
|
||||
|
||||
function tryNext(err) {
|
||||
if (nodeBin.length > 1) {
|
||||
nodeBin.shift();
|
||||
_self.emit("error", err);
|
||||
_self.connect(callback);
|
||||
} else {
|
||||
callback(err, vfs);
|
||||
}
|
||||
} else {
|
||||
return done(err);
|
||||
}
|
||||
}
|
||||
|
||||
function done(err, vfs) {
|
||||
if (!callback) return;
|
||||
child.removeListener("error", done);
|
||||
child.on("error", function ignore(err) {});
|
||||
callback(err, vfs);
|
||||
callback = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
264
node_modules/vfs-local/localfs.js
generated
vendored
264
node_modules/vfs-local/localfs.js
generated
vendored
@ -350,7 +350,7 @@ module.exports = function setup(fsOptions) {
|
||||
|
||||
// This helper function doesn't follow node conventions in the callback,
|
||||
// there is no err, only entry.
|
||||
function createStatEntry(file, fullpath, callback) {
|
||||
function createStatEntry(file, fullpath, callback, _loop) {
|
||||
fs.lstat(fullpath, function (err, stat) {
|
||||
var entry = {
|
||||
name: file
|
||||
@ -378,26 +378,29 @@ module.exports = function setup(fsOptions) {
|
||||
return callback(entry);
|
||||
}
|
||||
fs.readlink(fullpath, function (err, link) {
|
||||
if (entry.name == link) {
|
||||
entry.linkStatErr = "ELOOP: recursive symlink";
|
||||
return callback(entry);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
entry.linkErr = err.stack;
|
||||
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;
|
||||
resolvePath(pathResolve(dirname(fullpath), link), {alreadyRooted: true}, function (err, newpath) {
|
||||
if (err) {
|
||||
entry.linkStatErr = err;
|
||||
return callback(entry);
|
||||
}
|
||||
createStatEntry(basename(newpath), newpath, function (linkStat) {
|
||||
entry.linkStat = linkStat;
|
||||
linkStat.fullPath = newpath.substr(base.length) || "/";
|
||||
return callback(entry);
|
||||
});
|
||||
resolvePath(fullLinkPath, {alreadyRooted: true}, function (err, newpath) {
|
||||
if (err) {
|
||||
entry.linkErr = err;
|
||||
return callback(entry);
|
||||
}
|
||||
createStatEntry(basename(newpath), newpath, function (linkStat) {
|
||||
entry.linkStat = linkStat;
|
||||
linkStat.fullPath = newpath.substr(base.length) || "/";
|
||||
return callback(entry);
|
||||
}, _loop);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -1445,17 +1448,8 @@ module.exports = function setup(fsOptions) {
|
||||
|
||||
function spawn(executablePath, options, callback) {
|
||||
var args = options.args || [];
|
||||
|
||||
if (options.hasOwnProperty('env')) {
|
||||
options.env.__proto__ = fsOptions.defaultEnv;
|
||||
} else {
|
||||
options.env = fsOptions.defaultEnv;
|
||||
}
|
||||
if (options.cwd && options.cwd.charAt(0) == "~")
|
||||
options.cwd = options.env.HOME + options.cwd.substr(1);
|
||||
|
||||
if (transformPath && options.cwd)
|
||||
options.cwd = transformPath(options.cwd);
|
||||
_setDefaultEnv(options);
|
||||
|
||||
resolvePath(executablePath, {
|
||||
nocheck : 1,
|
||||
@ -1492,25 +1486,8 @@ module.exports = function setup(fsOptions) {
|
||||
var args = options.args || [];
|
||||
delete options.args;
|
||||
|
||||
if (options.hasOwnProperty('env')) {
|
||||
options.env.__proto__ = fsOptions.defaultEnv;
|
||||
} else {
|
||||
options.env = fsOptions.defaultEnv;
|
||||
}
|
||||
|
||||
// Pty is only reading from the object itself;
|
||||
var env = {};
|
||||
for (var prop in options.env) {
|
||||
if (prop == "TMUX") continue;
|
||||
env[prop] = options.env[prop];
|
||||
}
|
||||
options.env = env;
|
||||
|
||||
if (options.cwd && options.cwd.charAt(0) == "~")
|
||||
options.cwd = env.HOME + options.cwd.substr(1);
|
||||
|
||||
if (transformPath && options.cwd)
|
||||
options.cwd = transformPath(options.cwd);
|
||||
_setDefaultEnv(options);
|
||||
delete options.env.TMUX;
|
||||
|
||||
if (options.testing) {
|
||||
args.forEach(function(arg, i){
|
||||
@ -1602,36 +1579,29 @@ module.exports = function setup(fsOptions) {
|
||||
* @param {Boolean} [options.base] The base path to store the watch files
|
||||
*/
|
||||
function tmuxspawn(ignored, options, callback) {
|
||||
var watchFile = join(options.base || "", ".run_" + options.session + ".watch");
|
||||
if (watchFile.charAt(0) == "~")
|
||||
watchFile = join(process.env.HOME, watchFile.substr(1));
|
||||
|
||||
var tmuxName = options.tmuxName || TMUXNAME;
|
||||
var session = options.session;
|
||||
|
||||
function fetchPid(callback, retries){
|
||||
if (!retries) retries = 0;
|
||||
// use axww to get full command
|
||||
_execFile("ps", ["ax", "-ww", "-opid,command"], {
|
||||
_execFile(TMUX, [
|
||||
"-u2", "-L", tmuxName, "-C",
|
||||
"list-panes", "-F", "c9-pid-#{pane_pid}-#{pane_dead}-#{pane_status}",
|
||||
"-t", session
|
||||
], {
|
||||
maxBuffer: 1000 * 1024
|
||||
}, function(err, stdout){
|
||||
var matches = (stdout || "").split("\n").filter(function(line) {
|
||||
return line.indexOf(watchFile) > -1
|
||||
&& !/\-L cloud9[\d\.]+ new/.test(line)
|
||||
&& line.indexOf("2> /dev/null") === -1;
|
||||
});
|
||||
var matches = /c9-pid-(\d+)-(\d)-/.exec(stdout);
|
||||
var isDead = parseInt(matches && matches[2], 10);
|
||||
var pid = isDead ? 0 : parseInt(matches && matches[1], 10);
|
||||
|
||||
// logToFile(options.session + ":" + JSON.stringify(matches));
|
||||
|
||||
if (!matches.length && retries < 10) {
|
||||
// logToFile(options.session + ": RETRY MATCH");
|
||||
if (!pid && !isDead && retries < 10) {
|
||||
setTimeout(fetchPid.bind(null, callback, ++retries), 30);
|
||||
return;
|
||||
}
|
||||
|
||||
callback(err, {
|
||||
pid: matches && matches.length
|
||||
? parseInt(matches[0].trim(), 10)
|
||||
: -1
|
||||
pid: pid || -1
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -1767,7 +1737,7 @@ module.exports = function setup(fsOptions) {
|
||||
// logToFile("Kill: " + options.session);
|
||||
|
||||
_execFile(TMUX,
|
||||
["-L", tmuxName, "kill-session", "-t", options.session],
|
||||
["-L", tmuxName, "-C", "kill-session", "-t", options.session],
|
||||
function(err){
|
||||
if (!options.command)
|
||||
return callback(err, {});
|
||||
@ -1825,9 +1795,6 @@ module.exports = function setup(fsOptions) {
|
||||
|
||||
args = ["-u2", "-L", tmuxName, "new", "-s", options.session];
|
||||
|
||||
if (options.idle)
|
||||
options.command = "echo '[Idle]'";
|
||||
|
||||
if (options.terminal) {
|
||||
args.push("export ISOUTPUTPANE=0;"
|
||||
+ (options.defaultEditor
|
||||
@ -1835,41 +1802,46 @@ module.exports = function setup(fsOptions) {
|
||||
: "")
|
||||
+ BASH + " -l");
|
||||
}
|
||||
|
||||
else if (options.command)
|
||||
args.push((BASH + " -l -c '"
|
||||
+ options.command.replace(/'/g, "'\\''") + "'")
|
||||
+ "; ([ -e '" + watchFile + "' ] && "
|
||||
+ "rm '" + watchFile + "')");
|
||||
else if (options.idle) {
|
||||
args.push(BASH + " -l -c 'printf \"\\e[01;34m[Idle]\\e[0m\\n\""
|
||||
+ "; sleep 0.1;'");
|
||||
}
|
||||
else if (options.command) {
|
||||
args.push(BASH + " -l -c '"
|
||||
+ options.command.replace(/'/g, "'\\''")
|
||||
+ '; printf "\\e[01;30m\\n\\nProcess exited with code: $?\\e[0m\\n"'
|
||||
+ "; sleep 0.1;'");
|
||||
}
|
||||
|
||||
args.push(
|
||||
";", "set-option", "-g", "status", "off",
|
||||
";", "set-option", "destroy-unattached", "off",
|
||||
";", "set-option", "mouse-select-pane", "on",
|
||||
";", "set-option", "set-titles", "on",
|
||||
";", "set-option", "quiet", "off",
|
||||
";", "set-option", "-g", "prefix", "C-b",
|
||||
";", "set-option", "-g", "terminal-overrides", "'xterm:colors=256'"
|
||||
";", "set", "-q", "-g", "status", "off",
|
||||
";", "set", "-q", "destroy-unattached", "off",
|
||||
";", "set", "-q", "mouse-select-pane", "on",
|
||||
";", "set", "-q", "set-titles", "on",
|
||||
";", "set", "-q", "quiet", "on",
|
||||
";", "set", "-q", "-g", "prefix", "C-b",
|
||||
";", "set", "-q", "-g", "terminal-overrides", "'xterm:colors=256'"
|
||||
);
|
||||
|
||||
// disable buffering of tmux output
|
||||
// TODO investigate if using capture pane after desync is faster
|
||||
args.push(";", "set-window-option", "c0-change-trigger", "0");
|
||||
args.push(";", "setw", "c0-change-trigger", "0");
|
||||
|
||||
if (options.output) {
|
||||
args.push(
|
||||
";", "set-option", "remain-on-exit", "on",
|
||||
";", "set-window-option", "-g", "aggressive-resize", "on"
|
||||
";", "set", "-q", "remain-on-exit", "on",
|
||||
";", "setw", "-q", "-g", "aggressive-resize", "on"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (options.detach && options.output) {
|
||||
args.unshift("-C");
|
||||
args.push(";", "list-panes", "-F", "c9-pid#{pane_pid}-");
|
||||
}
|
||||
if (options.detach)
|
||||
args.push(";", "detach");
|
||||
|
||||
var quotedArgs = args.map(function(arg) {
|
||||
return "'" + arg.replace(/'/g, "'\\''") + "'";
|
||||
}).join(" ");
|
||||
|
||||
options.env["LD_LIBRARY_PATH"] = (options.env["LD_LIBRARY_PATH"]
|
||||
? options.env["LD_LIBRARY_PATH"] + ":" : "") + "~/.c9/local/lib";
|
||||
|
||||
@ -1877,31 +1849,30 @@ module.exports = function setup(fsOptions) {
|
||||
options.env["ISOUTPUTPANE"] = "1";
|
||||
}
|
||||
|
||||
if (options.command && !attach && !options.terminal) {
|
||||
fs.writeFile(watchFile, "-1", "utf8", function(err){
|
||||
if (err) {
|
||||
fs.mkdir(dirname(watchFile), function(err){
|
||||
if (err) return callback(err);
|
||||
fs.writeFile(watchFile, "-1", "utf8", run);
|
||||
});
|
||||
}
|
||||
else run();
|
||||
});
|
||||
}
|
||||
else
|
||||
run();
|
||||
|
||||
run();
|
||||
|
||||
function run(err){
|
||||
if (err) return callback(err);
|
||||
|
||||
// Start PTY with TMUX, in a login shell (when not attached)
|
||||
var EXEC = attach ? TMUX : BASH;
|
||||
var ARGS = attach
|
||||
? args
|
||||
: [ "-l", "-c", "'" + TMUX + "' " + quotedArgs + " 2> /dev/null"];
|
||||
if (options.detach && options.output) {
|
||||
_setDefaultEnv(options);
|
||||
delete options.env.TMUX;
|
||||
|
||||
return _execFile(TMUX, args, {
|
||||
args: args,
|
||||
name: options.name,
|
||||
cwd: options.cwd,
|
||||
resolve: options.resolve,
|
||||
env: options.env
|
||||
}, function(err, stdout) {
|
||||
var m = /c9-pid(\d+)-/.exec(stdout);
|
||||
var pid = parseInt(m && m[1], 10);
|
||||
callback(err, {pid: pid});
|
||||
});
|
||||
}
|
||||
|
||||
ptyspawn(EXEC, {
|
||||
args: ARGS,
|
||||
ptyspawn(TMUX, {
|
||||
args: args,
|
||||
name: options.name,
|
||||
cols: options.cols,
|
||||
rows: options.rows,
|
||||
@ -1923,26 +1894,10 @@ module.exports = function setup(fsOptions) {
|
||||
err.code = "EPERM";
|
||||
meta.pty.emit("data", err);
|
||||
}
|
||||
|
||||
else if (data) {
|
||||
// Fetch the PID if appropriate
|
||||
if (options.detach && options.output) {
|
||||
fetchPid(function(err, pid){
|
||||
if (err) return callback(err);
|
||||
meta.pid = pid.pid;
|
||||
callback(null, meta);
|
||||
});
|
||||
|
||||
if (process.platform != "win32")
|
||||
meta.pty.kill();
|
||||
}
|
||||
|
||||
meta.pty.removeListener("data", wait);
|
||||
}
|
||||
});
|
||||
|
||||
if (options.detach && options.output)
|
||||
return;
|
||||
}
|
||||
|
||||
// Return the pty
|
||||
@ -2078,7 +2033,6 @@ module.exports = function setup(fsOptions) {
|
||||
// Same as tmuxspawn but than spawns bash or other shell, for windows
|
||||
var sessions = {};
|
||||
function bashspawn(ignored, options, callback) {
|
||||
var watchFile = join(options.base || "", ".run_" + options.session + ".watch");
|
||||
var session;
|
||||
|
||||
function getSessionId(){
|
||||
@ -2089,7 +2043,9 @@ module.exports = function setup(fsOptions) {
|
||||
// Fetch PID of a running process and return it
|
||||
if (options.fetchpid) {
|
||||
session = sessions[options.session];
|
||||
callback(null, { pid: session && session.pty ? session.pty.pid : -1 });
|
||||
setTimeout(function() {
|
||||
callback(null, { pid: session && session.pty ? session.pty.pid : -1 });
|
||||
}, 100); // workaround for late exit message from winpty
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2143,29 +2099,21 @@ module.exports = function setup(fsOptions) {
|
||||
sessions[name] = session;
|
||||
if (!session.wait) session.wait = [];
|
||||
|
||||
if (options.idle)
|
||||
options.command = "echo '\033[2J\033[1;1H[Idle]'";
|
||||
else if (options.command)
|
||||
options.command = "echo '\033[2J\033[1;1H';" + options.command;
|
||||
if (options.idle) {
|
||||
options.command = "echo '\033[2J\033[1;1H\033[01;34m[Idle]\033[0m'";
|
||||
} else if (options.command) {
|
||||
options.command = "echo '\033[2J\033[1;1H';" + options.command
|
||||
+ ';printf "\033[01;30m\n\nProcess exited with code: $?\033[0m\n"';
|
||||
}
|
||||
|
||||
// \"`#" + name + "`\"
|
||||
if (options.command) {
|
||||
args.push("-c", "nodosfilewarning=1;" + options.command
|
||||
+ "; ([ -e '" + watchFile + "' ] && "
|
||||
+ "rm '" + watchFile + "')");
|
||||
args.push("-c", "nodosfilewarning=1;" + options.command);
|
||||
|
||||
var cmd = args[args.length - 1];
|
||||
args[args.length - 1] = '"' + cmd.replace(/"/g, '\\"') + '"';
|
||||
}
|
||||
|
||||
if (options.output) {
|
||||
var path = watchFile[0] == "~"
|
||||
? join(process.env.HOME, watchFile.substr(1))
|
||||
: watchFile;
|
||||
fs.writeFile(path, "-1", "utf8", run);
|
||||
}
|
||||
else
|
||||
run();
|
||||
run();
|
||||
|
||||
function run(err){
|
||||
if (err) return callback(err);
|
||||
@ -2220,16 +2168,8 @@ module.exports = function setup(fsOptions) {
|
||||
function execFile(executablePath, options, callback) {
|
||||
if (isWin && execFileWin(executablePath, options, callback))
|
||||
return;
|
||||
if (options.hasOwnProperty('env')) {
|
||||
options.env.__proto__ = fsOptions.defaultEnv;
|
||||
} else {
|
||||
options.env = fsOptions.defaultEnv;
|
||||
}
|
||||
if (options.cwd && options.cwd.charAt(0) == "~")
|
||||
options.cwd = options.env.HOME + options.cwd.substr(1);
|
||||
|
||||
if (transformPath && options.cwd)
|
||||
options.cwd = transformPath(options.cwd);
|
||||
_setDefaultEnv(options);
|
||||
|
||||
resolvePath(executablePath, {
|
||||
nocheck : 1,
|
||||
@ -2256,10 +2196,9 @@ module.exports = function setup(fsOptions) {
|
||||
function execFileWin(executablePath, options, callback) {
|
||||
if (executablePath == "kill") {
|
||||
var pid = options.args && options.args[0];
|
||||
console.error(pid, sessions)
|
||||
|
||||
Object.keys(sessions).some(function(key) {
|
||||
if (sessions[key].pid == pid && sessions[key].pty) {
|
||||
console.error(sessions[key].pty.pid)
|
||||
sessions[key].pty.killtree(-1);
|
||||
return true;
|
||||
}
|
||||
@ -2268,6 +2207,25 @@ module.exports = function setup(fsOptions) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function _setDefaultEnv(options) {
|
||||
if (options.hasOwnProperty("env"))
|
||||
options.env.__proto__ = fsOptions.defaultEnv;
|
||||
else
|
||||
options.env = fsOptions.defaultEnv;
|
||||
|
||||
// Pty is only reading from the object itself;
|
||||
var env = {};
|
||||
for (var prop in options.env)
|
||||
env[prop] = options.env[prop];
|
||||
options.env = env;
|
||||
|
||||
if (options.cwd && options.cwd.charAt(0) == "~")
|
||||
options.cwd = options.env.HOME + options.cwd.substr(1);
|
||||
|
||||
if (transformPath && options.cwd)
|
||||
options.cwd = transformPath(options.cwd);
|
||||
}
|
||||
|
||||
function killtree(pid, options, callback) {
|
||||
var code = options.code || options.graceful ? "SIGTERM" : "SIGKILL";
|
||||
|
||||
11
node_modules/vfs-socket/consumer.js
generated
vendored
11
node_modules/vfs-socket/consumer.js
generated
vendored
@ -273,15 +273,18 @@ function Consumer() {
|
||||
function onExit(pid, code, signal) {
|
||||
var process = proxyProcesses[pid];
|
||||
if (!process) return;
|
||||
// TODO: not delete proxy if close is going to be called later.
|
||||
// but somehow do delete proxy if close won't be called later.
|
||||
delete proxyProcesses[pid];
|
||||
// TODO: how can we confirm that both close and exit are always called
|
||||
if (process.closed)
|
||||
delete proxyProcesses[pid];
|
||||
process.exited = true;
|
||||
process.emit("exit", code, signal);
|
||||
}
|
||||
function onProcessClose(pid) {
|
||||
var process = proxyProcesses[pid];
|
||||
if (!process) return;
|
||||
delete proxyProcesses[pid];
|
||||
if (process.exited)
|
||||
delete proxyProcesses[pid];
|
||||
process.closed = true;
|
||||
process.emit("close");
|
||||
}
|
||||
function onPtyKill(pid){
|
||||
|
||||
14
package.json
14
package.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "c9",
|
||||
"description": "New Cloud9 Client",
|
||||
"version": "3.1.190",
|
||||
"version": "3.1.222",
|
||||
"author": "Ajax.org B.V. <info@ajax.org>",
|
||||
"private": true,
|
||||
"main": "bin/c9",
|
||||
@ -71,7 +71,7 @@
|
||||
"c9.ide.find": "#35379124ca",
|
||||
"c9.ide.find.infiles": "#c132ad243c",
|
||||
"c9.ide.find.replace": "#44772dd796",
|
||||
"c9.ide.run.debug": "#3b76105b4e",
|
||||
"c9.ide.run.debug": "#1415524d85",
|
||||
"c9.automate": "#47e2c429c9",
|
||||
"c9.ide.ace.emmet": "#6dc4585e02",
|
||||
"c9.ide.ace.gotoline": "#a8ff07c8f4",
|
||||
@ -94,7 +94,7 @@
|
||||
"c9.ide.navigate": "#c191d9b92f",
|
||||
"c9.ide.newresource": "#981a408a7b",
|
||||
"c9.ide.openfiles": "#7fa4a97fed",
|
||||
"c9.ide.preview": "#c530a7978d",
|
||||
"c9.ide.preview": "#b6d2dfe356",
|
||||
"c9.ide.preview.browser": "#c50007ebbc",
|
||||
"c9.ide.preview.markdown": "#ab8d30ad9f",
|
||||
"c9.ide.pubsub": "#a85fb27eca",
|
||||
@ -102,14 +102,14 @@
|
||||
"c9.ide.recentfiles": "#7c099abf40",
|
||||
"c9.ide.remote": "#301d2ab519",
|
||||
"c9.ide.processlist": "#2b12cd1bdd",
|
||||
"c9.ide.run": "#f360984649",
|
||||
"c9.ide.run": "#f9b7d60b96",
|
||||
"c9.ide.run.build": "#0598fff697",
|
||||
"c9.ide.run.debug.xdebug": "#61dcbd0180",
|
||||
"c9.ide.save": "#4a4a60a004",
|
||||
"c9.ide.scm": "#aabd0d181e",
|
||||
"c9.ide.scm": "#7b0c0714b4",
|
||||
"c9.ide.terminal.monitor": "#b76f1c9f24",
|
||||
"c9.ide.test": "#26cd260224",
|
||||
"c9.ide.test.mocha": "#f6cc482886",
|
||||
"c9.ide.test": "#ebc037901c",
|
||||
"c9.ide.test.mocha": "#586fb0cdc2",
|
||||
"c9.ide.theme.flat": "#2de8414db7",
|
||||
"c9.ide.threewaymerge": "#229382aa0b",
|
||||
"c9.ide.undo": "#b028bcb4d5",
|
||||
|
||||
@ -561,8 +561,8 @@ define(function(require, exports, module) {
|
||||
node.size = stat.size;
|
||||
if (stat.mtime != undefined)
|
||||
node.mtime = stat.mtime;
|
||||
if (original_stat)
|
||||
node.link = stat.fullPath;
|
||||
if (original_stat || stat.linkErr)
|
||||
node.link = stat.fullPath || stat.linkErr;
|
||||
node.isFolder = isFolder;
|
||||
}
|
||||
|
||||
|
||||
@ -23,39 +23,17 @@ define(function(require, exports, module) {
|
||||
|
||||
function main(options, imports, register) {
|
||||
var Plugin = imports.Plugin;
|
||||
var showError = imports["dialog.error"].show;
|
||||
|
||||
/***** Initialization *****/
|
||||
|
||||
var plugin = new Plugin("Ajax.org", main.consumes);
|
||||
|
||||
var requested, nativeObject;
|
||||
var nativeObject;
|
||||
|
||||
var loaded = false;
|
||||
function load(){
|
||||
if (loaded) return false;
|
||||
loaded = true;
|
||||
|
||||
// Chrome Specific
|
||||
if (window.chrome && window.chrome.permissions) {
|
||||
var chrome = window.chrome;
|
||||
var permissions = {
|
||||
permissions: ["clipboardRead", "clipboardWrite"],
|
||||
origins: [location.origin]
|
||||
};
|
||||
|
||||
chrome.permissions.contains(permissions, function(allowed) {
|
||||
if (!allowed) {
|
||||
chrome.permissions.request(permissions, function(result) {
|
||||
if (result) {
|
||||
showError("The browser has granted copy "
|
||||
+ "and paste permissions. Restart the "
|
||||
+ "browser to enable these permissions");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/***** Methods *****/
|
||||
@ -94,10 +72,7 @@ define(function(require, exports, module) {
|
||||
};
|
||||
document.addEventListener("copy", setData, true);
|
||||
|
||||
// @todo test if this is sync
|
||||
requested = true;
|
||||
var result = execCommand("copy");
|
||||
requested = false;
|
||||
|
||||
document.removeEventListener("copy", setData, true);
|
||||
|
||||
@ -123,10 +98,7 @@ define(function(require, exports, module) {
|
||||
};
|
||||
document.addEventListener("paste", getData, true);
|
||||
|
||||
// @todo test if this is sync
|
||||
requested = true;
|
||||
var result = execCommand("paste");
|
||||
requested = false;
|
||||
|
||||
document.removeEventListener("paste", getData, true);
|
||||
|
||||
@ -173,6 +145,7 @@ define(function(require, exports, module) {
|
||||
});
|
||||
plugin.on("unload", function(){
|
||||
loaded = false;
|
||||
nativeObject = null;
|
||||
});
|
||||
|
||||
/***** Register and define API *****/
|
||||
|
||||
59
plugins/c9.ide.services/linked-services-mock.js
Normal file
59
plugins/c9.ide.services/linked-services-mock.js
Normal file
@ -0,0 +1,59 @@
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
main.consumes = ["Plugin"];
|
||||
main.provides = ["linked-services"];
|
||||
return main;
|
||||
|
||||
function main(options, imports, register) {
|
||||
var Plugin = imports.Plugin;
|
||||
var plugin = new Plugin("Ajax.org", main.consumes);
|
||||
|
||||
function getServices(callback) {
|
||||
setTimeout(function() {
|
||||
callback(null, options.services || {
|
||||
"github": {
|
||||
"visible": true,
|
||||
"hasRepositories": true,
|
||||
"service": "github",
|
||||
"title": "GitHub",
|
||||
"accounts": [],
|
||||
"maxAccounts": 1,
|
||||
"maxProjects": 100
|
||||
},
|
||||
"mbed": {
|
||||
"visible": false,
|
||||
"hasRepositories": false,
|
||||
"service": "mbed",
|
||||
"title": "Mbed",
|
||||
"accounts": [{
|
||||
"id": "mbed:154229",
|
||||
"login": "fjakobs",
|
||||
"metadata": {},
|
||||
"projects": []
|
||||
}],
|
||||
"maxAccounts": 1,
|
||||
"maxProjects": 100
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function getAccessToken(serviceId, callback) {
|
||||
callback(new Error("Not Implemented"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides client-side Salesforce API access
|
||||
* @singleton
|
||||
**/
|
||||
plugin.freezePublicAPI({
|
||||
getServices: getServices,
|
||||
getAccessToken: getAccessToken
|
||||
});
|
||||
|
||||
register(null, {
|
||||
"linked-services": plugin
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -100,12 +100,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse
|
||||
return tab.pane.aml.getPage("editor::" + tab.editorType).$ext;
|
||||
});
|
||||
|
||||
predictor.on("mispredict", function(e) {
|
||||
console.error("MISPREDICTED", e)
|
||||
delete e.session;
|
||||
throw new Error("MISPREDICTED: " + JSON.stringify(e));
|
||||
});
|
||||
|
||||
describe('terminal.predict_echo', function() {
|
||||
this.timeout(30000);
|
||||
|
||||
@ -140,18 +134,28 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse
|
||||
session = editor.ace.getSession().c9session;
|
||||
send = session.send;
|
||||
|
||||
if (peek(-2) === "$") // maybe there already was a prompt
|
||||
return init();
|
||||
afterPrompt(function() { setTimeout(init); });
|
||||
setTimeout(init);
|
||||
|
||||
function init() {
|
||||
afterPrompt(function() { setTimeout(start); });
|
||||
// Make sure we have a prompt with a dollar for tests
|
||||
afterPrompt(function() { done() });
|
||||
editor.ace.onTextInput("PS1='. $ '\n");
|
||||
//editor.ace.onTextInput("ssh lennart\n");
|
||||
//editor.ace.onTextInput("ssh ubuntu@ci.c9.io\n");
|
||||
// And terminal won't send rename commands in the middle of the test
|
||||
// TODO: do we need to handle rename sequence in predict_echo instead?
|
||||
editor.ace.onTextInput("PS1='. $ ';"
|
||||
+ "tmux setw automatic-rename off;"
|
||||
+ "printf '\\x1b]0;predict echo\\x07'\n");
|
||||
// editor.ace.onTextInput("ssh lennart\n");
|
||||
// editor.ace.onTextInput("ssh ubuntu@ci.c9.io\n");
|
||||
}
|
||||
});
|
||||
function start() {
|
||||
predictor.on("mispredict", function(e) {
|
||||
console.error("MISPREDICTED", e)
|
||||
delete e.session;
|
||||
throw new Error("MISPREDICTED: " + JSON.stringify(e));
|
||||
});
|
||||
setTimeout(done)
|
||||
}
|
||||
}
|
||||
|
||||
function peek(offset) {
|
||||
@ -528,7 +532,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse
|
||||
afterPredict(":", function() {
|
||||
afterPrompt(done);
|
||||
send("\r");
|
||||
})
|
||||
});
|
||||
sendAll("echo".split(""), function() {
|
||||
send(INPUT_BACKSPACE);
|
||||
send(INPUT_BACKSPACE);
|
||||
|
||||
@ -668,6 +668,7 @@ define(function(require, exports, module) {
|
||||
var queue = "";
|
||||
var warned = false;
|
||||
var timer = null;
|
||||
var initialConnect = true;
|
||||
|
||||
function send(data) {
|
||||
if (!(c9.status & c9.NETWORK))
|
||||
@ -680,7 +681,7 @@ define(function(require, exports, module) {
|
||||
timer = setTimeout(function() {
|
||||
timer = null;
|
||||
if (!session.connected)
|
||||
return warnConnection();
|
||||
return initialConnect || warnConnection();
|
||||
// Send data to stdin of tmux process
|
||||
session.pty.write(queue);
|
||||
queue = "";
|
||||
@ -746,6 +747,11 @@ define(function(require, exports, module) {
|
||||
tab: session.tab
|
||||
});
|
||||
loadHistory(session);
|
||||
initialConnect = false;
|
||||
if (queue) {
|
||||
session.pty.write(queue);
|
||||
queue = "";
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -77,13 +77,18 @@ module.exports = function(c9, proc, installPath, shell) {
|
||||
meta.process.stderr.on("data", function(data) {
|
||||
errBuffer += data.toString();
|
||||
});
|
||||
meta.process.on("exit", function() {
|
||||
meta.process.on("close", function() {
|
||||
if (!buffer && !errBuffer && options.retries < 4) {
|
||||
// tmux doesn't produce any output if two instances are invoked at the same time
|
||||
return setTimeout(function() {
|
||||
getOutputHistory(options, cb);
|
||||
}, options.retries * 100 + 300);
|
||||
}
|
||||
if (buffer) {
|
||||
var i = buffer.search(/\x1b\[1mPane is dead\x1b\[0m\s*$/);
|
||||
if (i != -1)
|
||||
buffer = buffer.slice(0, i).replace(/\s*$/, "\n");
|
||||
}
|
||||
cb(errBuffer, buffer);
|
||||
});
|
||||
});
|
||||
|
||||
@ -1205,6 +1205,8 @@ apf.BaseTab = function(){
|
||||
node.$button.style.zIndex = 0;
|
||||
}
|
||||
|
||||
if (!(node.relPage || node).$ext) return onfinish();
|
||||
|
||||
if (pages.length == 1)
|
||||
(node.relPage || node).$ext.style.display = "none";
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@ function plugin(options, imports, register) {
|
||||
api.get("/test/all.json", function(req, res, next) {
|
||||
var base = __dirname + "/../../";
|
||||
var blacklistfile = base + "/test/blacklist.txt";
|
||||
var filefinder = require(base + "/test/filefinder.js");
|
||||
var filefinder = require(base + "/test/lib/filefinder.js");
|
||||
filefinder.find(base, "plugins", ".*_test.js", blacklistfile, function(err, result) {
|
||||
result.all = result.list.concat(result.blacklist);
|
||||
async.filterSeries(result.list, function(file, next) {
|
||||
|
||||
@ -45,7 +45,8 @@ function getDefaultSettings() {
|
||||
"prod": "deploy",
|
||||
"beta": "beta",
|
||||
"dev": "devel",
|
||||
"onlinedev": "onlinedev"
|
||||
"onlinedev": "onlinedev",
|
||||
"test": "test"
|
||||
};
|
||||
return modes[suffix] || "devel";
|
||||
}
|
||||
|
||||
@ -1,166 +0,0 @@
|
||||
/*
|
||||
filefinder - find files matching a specific file name pattern that are not found on a specified blacklist
|
||||
|
||||
=example=
|
||||
ff.find("/tmp", "files", ".*_test.js", "/tmp/blacklist", function(err, res) {
|
||||
console.log(util.inspect(res));
|
||||
});
|
||||
|
||||
--dirlist--
|
||||
one_test.js
|
||||
two_test.js
|
||||
three.js
|
||||
four_test.js
|
||||
|
||||
--blacklist--
|
||||
one_test.js
|
||||
files/two_test.js
|
||||
four
|
||||
|
||||
--result--
|
||||
{ countOk: 2,
|
||||
countPatternMis: 1,
|
||||
countBl: 1,
|
||||
list: [ 'files/four_test.js', 'files/one_test.js' ] }
|
||||
|
||||
*/
|
||||
|
||||
var fs = require("fs");
|
||||
var util = require("util");
|
||||
var path = require("path");
|
||||
|
||||
|
||||
var DEBUGMODE = false;
|
||||
|
||||
|
||||
|
||||
function filefinder(basedir, subdir, fnpattern, blacklistfile, cb) {
|
||||
if (DEBUGMODE) console.log("\n\n\n\nfilefinder()");
|
||||
if (cb) cb();
|
||||
}
|
||||
|
||||
filefinder.prototype.find = function(basedir, subdir, fnpattern, blacklistfile, cb) {
|
||||
if (DEBUGMODE) console.log("\n\n\n\nfind(%s, %s, %s)", path.join(basedir, subdir), fnpattern, blacklistfile);
|
||||
this.basedir = basedir;
|
||||
this.subdir = subdir;
|
||||
this.pattern = fnpattern;
|
||||
this.blacklistfile = blacklistfile;
|
||||
|
||||
this.flist = [];
|
||||
this.countBlacklisted = 0;
|
||||
this.countPatternMis = 0;
|
||||
var _self = this;
|
||||
|
||||
_self.getBlacklist(this.blacklistfile, function(err, blacklist) {
|
||||
_self.treewalk(basedir, subdir, fnpattern, blacklist, _self.flist, function(err, res) {
|
||||
// compose results object
|
||||
var result = {
|
||||
countOk: _self.flist.length,
|
||||
countPatternMis: _self.countPatternMis,
|
||||
countBl: _self.countBlacklisted,
|
||||
list: _self.flist,
|
||||
blacklist: blacklist
|
||||
};
|
||||
cb(null, result);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
filefinder.prototype.getBlacklist = function(filename, cb) {
|
||||
if (DEBUGMODE) console.log("getBlacklist()");
|
||||
var _self = this;
|
||||
_self.getFileInArray(filename, function(err, blacklist) {
|
||||
if (err) return cb(new Error("error reading blacklist file"));
|
||||
_self.arrayRemoveCrap(blacklist, function(err, blacklist) {
|
||||
if (DEBUGMODE) console.log("--blacklist--\nlength: %s\n%s\n-------------", blacklist.length, util.inspect(blacklist));
|
||||
cb(null, blacklist);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// read a text file and make each line a member of an array
|
||||
filefinder.prototype.getFileInArray = function(filename, cb) {
|
||||
if (DEBUGMODE) console.log("getFileInArray()");
|
||||
var array = [];
|
||||
fs.exists(filename, function (exists) {
|
||||
if (!exists) return cb(null, array);
|
||||
fs.readFile(filename, function(err, data) {
|
||||
if(err) return cb(err);
|
||||
array = data.toString().split("\n");
|
||||
cb(null, array);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
filefinder.prototype.arrayRemoveCrap = function(array, cb) {
|
||||
if (DEBUGMODE) console.log("arrayRemoveCrap()");
|
||||
|
||||
function removeComments(element, index, array) {
|
||||
// clean-up whitespace, comments etc.
|
||||
array[index] = array[index].replace(/\s*#.*|^\s*|\s*$/g, '');
|
||||
}
|
||||
array.forEach(removeComments);
|
||||
|
||||
array = array.filter(function(e) {
|
||||
return e !== "";
|
||||
});
|
||||
|
||||
cb(null, array);
|
||||
};
|
||||
|
||||
|
||||
filefinder.prototype.treewalk = function(basedir, subdir, fnpattern, blacklist, foundfilesarray, cb) {
|
||||
var _self = this;
|
||||
var fulldir = path.join(basedir, subdir);
|
||||
if (DEBUGMODE) console.log(">treewalk (dir: %s, fnpattern: %s)", fulldir, fnpattern);
|
||||
var results = [];
|
||||
|
||||
fs.readdir(fulldir, function(err, list) {
|
||||
if (err) return cb(err);
|
||||
var i = 0;
|
||||
|
||||
function next() {
|
||||
var file = list[i++];
|
||||
if (!file) return cb(null, foundfilesarray.length);
|
||||
var partName = path.join(subdir, file);
|
||||
var filepath = path.join(fulldir, file);
|
||||
|
||||
// get file info
|
||||
fs.stat(filepath, function(err, stat) {
|
||||
if (stat && stat.isDirectory()) {
|
||||
if (blacklist && blacklist.indexOf(partName + "/") !== -1)
|
||||
return next();
|
||||
// directory, so recurse
|
||||
_self.treewalk(basedir, partName, fnpattern, blacklist, foundfilesarray, function(err, res) {
|
||||
results = results.concat(res);
|
||||
next();
|
||||
});
|
||||
}
|
||||
else {
|
||||
// file found, matches pattern?
|
||||
if (file.match(fnpattern) === null) {
|
||||
_self.countPatternMis++;
|
||||
return next();
|
||||
}
|
||||
|
||||
// check if blacklisted
|
||||
if (!blacklist || blacklist.indexOf(partName) == -1) {
|
||||
if (DEBUGMODE) console.log("file found: %s", partName);
|
||||
foundfilesarray.push(partName);
|
||||
}
|
||||
else {
|
||||
_self.countBlacklisted++;
|
||||
if (DEBUGMODE) console.log("File blacklisted: ", partName);
|
||||
}
|
||||
next();
|
||||
}
|
||||
});
|
||||
}
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
// export the class
|
||||
module.exports = new filefinder();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user