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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -108,10 +108,16 @@ define(function(require, module, exports) {
}
else {
tab.aml.on("afterclose", function(){
setTimeout(function(){
if (tab.meta.$closeSync) {
tab.unload(e);
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
function close(noAnim) {
if (!amlPane.remove) return false;
amlPane.remove(amlTab, null, noAnim);
return true;
}
/***** Lifecycle *****/
@ -289,6 +291,13 @@ define(function(require, module, exports) {
load();
});
plugin.on("beforeUnload", function(){
if (!plugin.meta.$closing) {
if (close())
return false;
}
});
plugin.on("unload", function(e) {
closed = true;

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -105,7 +105,9 @@ define(function(require, exports, module) {
});
// 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 btnUninstall, btnReport, btnReadme, btnCloud9, btnReload;
@ -115,7 +117,7 @@ define(function(require, exports, module) {
if (loaded) return false;
loaded = true;
if (!HASSDK) return;
if (!MANAGER && !ENABLED) return;
// @TODO enable/disable plugins -> move to ext

Wyświetl plik

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

Wyświetl plik

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