JSDOC/Options.js
[gnome.introspection-doc-generator] / JSDOC / Options.js
1 //<script type="text/javascript">
2 /**
3  * Options management...
4  */
5 XObject = import.XObject.XObject;
6 File = import.File.File;
7
8 Options = {
9     
10     "src" : [],  // array of source directories..
11     "target" : '',   // was d. ?? source directory (needed to put temporary files..)
12     "cacheDirectory" : '',
13     "conf" : '',       // was c.
14     "template": '',   // was t.
15     // "recurse": false,   // was r. - not supported..
16     "ext": '',   // was x.
17     "publishExt" : 'html',
18     "private": '',   // was p
19     "allfunctions": '',   // was a
20     "encoding": '',   // was e.
21     "nocode": '',  // was n
22     "out": '',   // was o.
23     "suppress": '',  // was s
24     "testmode": '',  // was t
25     "help": '',   // was h
26     "verbose": '',   // was v
27     "disablecache": '',   // was C
28     "define" : [],   // was D.
29     "handler" : [],  // was H -- not supported..
30     LOG : {
31         warn : function(str) {
32             print("Warn: " +str );
33         },
34         inform : function(str) {
35             print("Inform: " +str );
36         },
37         close : function() { },
38         flush : function() { },
39         out: false,
40         warnings : [],
41         verbose : false    
42     },
43     init : function()
44     {
45         this.LOG.verbose = this.verbose;
46         
47         
48         if (this.conf) {
49             XObject.extend(this, JSON.parse(File.read(this.conf)));;
50         }
51         // help ?? -- usage..
52         
53         if (!this.src.length) {
54             throw {
55                 name: "ArgumentError", 
56                 message: "No source directories specified" 
57             };
58         }
59         if (!this.template) {
60             throw {
61                 name: "ArgumentError", 
62                 message: "No template specified" 
63             };
64         }
65          
66         if (!this.target) {
67             throw {
68                 name: "ArgumentError", 
69                 message: "No directory specified" 
70             };
71         }
72         // should cacheDirectory be a subdirectory of target??
73         // if not set..
74         if (!this.cacheDirectory) {
75             throw {
76                 name: "ArgumentError", 
77                 message: "No cacheDirectory specified" 
78             };
79         }
80         
81     }
82 }