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     "baseDir" :  '',  // base directory - 
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 ??? used?
24     "outputSource" : true,
25     "testmode": '',  // was t
26     "help": '',   // was h
27     "verbose": '',   // was v
28     "disablecache": '',   // was C
29     "define" : [],   // was D.
30     "handler" : [],  // was H -- not supported..
31     LOG : {
32         warn : function(str) {
33             print("Warn: " +str );
34         },
35         inform : function(str) {
36             print("Inform: " +str );
37         },
38         close : function() { },
39         flush : function() { },
40         out: false,
41         warnings : [],
42         verbose : false    
43     },
44     init : function()
45     {
46         this.LOG.verbose = this.verbose;
47         
48         
49         if (this.conf) {
50             XObject.extend(this, JSON.parse(File.read(this.conf)));;
51         }
52         // help ?? -- usage..
53         
54         if (!this.src.length) {
55             throw {
56                 name: "ArgumentError", 
57                 message: "No source directories specified" 
58             };
59         }
60         if (!this.template) {
61             throw {
62                 name: "ArgumentError", 
63                 message: "No template specified" 
64             };
65         }
66          
67         if (!this.target) {
68             throw {
69                 name: "ArgumentError", 
70                 message: "No directory specified" 
71             };
72         }
73         f (!this.baseDir) {
74             throw {
75                 name: "ArgumentError", 
76                 message: "No cacheDirectory specified" 
77             };
78         }
79         
80         // should cacheDirectory be a subdirectory of target??
81         // if not set..
82         if (!this.cacheDirectory) {
83             throw {
84                 name: "ArgumentError", 
85                 message: "No cacheDirectory specified" 
86             };
87         }
88         
89     }
90 }