1 //<script type="text/javascript">
3 * Options management...
5 XObject = import.XObject.XObject;
6 File = import.File.File;
10 "--help" : 'Show help', // was h
11 "help": false, // was h;se
13 // options get defined like this..
14 "--src" : "source directory (either absolute - starts with "/" or relative " +
15 "- without, in which case it's added to baseDir"
16 "--baseDir" : 'Base Directory (root directory of code)',
17 "--target" : 'Target Directory (where html files go)',
18 "--cacheDirectory": 'Cached Files Directory',
19 "--conf" : 'Read From a Configuration file', // was c. - configuration file.. - parsed with JSON.parse
20 "--template" : 'Template Directory', // was t.
21 // "recurse": false, // was r. - not supported..
22 "--ext" : 'Extension of code files to read (normally js)', // was x.
23 "--publishExt" : 'Extension of html files to write (normally html)',
24 //"private": '', // was p
25 //"allfunctions": '', // was a
26 //"encoding": '', // was e.
27 //"nocode": '', // was n
28 //"out": '', // was o.
29 //"suppress": '', // was s ??? used?
30 "--outputSource" : 'Output the Source code to symbols/src/* (boolean)',
31 //"testmode": '', // was t
33 "--verbose" : 'Show verbose messages', // was v
34 //"disablecache": '', // was C -- not needed? - see if cacheDirectory was set..
35 //"define" : [], // was D.
36 //"handler" : [], // was H -- not supported..
39 // and now the defaults.. (which type can be infered from..)
41 "baseDir" : '', // base directory -
42 "target" : '', // was d. ?? source directory (needed to put temporary files..)
43 "cacheDirectory" : '',
44 "conf" : '', // was c. - configuration file.. - parsed with JSON.parse
45 "template": '', // was t.
46 // "recurse": false, // was r. - not supported..
47 "ext": 'js', // was x.
48 "publishExt" : 'html',
49 "private": '', // was p
50 "allfunctions": '', // was a
51 "encoding": '', // was e.
52 "nocode": '', // was n
54 "suppress": '', // was s ??? used?
55 "outputSource" : true,
56 "testmode": '', // was t
58 "verbose": '', // was v
59 "disablecache": '', // was C
60 "define" : [], // was D.
61 "handler" : [], // was H -- not supported..
63 warn : function(str) {
64 print("Warn: " +str );
66 inform : function(str) {
67 print("Inform: " +str );
69 close : function() { },
70 flush : function() { },
83 // the reset of this is specific to JSDOC - and can not be moved to a generic handler..
86 this.LOG.verbose = this.verbose;
88 // this is most likely to come from the command line..
90 XObject.extend(this, JSON.parse(File.read(this.conf)));;
95 name: "ArgumentError",
96 message: "No baseDir specified"
99 if (!this.src.length) {
101 name: "ArgumentError",
102 message: "No source directories specified"
105 // append full path to source directories.
107 this.src.forEach(function(v, i) {
109 this.src[i] = _this.baseDir + '/' + v;
111 if (File.isDirectory(this.src[i])) {
113 name: "ArgumentError",
114 message: "invalid Source Directory : " + v;
120 if (!this.template) {
122 name: "ArgumentError",
123 message: "No template Directory specified"
129 name: "ArgumentError",
130 message: "No directory specified"
135 // should cacheDirectory be a subdirectory of target??
137 //if (!this.cacheDirectory) {
139 // name: "ArgumentError",
140 // message: "No cacheDirectory specified"
146 * this might be nice as a standard bit of code..
149 parseArgv : function()
152 var args = Array.prototype.slice.call(Seed.argv);
154 args.shift(); // pack.js
156 for(var i =0; i < args.length;i++) {
157 if (args[i].substring(0,2) != '--') {
160 name: "ArgumentError",
161 message: "Unknown argument: " + args[i]
164 var a = arg[i].substring(2);
165 if (typeof(argTypes[arg[i]]) == 'undefined') {
167 name: "ArgumentError",
168 message: "Unknown argument: " + args[i]
172 if (typeof(this[a]) == 'string') {
177 if (typeof(this[a]) == 'boolean') {
178 if (['false', 'true'].indexOf(args[i+1]) < 0) {
180 name: "ArgumentError",
181 message: "Unknown value for : " + args[i] + ' : ' + args[i+1]
184 this[a] = args[i+1] == 'true';
188 if (typeof(this[a]) == 'object') { // tecnically an array.
190 while(i < args.length)
192 if (args[i].substring(0,2) != '--'){
196 this[a].push(args[i]);
201 name: "ArgumentError",
202 message: "Do not know how to handle: " + a
212 print (""Usage seed jsdocbulid.js /var/www/seed [Gtk] \n": ");
214 if (i.substring(0,2) != '--') {
217 print( i + ' ARG : ' + this[i]);