2 * @version $Id: main.js 818 2009-11-08 14:51:41Z micmath $
6 IO
.include("lib/JSDOC.js");
7 IO
.includeDir("plugins/");
11 // the -c option: options are defined in a configuration file
13 eval("JSDOC.conf = " + IO
.readFile(JSDOC
.opt
.c
));
15 LOG
.inform("Using configuration file at '"+JSDOC
.opt
.c
+"'.");
17 for (var c
in JSDOC
.conf
) {
18 if (c
!== "D" && !defined(JSDOC
.opt
[c
])) { // commandline overrules config file
19 JSDOC
.opt
[c
] = JSDOC
.conf
[c
];
23 if (typeof JSDOC
.conf
["_"] != "undefined") {
24 JSDOC
.opt
["_"] = JSDOC
.opt
["_"].concat(JSDOC
.conf
["_"]);
27 LOG
.inform("With configuration: ");
28 for (var o
in JSDOC
.opt
) {
29 LOG
.inform(" "+o
+": "+JSDOC
.opt
[o
]);
34 if (JSDOC
.opt
.v
) LOG
.verbose
= true;
36 // send log messages to a file
37 if (JSDOC
.opt
.o
) LOG
.out
= IO
.open(JSDOC
.opt
.o
);
41 LOG
.inform("JsDoc Toolkit running in test mode at "+new Date()+".");
42 IO
.include("frame/Testrun.js");
43 IO
.include("test.js");
46 // a template must be defined and must be a directory path
47 if (!JSDOC
.opt
.t
&& System
.getProperty("jsdoc.template.dir")) {
48 JSDOC
.opt
.t
= System
.getProperty("jsdoc.template.dir");
50 if (JSDOC
.opt
.t
&& SYS
.slash
!= JSDOC
.opt
.t
.slice(-1)) {
51 JSDOC
.opt
.t
+= SYS
.slash
;
54 // verbose messages about the options we were given
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
]);
61 // initialize and build a symbolSet from your code
64 // debugger's option: dump the entire symbolSet produced from your code
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());
76 if (typeof JSDOC
.opt
.t
!= "undefined") {
78 // a file named "publish.js" must exist in the template directory
79 load(JSDOC
.opt
.t
+"publish.js");
81 // and must define a function named "publish"
83 LOG
.warn("No publish() function is defined in that template so nothing to do.");
86 // which will be called with the symbolSet produced from your code
87 publish(JSDOC
.JsDoc
.symbolSet
);
91 LOG
.warn("Sorry, that doesn't seem to be a valid template: "+JSDOC
.opt
.t
+"publish.js : "+e
);
95 LOG
.warn("No template given. Might as well read the usage notes.");
101 // notify of any warnings
102 if (!JSDOC
.opt
.q
&& LOG
.warnings
.length
) {
103 print(LOG
.warnings
.length
+" warning"+(LOG
.warnings
.length
!= 1? "s":"")+".");
106 // stop sending log messages to a file