/tags/jsdoc_toolkit-2.0.1/jsdoc-toolkit/app/main.js

http://jsdoc-toolkit.googlecode.com/ · JavaScript · 74 lines · 63 code · 8 blank · 3 comment · 20 complexity · ebfff31c768caafc073def1c3dbb1576 MD5 · raw file

  1. /**
  2. * @version $Id: main.js 570 2008-04-07 23:54:50Z micmath $
  3. */
  4. function main() {
  5. IO.include("lib/JSDOC.js");
  6. IO.includeDir("plugins/");
  7. if (JSDOC.opt.v) LOG.verbose = true;
  8. if (JSDOC.opt.o) LOG.out = IO.open(JSDOC.opt.o);
  9. if (JSDOC.opt.T) {
  10. LOG.inform("JsDoc Toolkit running in test mode at "+new Date()+".");
  11. IO.include("frame/Testrun.js");
  12. IO.include("test.js");
  13. }
  14. else {
  15. LOG.inform("JsDoc Toolkit main() running at "+new Date()+".");
  16. LOG.inform("With options: ");
  17. for (var o in JSDOC.opt) {
  18. LOG.inform(" "+o+": "+JSDOC.opt[o]);
  19. }
  20. var jsdoc = new JSDOC.JsDoc();
  21. if (JSDOC.opt.Z) { // secret debugging option
  22. LOG.warn("So you want to see the data structure, eh? This might hang if you have circular refs...");
  23. IO.include("frame/Dumper.js");
  24. var symbols = jsdoc.symbolSet.toArray();
  25. for (var i = 0, l = symbols.length; i < l; i++) {
  26. var symbol = symbols[i];
  27. print("// symbol: " + symbol.alias);
  28. print(symbol.serialize());
  29. }
  30. }
  31. else {
  32. var template = JSDOC.opt.t || System.getProperty("jsdoc.template.dir");
  33. var handler = jsdoc.symbolSet.handler;
  34. if (handler && handler.publish) {
  35. handler.publish(jsdoc.symbolSet);
  36. }
  37. else {
  38. if (typeof template != "undefined") {
  39. try {
  40. load(template+"/publish.js");
  41. if (!publish) {
  42. LOG.warn("No publish() function is defined in that template so nothing to do.");
  43. }
  44. else {
  45. publish(jsdoc.symbolSet);
  46. }
  47. }
  48. catch(e) {
  49. LOG.warn("Sorry, that doesn't seem to be a valid template: "+template+"/publish.js : "+e);
  50. }
  51. }
  52. else {
  53. LOG.warn("No template or handlers given. Might as well read the usage notes.");
  54. JSDOC.usage();
  55. }
  56. }
  57. }
  58. }
  59. if (LOG.warnings.length) {
  60. print(LOG.warnings.length+" warning"+(LOG.warnings.length != 1? "s":"")+".");
  61. }
  62. if (LOG.out) {
  63. LOG.out.flush();
  64. LOG.out.close();
  65. }
  66. }