diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 7f68bad7..547c5b1a 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -43,56 +43,61 @@ if (!fs.existsSync) var copy = require('dryice').copy; var ACE_HOME = __dirname; +var BUILD_DIR = "build"; function main(args) { - var target = "minimal"; - if (args.length == 3) { - target = args[2]; - // Check if 'target' contains some allowed value. - if (!/^(normal|bm|demo|minimal)$/.test(target)) - target = "help"; - } + var type = "minimal"; + args = args.map(function(x) { + if (x[0] == "-" && x[1] != "-") + return "-" + x; + return x; + }); + + if (args[2] && (args[2][0] != "-" || args[2].indexOf("h") != -1)) + type = args[2]; - if (target == "help") { - console.log("--- Ace Dryice Build Tool ---"); - console.log(""); - console.log("Options:"); - console.log(" minimal Runs minimal build of Ace"); - console.log(" normal Runs embedded build of Ace"); - console.log(" demo Runs demo build of Ace"); - console.log(" bm Runs bookmarklet build of Ace"); - process.exit(0); - } + var i = args.indexOf("--target"); + if (i != -1 && args[i+1]) + BUILD_DIR = args[i+1]; - var aceProject = { - roots: [ - ACE_HOME + '/lib', - ACE_HOME + '/demo' - ], - textPluginPattern: /^ace\/requirejs\/text!/ - }; - - if (target == "minimal") { - buildAce(aceProject, { - compress: false, - noconflict: false, - suffix: "", - name: "ace" + if (type == "minimal") { + buildAce({ + compress: args.indexOf("-m") != -1, + noconflict: args.indexOf("-nc") != -1 }); + } else if (type == "normal") { + ace(); + } else if (type == "demo") { + demo(); + } else if (type == "bm") { + bookmarklet(); + } else if (type == "full") { + ace(); + demo(); + bookmarklet(); } - if (target == "normal") { - ace(aceProject); - } - else if (target == "demo") { - demo(aceProject); - } - else if (target == "bm") { - bookmarklet(aceProject); - } + + console.log("--- Ace Dryice Build Tool ---"); + console.log(""); + console.log("Options:"); + console.log(" normal Runs embedded build of Ace"); + console.log(" demo Runs demo build of Ace"); + console.log(" bm Runs bookmarklet build of Ace"); + console.log(" full all of above"); + console.log("flags:"); + console.log(" -m minify"); + console.log(" -nc namespace require"); + console.log(" --target ./path path to build folder"); + console.log(""); + if (BUILD_DIR) + console.log(" output generated in " + type + __dirname + "/" + BUILD_DIR) + + process.exit(0); + } -function bookmarklet(aceProject) { - var targetDir = "build/textarea"; +function bookmarklet() { + var targetDir = BUILD_DIR + "/textarea"; copy({ source: "build_support/editor_textarea.html", dest: targetDir + '/editor.html' @@ -102,7 +107,7 @@ function bookmarklet(aceProject) { dest: targetDir + '/style.css' }); - buildAce(aceProject, { + buildAce({ targetDir: targetDir + "/src", ns: "__ace_shadowed__", exportModule: "ace/ext/textarea", @@ -115,38 +120,27 @@ function bookmarklet(aceProject) { }); } -function ace(aceProject) { +function ace() { console.log('# ace ---------'); // uncompressed - buildAce(aceProject, { + buildAce({ compress: false, - noconflict: false, - suffix: "", - name: "ace" + noconflict: false }); - buildAce(aceProject, { + buildAce({ compress: false, - noconflict: true, - suffix: "-noconflict", - name: "ace", - workers: [] + noconflict: true }); // compressed - buildAce(aceProject, { + buildAce({ compress: true, - noconflict: false, - suffix: "-min", - name: "ace", - workers: [] + noconflict: false }); - buildAce(aceProject, { + buildAce({ compress: true, - noconflict: true, - suffix: "-min-noconflict", - name: "ace", - workers: [] + noconflict: true }); console.log('# ace License | Readme | Changelog ---------'); @@ -169,7 +163,7 @@ function ace(aceProject) { }); } -function demo(aceProject) { +function demo() { console.log('# kitchen sink ---------'); var version, ref; @@ -182,14 +176,10 @@ function demo(aceProject) { } var changeComments = function(data) { return (data - .replace("DEVEL-->", "") - .replace("", "") - .replace(" + + + + + +
-
+
+
+
| @@ -216,8 +226,7 @@ - - + - + |