1 |
|
2 |
|
3 |
|
4 |
|
5 | function main() {
|
6 | IO.include("lib/JSDOC.js");
|
7 | IO.includeDir("plugins/");
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | if (JSDOC.opt.c) {
|
13 | eval("JSDOC.conf = " + IO.readFile(JSDOC.opt.c));
|
14 |
|
15 | LOG.inform("Using configuration file at '"+JSDOC.opt.c+"'.");
|
16 |
|
17 | for (var c in JSDOC.conf) {
|
18 | if (c !== "D" && !defined(JSDOC.opt[c])) {
|
19 | JSDOC.opt[c] = JSDOC.conf[c];
|
20 | }
|
21 | }
|
22 |
|
23 | if (typeof JSDOC.conf["_"] != "undefined") {
|
24 | JSDOC.opt["_"] = JSDOC.opt["_"].concat(JSDOC.conf["_"]);
|
25 | }
|
26 |
|
27 | LOG.inform("With configuration: ");
|
28 | for (var o in JSDOC.opt) {
|
29 | LOG.inform(" "+o+": "+JSDOC.opt[o]);
|
30 | }
|
31 | }
|
32 |
|
33 |
|
34 | if (JSDOC.opt.v) LOG.verbose = true;
|
35 |
|
36 |
|
37 | if (JSDOC.opt.o) LOG.out = IO.open(JSDOC.opt.o);
|
38 |
|
39 |
|
40 | if (JSDOC.opt.T) {
|
41 | LOG.inform("JsDoc Toolkit running in test mode at "+new Date()+".");
|
42 | IO.include("frame/Testrun.js");
|
43 | IO.include("test.js");
|
44 | }
|
45 | else {
|
46 |
|
47 | if (!JSDOC.opt.t && System.getProperty("jsdoc.template.dir")) {
|
48 | JSDOC.opt.t = System.getProperty("jsdoc.template.dir");
|
49 | }
|
50 | if (JSDOC.opt.t && SYS.slash != JSDOC.opt.t.slice(-1)) {
|
51 | JSDOC.opt.t += SYS.slash;
|
52 | }
|
53 |
|
54 |
|
55 | LOG.inform("JsDoc Toolkit main() running at "+new Date()+".");
|
56 | LOG.inform("With options: ");
|
57 | for (var o in JSDOC.opt) {
|
58 | LOG.inform(" "+o+": "+JSDOC.opt[o]);
|
59 | }
|
60 |
|
61 |
|
62 | JSDOC.JsDoc();
|
63 |
|
64 |
|
65 | if (JSDOC.opt.Z) {
|
66 | LOG.warn("So you want to see the data structure, eh? This might hang if you have circular refs...");
|
67 | IO.include("frame/Dumper.js");
|
68 | var symbols = JSDOC.JsDoc.symbolSet.toArray();
|
69 | for (var i = 0, l = symbols.length; i < l; i++) {
|
70 | var symbol = symbols[i];
|
71 | print("// symbol: " + symbol.alias);
|
72 | print(symbol.serialize());
|
73 | }
|
74 | }
|
75 | else {
|
76 | if (typeof JSDOC.opt.t != "undefined") {
|
77 | try {
|
78 |
|
79 | load(JSDOC.opt.t+"publish.js");
|
80 |
|
81 |
|
82 | if (!publish) {
|
83 | LOG.warn("No publish() function is defined in that template so nothing to do.");
|
84 | }
|
85 | else {
|
86 |
|
87 | publish(JSDOC.JsDoc.symbolSet);
|
88 | }
|
89 | }
|
90 | catch(e) {
|
91 | LOG.warn("Sorry, that doesn't seem to be a valid template: "+JSDOC.opt.t+"publish.js : "+e);
|
92 | }
|
93 | }
|
94 | else {
|
95 | LOG.warn("No template given. Might as well read the usage notes.");
|
96 | JSDOC.usage();
|
97 | }
|
98 | }
|
99 | }
|
100 |
|
101 |
|
102 | if (!JSDOC.opt.q && LOG.warnings.length) {
|
103 | print(LOG.warnings.length+" warning"+(LOG.warnings.length != 1? "s":"")+".");
|
104 | }
|
105 |
|
106 |
|
107 | if (LOG.out) {
|
108 | LOG.out.flush();
|
109 | LOG.out.close();
|
110 | }
|
111 | } |
\ | No newline at end of file |