1 //<script type="text/javascript">
3 * Options management...
5 XObject = import.XObject.XObject;
6 File = import.File.File;
11 "src" : "source directory (either absolute - starts with "/" or relative " +
12 "- without, in which case it's added to baseDir"
13 "baseDir" : 'Base Directory (root directory of code)',
14 "target" : 'Target Directory (where html files go)',
15 "cacheDirectory": 'Cached Files Directory',
16 "conf" : 'Read From a Configuration file', // was c. - configuration file.. - parsed with JSON.parse
17 "template" : 'Template Directory', // was t.
18 // "recurse": false, // was r. - not supported..
19 "ext" : 'Extension of code files to read (normally js)', // was x.
20 "publishExt" : 'Extension of html files to write (normally html)',
21 //"private": '', // was p
22 //"allfunctions": '', // was a
23 //"encoding": '', // was e.
24 //"nocode": '', // was n
25 //"out": '', // was o.
26 //"suppress": '', // was s ??? used?
27 "outputSource" : 'Output the Source code to symbols/src/* (boolean)',
28 //"testmode": '', // was t
29 "help" : 'Show help', // was h
30 "verbose" : 'Show verbose messages', // was v
31 //"disablecache": '', // was C -- not needed? - see if cacheDirectory was set..
32 //"define" : [], // was D.
33 //"handler" : [], // was H -- not supported..
37 "baseDir" : '', // base directory -
38 "target" : '', // was d. ?? source directory (needed to put temporary files..)
39 "cacheDirectory" : '',
40 "conf" : '', // was c. - configuration file.. - parsed with JSON.parse
41 "template": '', // was t.
42 // "recurse": false, // was r. - not supported..
43 "ext": 'js', // was x.
44 "publishExt" : 'html',
45 "private": '', // was p
46 "allfunctions": '', // was a
47 "encoding": '', // was e.
48 "nocode": '', // was n
50 "suppress": '', // was s ??? used?
51 "outputSource" : true,
52 "testmode": '', // was t
54 "verbose": '', // was v
55 "disablecache": '', // was C
56 "define" : [], // was D.
57 "handler" : [], // was H -- not supported..
59 warn : function(str) {
60 print("Warn: " +str );
62 inform : function(str) {
63 print("Inform: " +str );
65 close : function() { },
66 flush : function() { },
73 this.LOG.verbose = this.verbose;
77 XObject.extend(this, JSON.parse(File.read(this.conf)));;
81 if (!this.src.length) {
83 name: "ArgumentError",
84 message: "No source directories specified"
89 name: "ArgumentError",
90 message: "No template specified"
96 name: "ArgumentError",
97 message: "No directory specified"
102 name: "ArgumentError",
103 message: "No baseDir specified"
107 // should cacheDirectory be a subdirectory of target??
109 if (!this.cacheDirectory) {
111 name: "ArgumentError",
112 message: "No cacheDirectory specified"
118 * this might be nice as a standard bit of code..
121 parseArgv : function()
124 var args = Array.prototype.slice.call(Seed.argv);
126 args.shift(); // pack.js
133 for(var i =0; i < args.length;i++) {
134 if (!args[i].match(/\-\-[a-z+]$/)) {
136 name: "ArgumentError",
137 message: "Unknown argument: " + args[i]
140 var a = arg[i].substring(2);
141 if (typeof(argTypes[a]) == 'undefined') {
143 name: "ArgumentError",
144 message: "Unknown argument: " + args[i]
148 if (typeof(this[a]) == 'string') {
153 if (typeof(this[a]) == 'boolean') {
154 if (['false', 'true'].indexOf(args[i+1]) < 0) {
156 name: "ArgumentError",
157 message: "Unknown value for : " + args[i] + ' : ' + args[i+1]
160 this[a] = args[i+1] == 'true';