kopia lustrzana https://github.com/c9/core
start adding build step for static plugins
rodzic
ee12883f68
commit
82a31c8150
|
@ -474,16 +474,75 @@ define(function(require, exports, module) {
|
|||
|
||||
async.series([
|
||||
function(next) {
|
||||
fs.writeFile("__packed__.js", result.code, "utf8", next);
|
||||
},
|
||||
function(next) {
|
||||
fs.readdir(cwd, function(files) {
|
||||
if (files.indexOf("themes") != -1) {
|
||||
|
||||
fs.readdir(cwd, function(err, files) {
|
||||
console.log(files)
|
||||
if (err)
|
||||
return next();
|
||||
var extraCode = [];
|
||||
function forEachFile(dir, f) {
|
||||
try {
|
||||
fs.readdirSync(dir).forEach(f);
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (files.indexOf("builders") != -1) {
|
||||
forEachFile(cwd + "/builders", function(p) {
|
||||
console.log(p, "***");
|
||||
extraCode.push()
|
||||
|
||||
});
|
||||
}
|
||||
if (files.indexOf("keymaps") != -1) {
|
||||
forEachFile(cwd + "/keymaps", function(p) {
|
||||
console.log(p, "***");
|
||||
});
|
||||
}
|
||||
if (files.indexOf("modes") != -1) {
|
||||
forEachFile(cwd + "/modes", function(p) {
|
||||
console.log(p, "***");
|
||||
});
|
||||
}
|
||||
if (files.indexOf("outline") != -1) {
|
||||
forEachFile(cwd + "/outline", function(p) {
|
||||
console.log(p, "***");
|
||||
});
|
||||
}
|
||||
if (files.indexOf("runners") != -1) {
|
||||
forEachFile(cwd + "/runners", function(p) {
|
||||
console.log(p, "***");
|
||||
});
|
||||
}
|
||||
if (files.indexOf("snippets") != -1) {
|
||||
forEachFile(cwd + "/snippets", function(p) {
|
||||
console.log(p, "***");
|
||||
});
|
||||
}
|
||||
if (files.indexOf("themes") != -1) {
|
||||
forEachFile(cwd + "/themes", function(p) {
|
||||
console.log(p, "***");
|
||||
});
|
||||
}
|
||||
if (files.indexOf("template") != -1) {
|
||||
forEachFile(cwd + "/template", function(p) {
|
||||
console.log(p, "***");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
result.code += (function() {
|
||||
extraCode
|
||||
|
||||
}).toString().replace(/^.*{|}$/g, "")
|
||||
.replace("extraCode", extraCode);
|
||||
|
||||
next();
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
fs.writeFile("__packed__.js", result.code, "utf8", next);
|
||||
},
|
||||
function(next) {
|
||||
packedFiles.push(cwd + "/themes");
|
||||
zip(packedFiles);
|
||||
|
@ -510,7 +569,7 @@ define(function(require, exports, module) {
|
|||
tarArgs.push("--exclude=./" + p);
|
||||
}
|
||||
});
|
||||
console.log(tarArgs)
|
||||
// console.log(tarArgs)
|
||||
proc.spawn(TAR, {
|
||||
args: tarArgs,
|
||||
cwd: cwd
|
||||
|
|
|
@ -230,7 +230,6 @@ define(function(require, exports, module) {
|
|||
|
||||
function processModules(path, data){
|
||||
var parallel = [];
|
||||
var services = architect.services;
|
||||
|
||||
var placeholder = new Plugin();
|
||||
|
||||
|
@ -251,59 +250,7 @@ define(function(require, exports, module) {
|
|||
return next(err);
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case "builders":
|
||||
data = util.safeParseJson(data, next);
|
||||
if (!data) return;
|
||||
|
||||
services.build.addBuilder(filename, data, placeholder);
|
||||
break;
|
||||
case "keymaps":
|
||||
data = util.safeParseJson(data, next);
|
||||
if (!data) return;
|
||||
|
||||
services["preferences.keybindings"].addCustomKeymap(filename, data, placeholder);
|
||||
break;
|
||||
case "modes":
|
||||
var mode = {};
|
||||
var firstLine = data.split("\n", 1)[0].replace(/\/\*|\*\//g, "").trim();
|
||||
firstLine.split(";").forEach(function(n){
|
||||
if (!n) return;
|
||||
var info = n.split(":");
|
||||
mode[info[0].trim()] = info[1].trim();
|
||||
});
|
||||
|
||||
services.ace.defineSyntax({
|
||||
name: join(path, "modes", data.name),
|
||||
caption: mode.caption,
|
||||
extensions: (mode.extensions || "").trim()
|
||||
.split(",")
|
||||
.map(function(n){ return n.trim(); })
|
||||
.filter(function(n){ return n; })
|
||||
});
|
||||
break;
|
||||
case "outline":
|
||||
data = util.safeParseJson(data, next);
|
||||
if (!data) return;
|
||||
|
||||
services.outline.addOutlinePlugin(filename, data, placeholder);
|
||||
break;
|
||||
case "runners":
|
||||
data = util.safeParseJson(data, next);
|
||||
if (!data) return;
|
||||
|
||||
services.run.addRunner(filename, data, placeholder);
|
||||
break;
|
||||
case "snippets":
|
||||
services.complete.addSnippet(data, plugin);
|
||||
break;
|
||||
case "themes":
|
||||
services.ace.addTheme(data, placeholder);
|
||||
break;
|
||||
case "template":
|
||||
services.newresource.addFileTemplate(data, placeholder);
|
||||
break;
|
||||
}
|
||||
addStaticPlugin(type, path, filename, data, placeholder);
|
||||
|
||||
next();
|
||||
});
|
||||
|
@ -313,6 +260,63 @@ define(function(require, exports, module) {
|
|||
return parallel;
|
||||
}
|
||||
|
||||
function addStaticPlugin(type, pluginName, filename, data, plugin) {
|
||||
var services = architect.services;
|
||||
switch (type) {
|
||||
case "builders":
|
||||
data = util.safeParseJson(data, function() {});
|
||||
if (!data) return;
|
||||
|
||||
services.build.addBuilder(filename, data, plugin);
|
||||
break;
|
||||
case "keymaps":
|
||||
data = util.safeParseJson(data, function() {});
|
||||
if (!data) return;
|
||||
|
||||
services["preferences.keybindings"].addCustomKeymap(filename, data, plugin);
|
||||
break;
|
||||
case "modes":
|
||||
var mode = {};
|
||||
var firstLine = data.split("\n", 1)[0].replace(/\/\*|\*\//g, "").trim();
|
||||
firstLine.split(";").forEach(function(n){
|
||||
if (!n) return;
|
||||
var info = n.split(":");
|
||||
mode[info[0].trim()] = info[1].trim();
|
||||
});
|
||||
|
||||
services.ace.defineSyntax({
|
||||
name: join(pluginName, "modes", data.name),
|
||||
caption: mode.caption,
|
||||
extensions: (mode.extensions || "").trim()
|
||||
.split(",")
|
||||
.map(function(n){ return n.trim(); })
|
||||
.filter(function(n){ return n; })
|
||||
});
|
||||
break;
|
||||
case "outline":
|
||||
data = util.safeParseJson(data, function() {});
|
||||
if (!data) return;
|
||||
|
||||
services.outline.addOutlinePlugin(filename, data, plugin);
|
||||
break;
|
||||
case "runners":
|
||||
data = util.safeParseJson(data, function() {});
|
||||
if (!data) return;
|
||||
|
||||
services.run.addRunner(filename, data, plugin);
|
||||
break;
|
||||
case "snippets":
|
||||
services.complete.addSnippet(data, plugin);
|
||||
break;
|
||||
case "themes":
|
||||
services.ace.addTheme(data, plugin);
|
||||
break;
|
||||
case "template":
|
||||
services.newresource.addFileTemplate(data, plugin);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if require.s.contexts._ can help watching all dependencies
|
||||
function watch(path){
|
||||
watcher.watch(path);
|
||||
|
|
Ładowanie…
Reference in New Issue