From 1fa1c01dddb13d1770022b71092f3cb54233093a Mon Sep 17 00:00:00 2001 From: Alex Brausewetter Date: Thu, 3 Sep 2015 15:59:24 -0700 Subject: [PATCH] Revert "Fix various sdk issues" --- configs/client-default.js | 1 - node_modules/c9/setup_paths.js | 8 ++-- package.json | 4 +- plugins/c9.ide.plugins/loader.js | 64 ++++++++++++++++---------------- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/configs/client-default.js b/configs/client-default.js index a9397464..6636557e 100644 --- a/configs/client-default.js +++ b/configs/client-default.js @@ -381,7 +381,6 @@ module.exports = function(options) { "plugins/c9.ide.immediate/evaluator", "plugins/c9.ide.immediate/evaluators/browserjs", "plugins/c9.ide.immediate/evaluators/debugnode", - "plugins/c9.ide.immediate/evaluators/bash", "plugins/c9.ide.run.debug/variables", "plugins/c9.ide.run.debug/watches", "plugins/c9.ide.run.debug/liveinspect", diff --git a/node_modules/c9/setup_paths.js b/node_modules/c9/setup_paths.js index bad8e241..e737a890 100644 --- a/node_modules/c9/setup_paths.js +++ b/node_modules/c9/setup_paths.js @@ -13,11 +13,9 @@ modules._resolveFilename = function(request, parent) { // Ensure client extensions can be loaded request = request.replace(/^lib\//, "node_modules/"); // ensure we never use node_modules outside of root dir - if (parent.paths[0] && parent.paths[0].indexOf(root) == 0) { - parent.paths = parent.paths.filter(function(p) { - return p.indexOf(root) == 0; - }); - } + parent.paths = parent.paths.filter(function(p) { + return p.indexOf(root) == 0 + }); // Add the extra paths extraPaths.forEach(function(p) { if (parent.paths.indexOf(p) === -1) diff --git a/package.json b/package.json index 4434eb51..48e93a6a 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "c9.ide.ace.emmet": "#6dc4585e02", "c9.ide.ace.gotoline": "#a8ff07c8f4", "c9.ide.ace.keymaps": "#bf6d36213f", - "c9.ide.ace.repl": "#9d9d744cdd", + "c9.ide.ace.repl": "#ffa15f19d3", "c9.ide.ace.split": "#0ae0151c78", "c9.ide.ace.statusbar": "#d95be89d53", "c9.ide.ace.stripws": "#cf0f42ac59", @@ -88,7 +88,7 @@ "c9.ide.format": "#b0bb91a623", "c9.ide.help.support": "#e95f98f87c", "c9.ide.imgeditor": "#66a9733dc1", - "c9.ide.immediate": "#4a6ec921d8", + "c9.ide.immediate": "#afa636feb8", "c9.ide.installer": "#be8d9aa07c", "c9.ide.mount": "#292b312b4b", "c9.ide.navigate": "#6e4efa5b25", diff --git a/plugins/c9.ide.plugins/loader.js b/plugins/c9.ide.plugins/loader.js index 95742ad0..c77a14d1 100644 --- a/plugins/c9.ide.plugins/loader.js +++ b/plugins/c9.ide.plugins/loader.js @@ -120,6 +120,7 @@ define(function(require, exports, module) { async.map(stats, function(stat, done) { // check for folder or symlink with folder target + if (stat.mime !== "inode/directory" && (stat.mime === "inode/symlink" && stat.linkStat.mime !== "inode/directory") ) { @@ -127,11 +128,13 @@ define(function(require, exports, module) { } // check folers not prefixed with [._] + if (stat.name[0] === "." || stat.name[0] === "_") { return done(); } // check and load package.json + var config = { name: stat.name, path: absolutePath([ dirPath, stat.name ].join("/")), @@ -213,14 +216,17 @@ define(function(require, exports, module) { */ function loadPackage(config, callback) { loadPackageInstalledJs(config, function(err, installed) { - var plugins = installed; + var plugins; + if (err) { plugins = _.map(config.metadata.plugins, function(value, key) { return [ "plugins", config.name, key ].join("/"); }); + } else { + plugins = installed; } - var architectConfig = plugins.map(function(plugin) { + var architectConfig = installed.map(function(plugin) { if (typeof plugin == "string") plugin = { packagePath: plugin }; @@ -250,41 +256,36 @@ define(function(require, exports, module) { listAllPackages(function(err, resolved) { if (err) return console.error(err); - var extraPackages = {}; - // convert old format from db to the new one - loaderConfig.forEach(function(p) { - if (!extraPackages[p.packageName]) { - var path = "plugins/" + p.packageName; - extraPackages[path] = { - apiKey: p.apiKey, - packagePath: path, - version: p.version, - name: p.packageName - }; - } - }); if (!loadFromDisk) { // filter packages by config instead of loading // everything from disk + resolved = resolved.filter(function(config) { - if (extraPackages[config.packagePath]) - return true; - - console.warn("[c9.ide.loader] Not loading package " - + config.path + " because it is not installed, " - + "according to the database"); - return false; + var extraConfig = _.find(loaderConfig, { packagePath: config.packagePath }); + + if (!extraConfig) { + console.warn("[c9.ide.loader] Not loading package " + + config.path + " because it is not installed, " + + "according to the database"); + + return false; + } + + config.apiKey = extraConfig.apiKey; + + return true; }); } - resolved.filter(function(config) { - if (extraPackages[config.packagePath]) - delete extraPackages[config.packagePath]; - }); - Object.keys(extraPackages).forEach(function(extraConfig) { - console.warn("[c9.ide.loader] Package " - + extraConfig.packagePath + " should be installed, according " - + "to the database, but was not found on the filesystem. " - + "Try reinstalling it."); + + loaderConfig.forEach(function(extraConfig) { + // warn about missing packages which are supposed to be installed + + if (!_.find(resolved, { packagePath: extraConfig.packagePath })) { + console.warn("[c9.ide.loader] Package " + + extraConfig.packagePath + " should be installed, according " + + "to the database, but was not found on the filesystem. " + + "Try reinstalling it."); + } }); names = _.pluck(resolved, "name"); @@ -306,6 +307,7 @@ define(function(require, exports, module) { load(); }); plugin.on("unload", function() { + loaded = false; }); /***** Register and define API *****/