Merge pull request +10126 from c9/fix/cryolite

Fixes for cryolite and the SDK
pull/223/head
Ruben Daniels 2015-11-05 13:50:12 -08:00
commit 5d22714f6b
11 zmienionych plików z 68 dodań i 30 usunięć

8
node_modules/vfs-local/localfs.js wygenerowano vendored
Wyświetl plik

@ -457,9 +457,13 @@ module.exports = function setup(fsOptions) {
} }
function metadata(path, options, callback) { function metadata(path, options, callback) {
if (path.charAt(0) == "~")
path = join(process.env.HOME, path.substr(1));
var dirpath = (path.substr(0,5) == "/_/_/" var dirpath = (path.substr(0,5) == "/_/_/"
? METAPATH + dirname(path.substr(4)) ? METAPATH + dirname(path.substr(4))
: WSMETAPATH + "/" + dirname(path)); : WSMETAPATH + "/" + dirname(path));
resolvePath(dirpath, options, function (err, dir) { resolvePath(dirpath, options, function (err, dir) {
if (err) return callback(err); if (err) return callback(err);
@ -479,7 +483,11 @@ module.exports = function setup(fsOptions) {
} }
function getMetadata(path, options, callback){ function getMetadata(path, options, callback){
if (path.charAt(0) == "~")
path = join(process.env.HOME, path.substr(1));
var metaPath = join(WSMETAPATH, path); var metaPath = join(WSMETAPATH, path);
resolvePath(metaPath, options, function (err, path) { resolvePath(metaPath, options, function (err, path) {
if (err) return callback(err); if (err) return callback(err);
fs.readFile(path, callback); fs.readFile(path, callback);

Wyświetl plik

@ -108,7 +108,7 @@
"c9.ide.save": "#4a4a60a004", "c9.ide.save": "#4a4a60a004",
"c9.ide.scm": "#f0365ca725", "c9.ide.scm": "#f0365ca725",
"c9.ide.terminal.monitor": "#b76f1c9f24", "c9.ide.terminal.monitor": "#b76f1c9f24",
"c9.ide.test": "#ebc037901c", "c9.ide.test": "#4913e6a0b9",
"c9.ide.test.mocha": "#586fb0cdc2", "c9.ide.test.mocha": "#586fb0cdc2",
"c9.ide.theme.flat": "#2de8414db7", "c9.ide.theme.flat": "#2de8414db7",
"c9.ide.threewaymerge": "#229382aa0b", "c9.ide.threewaymerge": "#229382aa0b",

Wyświetl plik

@ -56,20 +56,20 @@ define(function(require, exports, module) {
removeSingleNode(e); removeSingleNode(e);
}); });
watcher.on("change", function(e) { watcher.on("change.all", function(e) {
onstat({path: e.path, result: [null, e.stat]}); onstat({ path: e.path, result: [null, e.stat] });
}); });
watcher.on("directory", function(e) { watcher.on("directory.all", function(e) {
// @todo make onreaddir incremental // @todo make onreaddir incremental
onreaddir({path: e.path, result: [null, e.files]}); onreaddir({ path: e.path, result: [null, e.files] });
}); });
// Read // Read
fs.on("beforeReaddir", function (e) { fs.on("beforeReaddir", function (e) {
var node = findNode(e.path); var node = findNode(e.path);
if (!node) if (!node)
return; //Parent is not visible return; // Parent is not visible
// Indicate this directory is being read // Indicate this directory is being read
model.setAttribute(node, "status", "loading"); model.setAttribute(node, "status", "loading");
@ -147,6 +147,8 @@ define(function(require, exports, module) {
fs.on("afterReaddir", onreaddir, plugin); fs.on("afterReaddir", onreaddir, plugin);
function onstat(e) { function onstat(e) {
var stat;
if (!e.error) { if (!e.error) {
// update cache // update cache
var there = true; var there = true;
@ -168,14 +170,14 @@ define(function(require, exports, module) {
deleteNode(node); deleteNode(node);
} }
else { else {
var stat = e.result[1]; stat = e.result[1];
if (typeof stat != "object") if (typeof stat != "object")
stat = null; stat = null;
createNode(e.path, stat); createNode(e.path, stat);
} }
} }
else if (there) { else if (there) {
var stat = e.result[1]; stat = e.result[1];
if (typeof stat != "object") if (typeof stat != "object")
stat = null; stat = null;
createNode(e.path, stat, node); createNode(e.path, stat, node);
@ -202,18 +204,19 @@ define(function(require, exports, module) {
function addSingleNode(e, isFolder, linkInfo) { function addSingleNode(e, isFolder, linkInfo) {
var node = findNode(e.path); var node = findNode(e.path);
if (node) return; //Node already exists if (node) return; // Node already exists
if (!showHidden && isFileHidden(e.path)) if (!showHidden && isFileHidden(e.path))
return; return;
var parent = findNode(dirname(e.path)); var parent = findNode(dirname(e.path));
if (parent) { //Dir is in cache if (parent) { // Dir is in cache
var stat = isFolder var stat = isFolder
? {mime : "folder"} ? { mime : "folder" }
: (linkInfo : (linkInfo
? {link: true, linkStat: {fullPath: linkInfo}} ? { link: true, linkStat: { fullPath: linkInfo } }
: null); : {});
stat.mtime = Math.floor(Date.now() / 1000);
node = createNode(e.path, stat); node = createNode(e.path, stat);
emit("add", {path : e.path, node : node}); emit("add", {path : e.path, node : node});
@ -563,7 +566,10 @@ define(function(require, exports, module) {
node.mtime = stat.mtime; node.mtime = stat.mtime;
if (original_stat || stat.linkErr) if (original_stat || stat.linkErr)
node.link = stat.fullPath || stat.linkErr; node.link = stat.fullPath || stat.linkErr;
node.isFolder = isFolder; if (isFolder)
node.isFolder = isFolder;
else
delete node.isFolder;
} }
if (node.isFolder && !node.map) if (node.isFolder && !node.map)
@ -736,6 +742,10 @@ define(function(require, exports, module) {
}); });
plugin.on("unload", function(){ plugin.on("unload", function(){
loaded = false; loaded = false;
showHidden = false;
hiddenFilePattern = "";
hiddenFileRe = /^$/;
orphans = {};
}); });
/***** Register and define API *****/ /***** Register and define API *****/

Wyświetl plik

@ -737,7 +737,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"],
fsCache.off("add", c2); fsCache.off("add", c2);
fsCache.off("update", c3); fsCache.off("update", c3);
expect(fsCache.findNode(vpath)).to.exist; expect(fsCache.findNode(vpath)).to.exist;
expect(fsCache.findNode(vpath).isFolder).to.equal(false); expect(fsCache.findNode(vpath).isFolder).to.equal(undefined);
expect(fsCache.findNode(vpath).link).to.equal(target); expect(fsCache.findNode(vpath).link).to.equal(target);
expect(fsCache.findNode(vpath).label).to.equal(vpath.substr(1)); expect(fsCache.findNode(vpath).label).to.equal(vpath.substr(1));
expect(fsCache.findNode(vpath).path).to.equal(vpath); expect(fsCache.findNode(vpath).path).to.equal(vpath);
@ -829,7 +829,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"],
var vpath = "/listing.json"; var vpath = "/listing.json";
expect(fsCache.findNode(vpath)).to.exist; expect(fsCache.findNode(vpath)).to.exist;
expect(fsCache.findNode(vpath).size).to.equal(920); expect(fsCache.findNode(vpath).size).to.equal(920);
watcher.emit("change", { watcher.emit("change.all", {
type: "change", type: "change",
filename: vpath.substr(1), filename: vpath.substr(1),
path: vpath, path: vpath,

Wyświetl plik

@ -108,10 +108,16 @@ define(function(require, module, exports) {
} }
else { else {
tab.aml.on("afterclose", function(){ tab.aml.on("afterclose", function(){
setTimeout(function(){ if (tab.meta.$closeSync) {
tab.unload(e); tab.unload(e);
closing--; closing--;
}); }
else {
setTimeout(function(){
tab.unload(e);
closing--;
});
}
}); });
} }
}, },

Wyświetl plik

@ -280,7 +280,9 @@ define(function(require, module, exports) {
// @todo Explain difference with unload in docs // @todo Explain difference with unload in docs
function close(noAnim) { function close(noAnim) {
if (!amlPane.remove) return false;
amlPane.remove(amlTab, null, noAnim); amlPane.remove(amlTab, null, noAnim);
return true;
} }
/***** Lifecycle *****/ /***** Lifecycle *****/
@ -289,6 +291,13 @@ define(function(require, module, exports) {
load(); load();
}); });
plugin.on("beforeUnload", function(){
if (!plugin.meta.$closing) {
if (close())
return false;
}
});
plugin.on("unload", function(e) { plugin.on("unload", function(e) {
closed = true; closed = true;

Wyświetl plik

@ -132,11 +132,8 @@ define(function(require, module, exports) {
function removeTab(e) { function removeTab(e) {
if (!e.error) { if (!e.error) {
var tab = findTab(e.path); var tab = findTab(e.path);
if (tab) { if (tab)
tab.document.meta.$ignoreSave = true; tab.unload();
tab.close();
delete tab.document.meta.$ignoreSave;
}
} }
} }
fs.on("afterUnlink", removeTab); fs.on("afterUnlink", removeTab);
@ -145,9 +142,8 @@ define(function(require, module, exports) {
var path = e.path; var path = e.path;
Object.keys(tabs).forEach(function(id) { Object.keys(tabs).forEach(function(id) {
var tab = tabs[id]; var tab = tabs[id];
if (tab.path && tab.path.indexOf(path) === 0) { if (tab.path && tab.path.indexOf(path) === 0)
tab.unload(); tab.unload();
}
}); });
}); });
// Close a pane when it doesn't open // Close a pane when it doesn't open
@ -791,7 +787,10 @@ define(function(require, module, exports) {
var pane = list[i], nodes = pane.getTabs(); var pane = list[i], nodes = pane.getTabs();
for (var j = nodes.length - 1; j >= 0; j--) { for (var j = nodes.length - 1; j >= 0; j--) {
var tab = nodes[j]; var tab = nodes[j];
if (!soft) tab.unload(); if (!soft) {
tab.meta.$closeSync = true;
tab.unload();
}
else { else {
tab.aml.parentNode.removeChild(tab.aml); tab.aml.parentNode.removeChild(tab.aml);
tab.pane = null; tab.pane = null;

Wyświetl plik

@ -183,6 +183,9 @@ define(function(require, exports, module) {
cfg.staticPrefix = host + join(base, name); cfg.staticPrefix = host + join(base, name);
cfg.apikey = "0000000000000000000000000000="; cfg.apikey = "0000000000000000000000000000=";
// Set version for package manager
cfg.version = options.version;
config.push(cfg); config.push(cfg);
plugins.push(name + "/" + path); plugins.push(name + "/" + path);
}); });

Wyświetl plik

@ -105,7 +105,9 @@ define(function(require, exports, module) {
}); });
// var emit = plugin.getEmitter(); // var emit = plugin.getEmitter();
var HASSDK = experimental.addExperiment("sdk=1", "SDK/Load Custom Plugins"); // var HASSDK = experimental.addExperiment("sdk=0", "SDK/Load Custom Plugins");
var ENABLED = c9.location.indexOf("debug=2") > -1;
var MANAGER = experimental.addExperiment("plugin-manager=1", "SDK/Plugin Manager");
var model, datagrid, filterbox; var model, datagrid, filterbox;
var btnUninstall, btnReport, btnReadme, btnCloud9, btnReload; var btnUninstall, btnReport, btnReadme, btnCloud9, btnReload;
@ -115,7 +117,7 @@ define(function(require, exports, module) {
if (loaded) return false; if (loaded) return false;
loaded = true; loaded = true;
if (!HASSDK) return; if (!MANAGER && !ENABLED) return;
// @TODO enable/disable plugins -> move to ext // @TODO enable/disable plugins -> move to ext

Wyświetl plik

@ -499,8 +499,8 @@ define(function(require, exports, module) {
htmlNode = htmlNode.$int; htmlNode = htmlNode.$int;
} }
// if we have apf node, make sure apf child-parent links do not get broken // if we have apf node, make sure apf child-parent links do not get broken
if (htmlNode.host && container.host) { if (htmlNode.host) {
htmlNode.host.insertBefore(container.host, beforeNode && beforeNode.host); htmlNode.host.insertBefore(container, beforeNode && beforeNode.host);
} else { } else {
htmlNode.insertBefore(container.$ext, beforeNode || null); htmlNode.insertBefore(container.$ext, beforeNode || null);
} }

Wyświetl plik

@ -188,6 +188,7 @@ define(function(require, exports, module) {
function fireWatcherEvent(eventSuffix) { function fireWatcherEvent(eventSuffix) {
if (event == "error") { if (event == "error") {
if (eventSuffix != ".all") return;
// console.error("[watchers] received error for", path, err, stat); // console.error("[watchers] received error for", path, err, stat);
} }
else if (event == "delete") { else if (event == "delete") {