if (!this.files) {
throw "No Files";
}
- if (!this.target) {
- throw "No Target";
- }
+
if ((this.tmpDir != Packer.prototype.tmpDir) && (!cfg.cleanup)) {
this.cleanup = false; // do not clean up files.. = as tmpdir is set.
}
this.timer = new Date() * 1;
this.packAll();
+
}
Packer.prototype = {
*/
cleanup : true, //
+
+ out : '', // if no target is specified - then this will contain the result
+
packAll : function() // do the packing (run from constructor)
{
//this.transOrigFile= bpath + '/../lang.en.js'; // needs better naming...
//File.write(this.transfile, "");
- File.write(this.target, "");
+ if (this.target) {
+ File.write(this.target, "");
+ }
+
if (this.debugTarget) {
File.write(this.debugTarget, "");
}
print("MERGING LANGUAGE");
- File.write(this.target, "if (typeof(_T) == 'undefined') { _T={};}\n");
+ var out = "if (typeof(_T) == 'undefined') { _T={};}\n"
+ if (this.target) {
+ File.write(this.target, out);
+ } else {
+ this.out += out;
+ }
+
File.write(this.translateJSON, "");
if (File.exists(transmd5)) {
var str = File.read(transmd5);
if (str.length) {
- File.append(this.target, str + "\n");
+ if (this.target) {
+ File.append(this.target, str + "\n");
+ } else {
+ this.out += str + "\n";
+ }
+
}
if (this.cleanup) {
File.remove(transmd5);
var str = File.read(minfile);
print("using MIN FILE "+ minfile);
if (str.length) {
- File.append(this.target, str + "\n");
+ if (this.target) {
+ File.append(this.target, str + "\n");
+ } else {
+ this.out += str + "\n";
+ }
+
}
if (this.cleanup) {
File.remove(minfile);