Date.js
[gnome.introspection-doc-generator] / pack.js
1 #!/usr/bin/seed
2 //<script type="text/javascript">
3 /**
4  * packer command line
5  * 
6  * -o Output
7  * -O Output debug file here.
8  * -t Translate json file.
9  * -w Cache / working dir.
10  * -f File to read with a list of source paths / or class names.
11  * -C no cleanup (use with -w if you need are using a cache directory.)
12  * -p prefix for translation md5 generator (directory that files are in, and is removed 
13  *    from path when generating an md5 for the translated name.
14  * compresses files listed as arguments and outputs result
15  */
16  
17 File            = imports.File.File;
18 Packer          = imports.JSDOC.Packer.Packer;
19
20
21  
22   
23
24 var args = Array.prototype.slice.call(Seed.argv);
25 args.shift(); //seed
26 args.shift(); // pack.js
27 var cfg = {
28     files : [],
29     target : false,
30     srcfiles : []
31 }
32
33
34 for(var i =0; i < args.length;i++) {
35     if (args[i] == '-o') {
36         cfg.target = args[i+1];
37         i++;
38         continue;
39     }
40     if (args[i] == '-O') {
41         cfg.debugTarget = args[i+1];
42         i++;
43         continue;
44     }
45     if (args[i] == '-t') {
46         cfg.translateJSON = args[i+1];
47         i++;
48         continue;
49     }
50     if (args[i] == '-w') {
51         cfg.tmpDir = args[i+1];
52         i++;
53         continue;
54     }
55     if (args[i] == '-p') {
56         cfg.prefix = args[i+1];
57         i++;
58         continue;
59     }
60  
61     if (args[i] == '-C') {
62         cfg.cleanup = false;
63         continue;
64     }
65     if (args[i] == '-f') {
66         cfg.srcfiles.push(args[i+1]);
67         i++;
68         continue;
69     }
70     if (cfg.files.indexOf(args[i]) > -1) {
71         continue; // remove dupes.
72     }
73     cfg.files.push(args[i]);
74 }
75 var pack;
76 try {
77     pack = new Packer(cfg)
78 } catch (e) {
79     print("ERROR " + e.toString());
80     throw e;
81 }
82 if (!pack.target) {
83     print(pack.out);
84 }
85
86