author | Lennard de Rijk <ljvderijk@gmail.com> |
Sun, 25 Oct 2009 18:45:58 -0700 | |
changeset 3052 | 6907a33ca0a2 |
parent 3041 | c8f47f0b6697 |
permissions | -rw-r--r-- |
3041
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
1 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
2 |
* @fileOverview |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
3 |
* A bootstrap script that creates some basic required objects |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
4 |
* for loading other scripts. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
5 |
* @author Michael Mathews, micmath@gmail.com |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
6 |
* @version $Id: run.js 756 2009-01-07 21:32:58Z micmath $ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
7 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
8 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
9 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
10 |
* @namespace Keep track of any messages from the running script. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
11 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
12 |
LOG = { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
13 |
warn: function(msg, e) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
14 |
if (JSDOC.opt.q) return; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
15 |
if (e) msg = e.fileName+", line "+e.lineNumber+": "+msg; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
16 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
17 |
msg = ">> WARNING: "+msg; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
18 |
LOG.warnings.push(msg); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
19 |
if (LOG.out) LOG.out.write(msg+"\n"); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
20 |
else print(msg); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
21 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
22 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
23 |
inform: function(msg) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
24 |
if (JSDOC.opt.q) return; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
25 |
msg = " > "+msg; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
26 |
if (LOG.out) LOG.out.write(msg+"\n"); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
27 |
else if (typeof LOG.verbose != "undefined" && LOG.verbose) print(msg); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
28 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
29 |
}; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
30 |
LOG.warnings = []; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
31 |
LOG.verbose = false |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
32 |
LOG.out = undefined; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
33 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
34 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
35 |
* @class Manipulate a filepath. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
36 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
37 |
function FilePath(absPath, separator) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
38 |
this.slash = separator || "/"; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
39 |
this.root = this.slash; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
40 |
this.path = []; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
41 |
this.file = ""; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
42 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
43 |
var parts = absPath.split(/[\\\/]/); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
44 |
if (parts) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
45 |
if (parts.length) this.root = parts.shift() + this.slash; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
46 |
if (parts.length) this.file = parts.pop() |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
47 |
if (parts.length) this.path = parts; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
48 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
49 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
50 |
this.path = this.resolvePath(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
51 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
52 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
53 |
/** Collapse any dot-dot or dot items in a filepath. */ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
54 |
FilePath.prototype.resolvePath = function() { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
55 |
var resolvedPath = []; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
56 |
for (var i = 0; i < this.path.length; i++) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
57 |
if (this.path[i] == "..") resolvedPath.pop(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
58 |
else if (this.path[i] != ".") resolvedPath.push(this.path[i]); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
59 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
60 |
return resolvedPath; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
61 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
62 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
63 |
/** Trim off the filename. */ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
64 |
FilePath.prototype.toDir = function() { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
65 |
if (this.file) this.file = ""; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
66 |
return this; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
67 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
68 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
69 |
/** Go up a directory. */ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
70 |
FilePath.prototype.upDir = function() { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
71 |
this.toDir(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
72 |
if (this.path.length) this.path.pop(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
73 |
return this; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
74 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
75 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
76 |
FilePath.prototype.toString = function() { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
77 |
return this.root |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
78 |
+ this.path.join(this.slash) |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
79 |
+ ((this.path.length > 0)? this.slash : "") |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
80 |
+ this.file; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
81 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
82 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
83 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
84 |
* Turn a path into just the name of the file. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
85 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
86 |
FilePath.fileName = function(path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
87 |
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
88 |
return path.substring(nameStart); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
89 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
90 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
91 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
92 |
* Get the extension of a filename |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
93 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
94 |
FilePath.fileExtension = function(filename) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
95 |
return filename.split(".").pop().toLowerCase(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
96 |
}; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
97 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
98 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
99 |
* Turn a path into just the directory part. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
100 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
101 |
FilePath.dir = function(path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
102 |
var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
103 |
return path.substring(0, nameStart-1); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
104 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
105 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
106 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
107 |
importClass(java.lang.System); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
108 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
109 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
110 |
* @namespace A collection of information about your system. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
111 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
112 |
SYS = { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
113 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
114 |
* Information about your operating system: arch, name, version. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
115 |
* @type string |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
116 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
117 |
os: [ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
118 |
new String(System.getProperty("os.arch")), |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
119 |
new String(System.getProperty("os.name")), |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
120 |
new String(System.getProperty("os.version")) |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
121 |
].join(", "), |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
122 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
123 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
124 |
* Which way does your slash lean. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
125 |
* @type string |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
126 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
127 |
slash: System.getProperty("file.separator")||"/", |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
128 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
129 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
130 |
* The path to the working directory where you ran java. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
131 |
* @type string |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
132 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
133 |
userDir: new String(System.getProperty("user.dir")), |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
134 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
135 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
136 |
* Where is Java's home folder. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
137 |
* @type string |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
138 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
139 |
javaHome: new String(System.getProperty("java.home")), |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
140 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
141 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
142 |
* The absolute path to the directory containing this script. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
143 |
* @type string |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
144 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
145 |
pwd: undefined |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
146 |
}; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
147 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
148 |
// jsrun appends an argument, with the path to here. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
149 |
if (arguments[arguments.length-1].match(/^-j=(.+)/)) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
150 |
if (RegExp.$1.charAt(0) == SYS.slash || RegExp.$1.charAt(1) == ":") { // absolute path to here |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
151 |
SYS.pwd = new FilePath(RegExp.$1).toDir().toString(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
152 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
153 |
else { // relative path to here |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
154 |
SYS.pwd = new FilePath(SYS.userDir + SYS.slash + RegExp.$1).toDir().toString(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
155 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
156 |
arguments.pop(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
157 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
158 |
else { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
159 |
print("The run.js script requires you use jsrun.jar."); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
160 |
quit(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
161 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
162 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
163 |
// shortcut |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
164 |
var File = Packages.java.io.File; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
165 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
166 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
167 |
* @namespace A collection of functions that deal with reading a writing to disk. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
168 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
169 |
IO = { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
170 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
171 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
172 |
* Create a new file in the given directory, with the given name and contents. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
173 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
174 |
saveFile: function(/**string*/ outDir, /**string*/ fileName, /**string*/ content) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
175 |
var out = new Packages.java.io.PrintWriter( |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
176 |
new Packages.java.io.OutputStreamWriter( |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
177 |
new Packages.java.io.FileOutputStream(outDir+SYS.slash+fileName), |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
178 |
IO.encoding |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
179 |
) |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
180 |
); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
181 |
out.write(content); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
182 |
out.flush(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
183 |
out.close(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
184 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
185 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
186 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
187 |
* @type string |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
188 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
189 |
readFile: function(/**string*/ path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
190 |
if (!IO.exists(path)) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
191 |
throw "File doesn't exist there: "+path; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
192 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
193 |
return readFile(path, IO.encoding); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
194 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
195 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
196 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
197 |
* @param inFile |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
198 |
* @param outDir |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
199 |
* @param [fileName=The original filename] |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
200 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
201 |
copyFile: function(/**string*/ inFile, /**string*/ outDir, /**string*/ fileName) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
202 |
if (fileName == null) fileName = FilePath.fileName(inFile); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
203 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
204 |
var inFile = new File(inFile); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
205 |
var outFile = new File(outDir+SYS.slash+fileName); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
206 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
207 |
var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
208 |
var bos = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outFile), 4096); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
209 |
var theChar; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
210 |
while ((theChar = bis.read()) != -1) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
211 |
bos.write(theChar); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
212 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
213 |
bos.close(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
214 |
bis.close(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
215 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
216 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
217 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
218 |
* Creates a series of nested directories. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
219 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
220 |
mkPath: function(/**Array*/ path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
221 |
if (path.constructor != Array) path = path.split(/[\\\/]/); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
222 |
var make = ""; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
223 |
for (var i = 0, l = path.length; i < l; i++) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
224 |
make += path[i] + SYS.slash; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
225 |
if (! IO.exists(make)) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
226 |
IO.makeDir(make); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
227 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
228 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
229 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
230 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
231 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
232 |
* Creates a directory at the given path. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
233 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
234 |
makeDir: function(/**string*/ path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
235 |
(new File(path)).mkdir(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
236 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
237 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
238 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
239 |
* @type string[] |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
240 |
* @param dir The starting directory to look in. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
241 |
* @param [recurse=1] How many levels deep to scan. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
242 |
* @returns An array of all the paths to files in the given dir. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
243 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
244 |
ls: function(/**string*/ dir, /**number*/ recurse, _allFiles, _path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
245 |
if (_path === undefined) { // initially |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
246 |
var _allFiles = []; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
247 |
var _path = [dir]; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
248 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
249 |
if (_path.length == 0) return _allFiles; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
250 |
if (recurse === undefined) recurse = 1; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
251 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
252 |
dir = new File(dir); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
253 |
if (!dir.directory) return [String(dir)]; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
254 |
var files = dir.list(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
255 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
256 |
for (var f = 0; f < files.length; f++) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
257 |
var file = String(files[f]); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
258 |
if (file.match(/^\.[^\.\/\\]/)) continue; // skip dot files |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
259 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
260 |
if ((new File(_path.join(SYS.slash)+SYS.slash+file)).list()) { // it's a directory |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
261 |
_path.push(file); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
262 |
if (_path.length-1 < recurse) IO.ls(_path.join(SYS.slash), recurse, _allFiles, _path); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
263 |
_path.pop(); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
264 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
265 |
else { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
266 |
_allFiles.push((_path.join(SYS.slash)+SYS.slash+file).replace(SYS.slash+SYS.slash, SYS.slash)); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
267 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
268 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
269 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
270 |
return _allFiles; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
271 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
272 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
273 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
274 |
* @type boolean |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
275 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
276 |
exists: function(/**string*/ path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
277 |
file = new File(path); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
278 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
279 |
if (file.isDirectory()){ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
280 |
return true; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
281 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
282 |
if (!file.exists()){ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
283 |
return false; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
284 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
285 |
if (!file.canRead()){ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
286 |
return false; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
287 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
288 |
return true; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
289 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
290 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
291 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
292 |
* |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
293 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
294 |
open: function(/**string*/ path, /**string*/ append) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
295 |
var append = true; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
296 |
var outFile = new File(path); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
297 |
var out = new Packages.java.io.PrintWriter( |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
298 |
new Packages.java.io.OutputStreamWriter( |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
299 |
new Packages.java.io.FileOutputStream(outFile, append), |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
300 |
IO.encoding |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
301 |
) |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
302 |
); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
303 |
return out; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
304 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
305 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
306 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
307 |
* Sets {@link IO.encoding}. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
308 |
* Encoding is used when reading and writing text to files, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
309 |
* and in the meta tags of HTML output. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
310 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
311 |
setEncoding: function(/**string*/ encoding) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
312 |
if (/ISO-8859-([0-9]+)/i.test(encoding)) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
313 |
IO.encoding = "ISO8859_"+RegExp.$1; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
314 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
315 |
else { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
316 |
IO.encoding = encoding; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
317 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
318 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
319 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
320 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
321 |
* @default "utf-8" |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
322 |
* @private |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
323 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
324 |
encoding: "utf-8", |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
325 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
326 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
327 |
* Load the given script. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
328 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
329 |
include: function(relativePath) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
330 |
load(SYS.pwd+relativePath); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
331 |
}, |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
332 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
333 |
/** |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
334 |
* Loads all scripts from the given directory path. |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
335 |
*/ |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
336 |
includeDir: function(path) { |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
337 |
if (!path) return; |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
338 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
339 |
for (var lib = IO.ls(SYS.pwd+path), i = 0; i < lib.length; i++) |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
340 |
if (/\.js$/i.test(lib[i])) load(lib[i]); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
341 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
342 |
} |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
343 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
344 |
// now run the application |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
345 |
IO.include("frame.js"); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
346 |
IO.include("main.js"); |
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
347 |
|
c8f47f0b6697
JSDocToolkit 2.3.0 added to create documentation for JS files.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff
changeset
|
348 |
main(); |