Merge branch 'live' of http://private.akbkhome.com/gnome.introspection-doc-generator...
[gnome.introspection-doc-generator] / JSDOC / Packer.js
index 1ab0ce1..f7a3246 100644 (file)
@@ -10,6 +10,7 @@ CompressWhite   = imports.CompressWhite.CompressWhite;
 Collapse        = imports.Collapse.Collapse;
 
 GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
 /**
  * @namespace JSDOC
  * @class  Packer
@@ -92,8 +93,7 @@ Packer = function(cfg)
         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';
-        link = dirname + '/compiled/' + outname + '.js';
-        if (File.exists(this.target)) {
+         if (File.exists(this.target)) {
             print("Target file already exists");
             Seed.quit();
         }
@@ -102,17 +102,10 @@ Packer = function(cfg)
         
     }
      
-    
+    print(this.translateJSON);
     this.timer =  new Date() * 1;
     this.packAll();
     
-    if (link) {
-        if (File.exists(link)) {
-            File.remove(link);
-        }
-        var f = Gio.file_new_for_path(this.target);
-        f.create_symbolic_link(link);
-    }
     
     
  
@@ -157,6 +150,12 @@ Packer.prototype = {
      *    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,
     
     /**
      * @cfg {String} prefix (optional) prefix of directory to be stripped of when
@@ -395,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;