1 //<script type="text/javascript">
3 * Options management...
5 XObject = import.XObject.XObject;
6 File = import.File.File;
11 "baseDir" : 'Base Directory (root directory of code)',
12 "target" : 'Target Directory (where html files go)',
13 "cacheDirectory": 'Cached Files Directory',
14 "conf" : 'Read From a Configuration file', // was c. - configuration file.. - parsed with JSON.parse
15 "template" : 'Template Directory', // was t.
16 // "recurse": false, // was r. - not supported..
17 "ext" : 'Extension of code files to read (normally js)', // was x.
18 "publishExt" : 'Extension of html files to write (normally html)',
19 //"private": '', // was p
20 //"allfunctions": '', // was a
21 //"encoding": '', // was e.
22 //"nocode": '', // was n
23 //"out": '', // was o.
24 //"suppress": '', // was s ??? used?
25 "outputSource" : 'Output the Source code to symbols/src/* (boolean)',
26 //"testmode": '', // was t
27 "help" : 'Show help', // was h
28 "verbose" : 'Show verbose messages', // was v
29 //"disablecache": '', // was C -- not needed?
30 "define" : [], // was D.
31 "handler" : [], // was H -- not supported..
35 "baseDir" : '', // base directory -
36 "target" : '', // was d. ?? source directory (needed to put temporary files..)
37 "cacheDirectory" : '',
38 "conf" : '', // was c. - configuration file.. - parsed with JSON.parse
39 "template": '', // was t.
40 // "recurse": false, // was r. - not supported..
41 "ext": 'js', // was x.
42 "publishExt" : 'html',
43 "private": '', // was p
44 "allfunctions": '', // was a
45 "encoding": '', // was e.
46 "nocode": '', // was n
48 "suppress": '', // was s ??? used?
49 "outputSource" : true,
50 "testmode": '', // was t
52 "verbose": '', // was v
53 "disablecache": '', // was C
54 "define" : [], // was D.
55 "handler" : [], // was H -- not supported..
57 warn : function(str) {
58 print("Warn: " +str );
60 inform : function(str) {
61 print("Inform: " +str );
63 close : function() { },
64 flush : function() { },
71 this.LOG.verbose = this.verbose;
75 XObject.extend(this, JSON.parse(File.read(this.conf)));;
79 if (!this.src.length) {
81 name: "ArgumentError",
82 message: "No source directories specified"
87 name: "ArgumentError",
88 message: "No template specified"
94 name: "ArgumentError",
95 message: "No directory specified"
100 name: "ArgumentError",
101 message: "No baseDir specified"
105 // should cacheDirectory be a subdirectory of target??
107 if (!this.cacheDirectory) {
109 name: "ArgumentError",
110 message: "No cacheDirectory specified"
116 * this might be nice as a standard bit of code..
119 parseArgv : function()
122 var args = Array.prototype.slice.call(Seed.argv);
124 args.shift(); // pack.js
131 for(var i =0; i < args.length;i++) {
132 if (args[i] == '-o') {
133 cfg.target = args[i+1];
137 if (args[i] == '-O') {
138 cfg.debugTarget = args[i+1];
142 if (args[i] == '-t') {
143 cfg.translateJSON = args[i+1];
147 if (args[i] == '-w') {
148 cfg.tmpDir = args[i+1];
152 if (args[i] == '-p') {
153 cfg.prefix = args[i+1];
158 if (args[i] == '-C') {
162 if (args[i] == '-f') {
163 cfg.srcfile = args[i+1];
167 if (cfg.files.indexOf(args[i]) > -1) {
168 continue; // remove dupes.
170 cfg.files.push(args[i]);