1 //<script type="text/javascript">
3 * Options management...
5 XObject = import.XObject.XObject;
6 File = import.File.File;
10 "baseDir" : '', // base directory -
11 "target" : '', // was d. ?? source directory (needed to put temporary files..)
12 "cacheDirectory" : '',
13 "conf" : '', // was c. - configuration file.. - parsed with JSON.parse
14 "template": '', // was t.
15 // "recurse": false, // was r. - not supported..
17 "publishExt" : 'html',
18 "private": '', // was p
19 "allfunctions": '', // was a
20 "encoding": '', // was e.
21 "nocode": '', // was n
23 "suppress": '', // was s ??? used?
24 "outputSource" : true,
25 "testmode": '', // was t
27 "verbose": '', // was v
28 "disablecache": '', // was C
29 "define" : [], // was D.
30 "handler" : [], // was H -- not supported..
32 warn : function(str) {
33 print("Warn: " +str );
35 inform : function(str) {
36 print("Inform: " +str );
38 close : function() { },
39 flush : function() { },
46 this.LOG.verbose = this.verbose;
50 XObject.extend(this, JSON.parse(File.read(this.conf)));;
54 if (!this.src.length) {
56 name: "ArgumentError",
57 message: "No source directories specified"
62 name: "ArgumentError",
63 message: "No template specified"
69 name: "ArgumentError",
70 message: "No directory specified"
75 name: "ArgumentError",
76 message: "No baseDir specified"
80 // should cacheDirectory be a subdirectory of target??
82 if (!this.cacheDirectory) {
84 name: "ArgumentError",
85 message: "No cacheDirectory specified"
91 * this might be nice as a standard bit of code..
94 parseArgv : function()
97 var args = Array.prototype.slice.call(Seed.argv);
99 args.shift(); // pack.js
106 for(var i =0; i < args.length;i++) {
107 if (args[i] == '-o') {
108 cfg.target = args[i+1];
112 if (args[i] == '-O') {
113 cfg.debugTarget = args[i+1];
117 if (args[i] == '-t') {
118 cfg.translateJSON = args[i+1];
122 if (args[i] == '-w') {
123 cfg.tmpDir = args[i+1];
127 if (args[i] == '-p') {
128 cfg.prefix = args[i+1];
133 if (args[i] == '-C') {
137 if (args[i] == '-f') {
138 cfg.srcfile = args[i+1];
142 if (cfg.files.indexOf(args[i]) > -1) {
143 continue; // remove dupes.
145 cfg.files.push(args[i]);