diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index d281ba80..760c7299 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -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); diff --git a/package.json b/package.json index c22b3c76..5faa8460 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/plugins/c9.fs/fs.cache.xml.js b/plugins/c9.fs/fs.cache.xml.js index c9ad1844..9d2a6c6d 100644 --- a/plugins/c9.fs/fs.cache.xml.js +++ b/plugins/c9.fs/fs.cache.xml.js @@ -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 *****/ diff --git a/plugins/c9.fs/fs.cache.xml_test.js b/plugins/c9.fs/fs.cache.xml_test.js index 5014fe2d..9b574e45 100644 --- a/plugins/c9.fs/fs.cache.xml_test.js +++ b/plugins/c9.fs/fs.cache.xml_test.js @@ -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, diff --git a/plugins/c9.ide.editors/pane.js b/plugins/c9.ide.editors/pane.js index aeb17e1a..9a040d9c 100644 --- a/plugins/c9.ide.editors/pane.js +++ b/plugins/c9.ide.editors/pane.js @@ -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--; + }); + } }); } }, diff --git a/plugins/c9.ide.editors/tab.js b/plugins/c9.ide.editors/tab.js index e841ebef..83f07223 100644 --- a/plugins/c9.ide.editors/tab.js +++ b/plugins/c9.ide.editors/tab.js @@ -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; diff --git a/plugins/c9.ide.editors/tabmanager.js b/plugins/c9.ide.editors/tabmanager.js index 21cad3e8..fa60a1b9 100644 --- a/plugins/c9.ide.editors/tabmanager.js +++ b/plugins/c9.ide.editors/tabmanager.js @@ -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; diff --git a/plugins/c9.ide.plugins/debug.js b/plugins/c9.ide.plugins/debug.js index a22de97a..104729cc 100644 --- a/plugins/c9.ide.plugins/debug.js +++ b/plugins/c9.ide.plugins/debug.js @@ -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); }); diff --git a/plugins/c9.ide.plugins/manager.js b/plugins/c9.ide.plugins/manager.js index f3cdade3..c4cf984f 100644 --- a/plugins/c9.ide.plugins/manager.js +++ b/plugins/c9.ide.plugins/manager.js @@ -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 diff --git a/plugins/c9.ide.ui/forms.js b/plugins/c9.ide.ui/forms.js index 0ab3e6f8..400e7148 100644 --- a/plugins/c9.ide.ui/forms.js +++ b/plugins/c9.ide.ui/forms.js @@ -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); } diff --git a/plugins/c9.ide.watcher/watcher.js b/plugins/c9.ide.watcher/watcher.js index 3e754f4b..471cc838 100644 --- a/plugins/c9.ide.watcher/watcher.js +++ b/plugins/c9.ide.watcher/watcher.js @@ -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") {