1 //<script type="text/javascript">
3 * Options management...
5 XObject = import.XObject.XObject;
6 File = import.File.File;
11 "src" : 'source directory'
12 "baseDir" : 'Base Directory (root directory of code)',
13 "target" : 'Target Directory (where html files go)',
14 "cacheDirectory": 'Cached Files Directory',
15 "conf" : 'Read From a Configuration file', // was c. - configuration file.. - parsed with JSON.parse
16 "template" : 'Template Directory', // was t.
17 // "recurse": false, // was r. - not supported..
18 "ext" : 'Extension of code files to read (normally js)', // was x.
19 "publishExt" : 'Extension of html files to write (normally html)',
20 //"private": '', // was p
21 //"allfunctions": '', // was a
22 //"encoding": '', // was e.
23 //"nocode": '', // was n
24 //"out": '', // was o.
25 //"suppress": '', // was s ??? used?
26 "outputSource" : 'Output the Source code to symbols/src/* (boolean)',
27 //"testmode": '', // was t
28 "help" : 'Show help', // was h
29 "verbose" : 'Show verbose messages', // was v
30 //"disablecache": '', // was C -- not needed? - see if cacheDirectory was set..
31 //"define" : [], // was D.
32 //"handler" : [], // was H -- not supported..
36 "baseDir" : '', // base directory -
37 "target" : '', // was d. ?? source directory (needed to put temporary files..)
38 "cacheDirectory" : '',
39 "conf" : '', // was c. - configuration file.. - parsed with JSON.parse
40 "template": '', // was t.
41 // "recurse": false, // was r. - not supported..
42 "ext": 'js', // was x.
43 "publishExt" : 'html',
44 "private": '', // was p
45 "allfunctions": '', // was a
46 "encoding": '', // was e.
47 "nocode": '', // was n
49 "suppress": '', // was s ??? used?
50 "outputSource" : true,
51 "testmode": '', // was t
53 "verbose": '', // was v
54 "disablecache": '', // was C
55 "define" : [], // was D.
56 "handler" : [], // was H -- not supported..
58 warn : function(str) {
59 print("Warn: " +str );
61 inform : function(str) {
62 print("Inform: " +str );
64 close : function() { },
65 flush : function() { },
72 this.LOG.verbose = this.verbose;
76 XObject.extend(this, JSON.parse(File.read(this.conf)));;
80 if (!this.src.length) {
82 name: "ArgumentError",
83 message: "No source directories specified"
88 name: "ArgumentError",
89 message: "No template specified"
95 name: "ArgumentError",
96 message: "No directory specified"
101 name: "ArgumentError",
102 message: "No baseDir specified"
106 // should cacheDirectory be a subdirectory of target??
108 if (!this.cacheDirectory) {
110 name: "ArgumentError",
111 message: "No cacheDirectory specified"
117 * this might be nice as a standard bit of code..
120 parseArgv : function()
123 var args = Array.prototype.slice.call(Seed.argv);
125 args.shift(); // pack.js
132 for(var i =0; i < args.length;i++) {
133 if (!args[i].match(/\-\-[a-z+]$/)) {
135 name: "ArgumentError",
136 message: "Unknown argument: " + args[i]
139 var a = arg[i].substring(2);
140 if (typeof(argTypes[a]) == 'undefined') {
142 name: "ArgumentError",
143 message: "Unknown argument: " + args[i]
147 if (typeof(this[a]) == 'string') {
152 if (typeof(this[a]) == 'boolean') {
153 if (['false', 'true'].indexOf(args[i+1]) < 0) {
155 name: "ArgumentError",
156 message: "Unknown value for : " + args[i] + ' : ' + args[i+1]
159 this[a] = args[i+1] == 'true';