From: Alan Knowles Date: Sat, 31 Jul 2010 08:03:57 +0000 (+0800) Subject: Merge branch 'live' of http://private.akbkhome.com/gnome.introspection-doc-generator... X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=commitdiff_plain;h=8354fa26bae86b85a5a6c28fc1efdbe19d6665d5;hp=f68ec0c532ef9ea0eb9c3c5d62b6e182aebde028 Merge branch 'live' of private.akbkhome.com/gnome.introspection-doc-generator into live --- diff --git a/Date.js b/Date.js old mode 100755 new mode 100644 diff --git a/JSDOC/Packer.js b/JSDOC/Packer.js index 933156d..f7a3246 100644 --- a/JSDOC/Packer.js +++ b/JSDOC/Packer.js @@ -10,6 +10,7 @@ CompressWhite = imports.CompressWhite.CompressWhite; Collapse = imports.Collapse.Collapse; GLib = imports.gi.GLib; +Gio = imports.gi.Gio; /** * @namespace JSDOC * @class Packer @@ -83,32 +84,61 @@ Packer = function(cfg) throw "No Files"; } - + var link = false; + if (cfg.autoBuild) { + var version = 0; + this.files.forEach(function(f) { + version = Math.max(File.mtime(f), version); + }); + var dirname = GLib.path_get_dirname(this.files[0]); + var outname = this.module ? this.module : GLib.path_get_basename(dirname); + this.target = dirname + '/compiled/' + outname + '-' + version + '.js'; + if (File.exists(this.target)) { + print("Target file already exists"); + Seed.quit(); + } + this.prefix = dirname +'/'; + this.translateJSON = dirname + '/compiled/_translation_.js'; + + } + + print(this.translateJSON); this.timer = new Date() * 1; this.packAll(); + + } Packer.prototype = { /** - * @prop srcfiles {String} file containing a list of files/or classes to use. + * @cfg {String} srcfiles file containing a list of files/or classes to use. */ srcfile : false, /** - * @prop files {Array} list of files to compress (must be full path) + * @cfg {Array} files list of files to compress (must be full path) */ files : false, /** - * @prop target {String} target to write files to - must be full path. + * @cfg {String} target to write files to - must be full path. */ target : '', /** - * @prop debugTarget {String} target to write files debug version to (uncompacted)- must be full path. + * @cfg {Boolean} autoBuild - turn on autobuild feature (puts files in compiled directory, + * and enables translation toolkit. + */ + autoBuild : false, + /** + * @cfg {String} module used with autoBuild to force a file name + */ + module: false, + /** + * @cfg {String} debugTargettarget to write files debug version to (uncompacted)- must be full path. */ debugTarget : '', // merged file without compression. /** - * @prop tmpDir {String} (optional) where to put the temporary files. + * @cfg {String} tmpDir (optional) where to put the temporary files. * if you set this, then files will not be cleaned up */ tmpDir : '/tmp', @@ -116,18 +146,29 @@ Packer.prototype = { translateJSON : '', // json based list of strings in all files. /** - * @prop cleanup {Boolean} (optional) clean up temp files after done - + * @cfg {Boolean} cleanup (optional) clean up temp files after done - * Defaults to false if you set tmpDir, otherwise true. */ cleanup : true, + /** + * @cfg {Boolean} keepWhite (optional) do not remove white space in output. + * usefull for debugging compressed files. + */ + + keepWhite: true, /** - * @prop prefix {String} (optional) prefix of directory to be stripped of when + * @cfg {String} prefix (optional) prefix of directory to be stripped of when * Calculating md5 of filename */ prefix : '', out : '', // if no target is specified - then this will contain the result + /** + * load a dependancy list -f option + * @param {String} srcfile sourcefile to parse + * + */ loadSourceFile : function(srcfile) { @@ -353,8 +394,8 @@ Packer.prototype = { print(sp.warnings.join("\n")); - //var out = CompressWhite(new TokenStream(toks), this, true); // do not kill whitespace.. - var out = CompressWhite(new TokenStream(toks), this, false); + var out = CompressWhite(new TokenStream(toks), this, this.keepWhite); // do not kill whitespace.. + this.timerPrint("Compressed"); return out; @@ -416,10 +457,13 @@ Packer.prototype = { File.write(transmd5, ''); for(v in map) { - File.append(transfile, l + "\n\t \"" + v + '" : "' + v + '"'); + if (!v.length) { + continue; + } + File.append(transfile, l + "\n\t" + JSON.stringify(v) + " : " + JSON.stringify(v)); l = ','; // strings are raw... - as the where encoded to start with!!! - File.append(transmd5, '_T["' + this.md5(ffn + '-' + v) + '"]="'+v+"\";\n"); + File.append(transmd5, '_T["' + this.md5(ffn + '-' + v) + '"]='+JSON.stringify(v)+";\n"); } File.append(transfile, "\n},"); // always one trailing.. diff --git a/String.js b/String.js old mode 100755 new mode 100644 diff --git a/pack.js b/pack.js index c51f006..d9178de 100644 --- a/pack.js +++ b/pack.js @@ -11,6 +11,10 @@ * -C no cleanup (use with -w if you need are using a cache directory.) * -p prefix for translation md5 generator (directory that files are in, and is removed * from path when generating an md5 for the translated name. + * -k keepWhite - keeps the white space in the output files. + * -a autoBuild - puts target in INPUTDIR/compiled/Core-TIMESTAMP.js and enabled translastion + * + * -m module name used with autoBuild to force a module name. * compresses files listed as arguments and outputs result */ @@ -27,7 +31,9 @@ args.shift(); // pack.js var cfg = { files : [], target : false, - srcfiles : [] + srcfiles : [], + autoBuild : false, + keepWhite : false } @@ -67,6 +73,19 @@ for(var i =0; i < args.length;i++) { i++; continue; } + if (args[i] == '-m') { + cfg.module = args[i+1]; + i++; + continue; + } + if (args[i] == '-a') { + cfg.autoBuild = true + continue; + } + if (args[i] == '-k') { + cfg.keepWhite = true + continue; + } if (cfg.files.indexOf(args[i]) > -1) { continue; // remove dupes. } diff --git a/templates/resources/default.css b/templates/resources/default.css old mode 100755 new mode 100644 diff --git a/templates/resources/library_gnome.css b/templates/resources/library_gnome.css old mode 100755 new mode 100644 diff --git a/templates/resources/library_gnome_print.css b/templates/resources/library_gnome_print.css old mode 100755 new mode 100644 diff --git a/templates/resources/page.js b/templates/resources/page.js old mode 100755 new mode 100644 diff --git a/templates/seed/class_ix.html b/templates/seed/class_ix.html old mode 100755 new mode 100644 diff --git a/templates/seed/index.html b/templates/seed/index.html old mode 100755 new mode 100644