projects
/
gnome.introspection-doc-generator
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f33cfca
)
JSDOC/Packer.js
author
alan
<alan@alanfast.akbkhome.com>
Wed, 21 Apr 2010 05:39:15 +0000
(13:39 +0800)
committer
alan
<alan@alanfast.akbkhome.com>
Wed, 21 Apr 2010 05:39:15 +0000
(13:39 +0800)
JSDOC/Packer.js
patch
|
blob
|
history
diff --git
a/JSDOC/Packer.js
b/JSDOC/Packer.js
index
0ce1ec4
..
aebd8a3
100644
(file)
--- a/
JSDOC/Packer.js
+++ b/
JSDOC/Packer.js
@@
-75,8
+75,12
@@
Packer = function(cfg)
if (!this.target) {
throw "No Target";
}
if (!this.target) {
throw "No Target";
}
-
+ if ((typeof(cfg.tmpDir) != 'undefined') && (!cfg.cleanup)) {
+ this.cleanup = false; // do not clean up files.. = as tmpdir is set.
+ }
+ this.tmpFiles = [];
this.timer = new Date() * 1;
this.timer = new Date() * 1;
+ this.packAll();
}
Packer.prototype = {
}
Packer.prototype = {
@@
-92,23
+96,23
@@
Packer.prototype = {
* @prop debugTarget {String} target to write files debug version to (uncompacted)- must be full path.
*/
debugTarget : '', // merged file without compression.
* @prop debugTarget {String} target to write files debug version to (uncompacted)- must be full path.
*/
debugTarget : '', // merged file without compression.
-
- workingDir : '/tmp',
+ /**
+ * @prop tmpDir {String} (optional) where to put the temporary files.
+ * if you set this, then files will not be cleaned up
+ */
+ tmpDir : '/tmp',
translateJson : '', // json based list of strings in all files.
translateJson : '', // json based list of strings in all files.
- tmpFile : false, // list of temporary files - cleaned up at end..
-
+ tmpFiles : false, // list of temporary files - cleaned up at end..
/**
/**
- * Pack the files.
- *
- * @param {String} batch_path location of batched temporary min files.
- * @param {String} compressed_file eg. roo-all.js
- * @param {String} debug_file eg. roo-debug.js
- *
+ * @prop cleanup {Boolean} (optional) clean up temp files after done -
+ * Defaults to false if you set tmpDir, otherwise true.
*/
*/
+ cleanup : true, //
- packFiles : function() {
+ packAll : function() // do the packing (run from constructor)
+ {
//this.transOrigFile= bpath + '/../lang.en.js'; // needs better naming...
//File.write(this.transfile, "");
//this.transOrigFile= bpath + '/../lang.en.js'; // needs better naming...
//File.write(this.transfile, "");
@@
-136,12
+140,14
@@
Packer.prototype = {
- var minfile = bpath + '/' +files[i].substr(spath.length+1).replace(/\//g, '.');
- var transfile = bpath + '/' +files[i].substr(spath.length+1).replace(/\//g, '.') +'.lang';
+ var minfile = this.tmpDir + '/' +files.replace(/\//g, '.');
+
+
// let's see if we have a min file already?
// let's see if we have a min file already?
+ // this might happen if tmpDir is set ..
if (true && File.exists(minfile)) {
var mt = File.mtime(minfile);
if (true && File.exists(minfile)) {
var mt = File.mtime(minfile);
- var ot = File.mtime(files
[i]
);
+ var ot = File.mtime(files);
print("compare : " + mt + "=>" + ot);
if (mt >= ot) {
continue;
print("compare : " + mt + "=>" + ot);
if (mt >= ot) {
continue;
@@
-161,30
+167,17
@@
Packer.prototype = {
print("COMPRESSING ");
//var codeComp = pack(str, 10, 0, 0);
print("COMPRESSING ");
//var codeComp = pack(str, 10, 0, 0);
- var str = File.read(files
[i]
);
- var str = this.pack(str, files
[i]
, minfile);
+ var str = File.read(files);
+ var str = this.pack(str, files, minfile);
if (str.length) {
if (str.length) {
- File.write(minfile, str);
+ File.write(minfile, str);
+ this.tmpFiles.push(minfile);
}
}
-
- //var str = File.read(minfile);
- //print("using MIN FILE "+ minfile);
- //File.append(outpath, str + "\n");
- //this.timerPrint("Wrote Files");
- /*
- if (codeComp.length) {
- //print(codeComp);
-
- File.append(outpath, codeComp+"\n");
- File.write(minfile, codeComp);
- }
- */
- //print(codeComp);
- // if (i > 10) return;
+
}
}
- if (this.translate) {
+ if (this.translate
Json
) {
print("MERGING LANGUAGE");
print("MERGING LANGUAGE");