JSDOC/ScopeNamer.js
[app.jsdoc] / 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  * -k keepWhite - keeps the white space in the output files.
15
16  * 
17  * -m module name used with autoBuild to force a module name.
18  * -a autoBuild - puts target in INPUTDIR/compiled/MODULE-TIMESTAMP.js and enables translastion* 
19  * compresses files listed as arguments and outputs result
20  */
21  
22  
23 /**
24 * This file will not be documented..
25 * @ignore
26 */
27  
28 File            = imports.File.File;
29 Packer          = imports.JSDOC.Packer.Packer;
30
31
32
33   
34
35 var args = Array.prototype.slice.call(Seed.argv);
36 args.shift(); //seed
37 args.shift(); // pack.js
38 /** @private */
39 var cfg = {
40     files : [],
41     target : false,
42     srcfiles : [],
43     autoBuild : false,
44     keepWhite : false
45 }
46
47
48 for(var i =0; i < args.length;i++) {
49     if (args[i] == '-o') {
50         cfg.target = args[i+1];
51         i++;
52         continue;
53     }
54     if (args[i] == '-O') {
55         cfg.debugTarget = args[i+1];
56         i++;
57         continue;
58     }
59     if (args[i] == '-t') {
60         cfg.translateJSON = args[i+1];
61         i++;
62         continue;
63     }
64     if (args[i] == '-w') {
65         cfg.tmpDir = args[i+1];
66         i++;
67         continue;
68     }
69     if (args[i] == '-p') {
70         cfg.prefix = args[i+1];
71         i++;
72         continue;
73     }
74  
75     if (args[i] == '-C') {
76         cfg.cleanup = false;
77         continue;
78     }
79     if (args[i] == '-f') {
80         cfg.srcfiles.push(args[i+1]);
81         i++;
82         continue;
83     }
84     if (args[i] == '-m') {
85         cfg.module = args[i+1];
86         i++;
87         continue;
88     }
89     if (args[i] == '-a') {
90         cfg.autoBuild = true
91         continue;
92     }
93     if (args[i] == '-k') {
94         cfg.keepWhite = true
95         continue;
96     }
97     if (cfg.files.indexOf(args[i]) > -1) {
98         continue; // remove dupes.
99     }
100     cfg.files.push(args[i]);
101 }
102
103 var pack;
104
105 try {
106     pack = new Packer(cfg)
107 } catch (e) {
108     print("ERROR " + e.toString());
109     throw e;
110 }
111 if (!pack.target) {
112     print(pack.out);
113 }
114
115