do not load installed plugins from plugins/debug

pull/85/head
nightwing 2015-04-16 03:30:14 +04:00 zatwierdzone przez nightwing
rodzic 0ec868b119
commit 5897a84919
3 zmienionych plików z 27 dodań i 29 usunięć

Wyświetl plik

@ -353,7 +353,7 @@ define(function(require, exports, module) {
// Validate plugins // Validate plugins
var plugins = {}; var plugins = {};
fs.readdirSync(cwd).forEach(function(filename) { fs.readdirSync(cwd).forEach(function(filename) {
if (/(__packed__|_test)\.js$/.test(filename) || !/\.js$/.test(filename)) return; if (/(__\w*__|_test)\.js$/.test(filename) || !/\.js$/.test(filename)) return;
try { try {
var val = fs.readFileSync(cwd + "/" + filename); var val = fs.readFileSync(cwd + "/" + filename);
} catch(e) { } catch(e) {
@ -613,7 +613,7 @@ define(function(require, exports, module) {
additional.push(staticPlugin); additional.push(staticPlugin);
packedConfig.push(staticPlugin.id); packedConfig.push(staticPlugin.id);
} }
var path = "plugins/" + packageName + "/__packed__"; var path = "plugins/" + packageName + "/__installed__";
additional.push({ additional.push({
id: path, id: path,
source: 'define("' + path + '", [],' + source: 'define("' + path + '", [],' +
@ -675,6 +675,7 @@ define(function(require, exports, module) {
tarArgs.push("--exclude=./" + normalizePath(p)); tarArgs.push("--exclude=./" + normalizePath(p));
} }
}); });
tarArgs.push("--transform='flags=r;s|__packed__|__installed__|'");
// console.log(tarArgs) // console.log(tarArgs)
proc.spawn(TAR, { proc.spawn(TAR, {
args: tarArgs, args: tarArgs,

Wyświetl plik

@ -183,9 +183,13 @@ define(function(require, exports, module) {
if (err) if (err)
return next(err); return next(err);
// Remove the base path // Remove the base path
data = data.replace(rePath, ""); data = data.replace(rePath, "");
if (data.indexOf("/__installed__.js"))
next("installed");
// Process all the submodules // Process all the submodules
var parallel = processModules(path, data, resourceHolder); var parallel = processModules(path, data, resourceHolder);
async.parallel(parallel, function(err, data){ async.parallel(parallel, function(err, data){

Wyświetl plik

@ -1,3 +1,4 @@
/*global requirejs*/
define(function(require, exports, module) { define(function(require, exports, module) {
main.consumes = [ main.consumes = [
"Plugin", "vfs", "c9", "plugin.installer", "fs", "auth" "Plugin", "vfs", "c9", "plugin.installer", "fs", "auth"
@ -57,33 +58,25 @@ define(function(require, exports, module) {
fs.readdir("~/.c9/plugins", function(error, files){ fs.readdir("~/.c9/plugins", function(error, files){
files.forEach(function(f) { files.forEach(function(f) {
if (!/^[_.]/.test(f.name)) if (!/^[_.]/.test(f.name))
loadOne({ packageName: f.name}, false); loadOne({packageName: f.name}, false);
}) });
}); });
} }
var packages = {};
config.forEach(function(options){ config.forEach(function(options){
// var name = options.packagePath.replace(/^plugins\/([^\/]*?)\/.*$/, "$1"); var name = options.packagePath.replace(/^plugins\/([^\/]*?)\/.*$/, "$1");
// names.push(name); if (!packages[name]) {
packages[name] = {
// var path = options.packagePath + ".js"; packageName: name,
apiKey: options.apiKey
// options.packagePath = host + join(base, path.replace(/^plugins\//, "")); };
}
names.push(name);
// if (!options.setup) { });
// wait++;
Object.keys(packages).forEach(function(key) {
// fs.exists("~/.c9/" + path, function(exists){ loadOne(packages[key], false);
// if (!exists) {
// install.push(options);
// names.remove(name);
// }
// if (!--wait)
// done(install);
// });
// }
}); });
function loadOne(packageConfig, forceInstall) { function loadOne(packageConfig, forceInstall) {
@ -94,8 +87,8 @@ define(function(require, exports, module) {
var paths = {}; var paths = {};
paths[root] = host + base + "/" + packageName; paths[root] = host + base + "/" + packageName;
requirejs.config({paths: paths}); requirejs.config({paths: paths});
requirejs.undef(root + "/__packed__.js"); requirejs.undef(root + "/__installed__.js");
require([root + "/__packed__"], function(plugins) { require([root + "/__installed__"], function(plugins) {
var config = plugins.map(function(p) { var config = plugins.map(function(p) {
return { return {
staticPrefix: host + join(base, name), staticPrefix: host + join(base, name),
@ -109,8 +102,8 @@ define(function(require, exports, module) {
done(); done();
}, function(err) { }, function(err) {
if (forceInstall) { if (err && forceInstall) {
install.push(packageName) install.push(packageName);
} }
done(); done();
}); });