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
var plugins = {};
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 {
var val = fs.readFileSync(cwd + "/" + filename);
} catch(e) {
@ -613,7 +613,7 @@ define(function(require, exports, module) {
additional.push(staticPlugin);
packedConfig.push(staticPlugin.id);
}
var path = "plugins/" + packageName + "/__packed__";
var path = "plugins/" + packageName + "/__installed__";
additional.push({
id: path,
source: 'define("' + path + '", [],' +
@ -675,6 +675,7 @@ define(function(require, exports, module) {
tarArgs.push("--exclude=./" + normalizePath(p));
}
});
tarArgs.push("--transform='flags=r;s|__packed__|__installed__|'");
// console.log(tarArgs)
proc.spawn(TAR, {
args: tarArgs,

Wyświetl plik

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

Wyświetl plik

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