quentonc-jsdoc_helper 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. data/History.txt +13 -0
  2. data/README.rdoc +64 -0
  3. data/Rakefile +46 -0
  4. data/TODO.rdoc +5 -0
  5. data/bin/jsdoc_helper +8 -0
  6. data/ext/jsdoc-toolkit/README.txt +146 -0
  7. data/ext/jsdoc-toolkit/app/frame/Chain.js +102 -0
  8. data/ext/jsdoc-toolkit/app/frame/Dumper.js +144 -0
  9. data/ext/jsdoc-toolkit/app/frame/Hash.js +84 -0
  10. data/ext/jsdoc-toolkit/app/frame/Link.js +148 -0
  11. data/ext/jsdoc-toolkit/app/frame/Namespace.js +10 -0
  12. data/ext/jsdoc-toolkit/app/frame/Opt.js +134 -0
  13. data/ext/jsdoc-toolkit/app/frame/Reflection.js +26 -0
  14. data/ext/jsdoc-toolkit/app/frame/String.js +93 -0
  15. data/ext/jsdoc-toolkit/app/frame/Testrun.js +129 -0
  16. data/ext/jsdoc-toolkit/app/frame.js +33 -0
  17. data/ext/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
  18. data/ext/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
  19. data/ext/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
  20. data/ext/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
  21. data/ext/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
  22. data/ext/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +200 -0
  23. data/ext/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
  24. data/ext/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
  25. data/ext/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
  26. data/ext/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
  27. data/ext/jsdoc-toolkit/app/lib/JSDOC/Parser.js +107 -0
  28. data/ext/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
  29. data/ext/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +643 -0
  30. data/ext/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +229 -0
  31. data/ext/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
  32. data/ext/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
  33. data/ext/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
  34. data/ext/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
  35. data/ext/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
  36. data/ext/jsdoc-toolkit/app/lib/JSDOC/Walker.js +459 -0
  37. data/ext/jsdoc-toolkit/app/lib/JSDOC.js +101 -0
  38. data/ext/jsdoc-toolkit/app/main.js +111 -0
  39. data/ext/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
  40. data/ext/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
  41. data/ext/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
  42. data/ext/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
  43. data/ext/jsdoc-toolkit/app/plugins/symbolLink.js +9 -0
  44. data/ext/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
  45. data/ext/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
  46. data/ext/jsdoc-toolkit/app/run.js +348 -0
  47. data/ext/jsdoc-toolkit/app/t/TestDoc.js +144 -0
  48. data/ext/jsdoc-toolkit/app/t/runner.js +13 -0
  49. data/ext/jsdoc-toolkit/app/test/addon.js +24 -0
  50. data/ext/jsdoc-toolkit/app/test/anon_inner.js +14 -0
  51. data/ext/jsdoc-toolkit/app/test/augments.js +31 -0
  52. data/ext/jsdoc-toolkit/app/test/augments2.js +26 -0
  53. data/ext/jsdoc-toolkit/app/test/borrows.js +41 -0
  54. data/ext/jsdoc-toolkit/app/test/borrows2.js +23 -0
  55. data/ext/jsdoc-toolkit/app/test/config.js +22 -0
  56. data/ext/jsdoc-toolkit/app/test/constructs.js +18 -0
  57. data/ext/jsdoc-toolkit/app/test/encoding.js +10 -0
  58. data/ext/jsdoc-toolkit/app/test/encoding_other.js +12 -0
  59. data/ext/jsdoc-toolkit/app/test/event.js +54 -0
  60. data/ext/jsdoc-toolkit/app/test/functions_anon.js +39 -0
  61. data/ext/jsdoc-toolkit/app/test/functions_nested.js +33 -0
  62. data/ext/jsdoc-toolkit/app/test/global.js +13 -0
  63. data/ext/jsdoc-toolkit/app/test/globals.js +25 -0
  64. data/ext/jsdoc-toolkit/app/test/ignore.js +10 -0
  65. data/ext/jsdoc-toolkit/app/test/inner.js +16 -0
  66. data/ext/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
  67. data/ext/jsdoc-toolkit/app/test/lend.js +33 -0
  68. data/ext/jsdoc-toolkit/app/test/memberof.js +19 -0
  69. data/ext/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
  70. data/ext/jsdoc-toolkit/app/test/name.js +19 -0
  71. data/ext/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
  72. data/ext/jsdoc-toolkit/app/test/nocode.js +13 -0
  73. data/ext/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
  74. data/ext/jsdoc-toolkit/app/test/overview.js +20 -0
  75. data/ext/jsdoc-toolkit/app/test/param_inline.js +37 -0
  76. data/ext/jsdoc-toolkit/app/test/params_optional.js +8 -0
  77. data/ext/jsdoc-toolkit/app/test/prototype.js +17 -0
  78. data/ext/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
  79. data/ext/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
  80. data/ext/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
  81. data/ext/jsdoc-toolkit/app/test/public.js +10 -0
  82. data/ext/jsdoc-toolkit/app/test/shared.js +42 -0
  83. data/ext/jsdoc-toolkit/app/test/shared2.js +2 -0
  84. data/ext/jsdoc-toolkit/app/test/shortcuts.js +22 -0
  85. data/ext/jsdoc-toolkit/app/test/static_this.js +13 -0
  86. data/ext/jsdoc-toolkit/app/test/synonyms.js +31 -0
  87. data/ext/jsdoc-toolkit/app/test/tosource.js +23 -0
  88. data/ext/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
  89. data/ext/jsdoc-toolkit/app/test.js +307 -0
  90. data/ext/jsdoc-toolkit/changes.txt +75 -0
  91. data/ext/jsdoc-toolkit/conf/sample.conf +31 -0
  92. data/ext/jsdoc-toolkit/java/build.xml +36 -0
  93. data/ext/jsdoc-toolkit/java/build_1.4.xml +36 -0
  94. data/ext/jsdoc-toolkit/java/classes/js.jar +0 -0
  95. data/ext/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
  96. data/ext/jsdoc-toolkit/java/src/JsRun.java +21 -0
  97. data/ext/jsdoc-toolkit/jsdebug.jar +0 -0
  98. data/ext/jsdoc-toolkit/jsrun.jar +0 -0
  99. data/ext/jsdoc-toolkit/out/jsdoc/files.html +216 -0
  100. data/ext/jsdoc-toolkit/out/jsdoc/index.html +210 -0
  101. data/ext/jsdoc-toolkit/out/jsdoc/symbols/_global_.html +306 -0
  102. data/ext/jsdoc-toolkit/out/jsdoc/symbols/src/lib_test.js.html +13 -0
  103. data/ext/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
  104. data/ext/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
  105. data/ext/jsdoc-toolkit/templates/jsdoc/class.tmpl +646 -0
  106. data/ext/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
  107. data/ext/jsdoc-toolkit/templates/jsdoc/publish.js +184 -0
  108. data/ext/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
  109. data/ext/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
  110. data/ext/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
  111. data/ext/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
  112. data/features/doing_rake_jsdoc.feature +74 -0
  113. data/features/step_definitions/jsdoc_helper_steps.rb +48 -0
  114. data/features/support/env.rb +11 -0
  115. data/features/support/file_helper.rb +68 -0
  116. data/features/writing_the_rakefile.feature +36 -0
  117. data/jsdoc_helper.gemspec +41 -0
  118. data/lib/jsdoc_helper/rake/task/runner.rb +85 -0
  119. data/lib/jsdoc_helper/rake/task.rb +43 -0
  120. data/lib/jsdoc_helper.rb +50 -0
  121. data/spec/jsdoc_helper/jsdoc_helper_spec.rb +4 -0
  122. data/spec/jsdoc_helper/rake/task/runner_spec.rb +45 -0
  123. data/spec/jsdoc_helper/support/file_helper_spec.rb +93 -0
  124. data/spec/spec_helper.rb +25 -0
  125. data/test/ext/jsdoc-toolkit/README.txt +146 -0
  126. data/test/ext/jsdoc-toolkit/app/frame/Chain.js +102 -0
  127. data/test/ext/jsdoc-toolkit/app/frame/Dumper.js +144 -0
  128. data/test/ext/jsdoc-toolkit/app/frame/Hash.js +84 -0
  129. data/test/ext/jsdoc-toolkit/app/frame/Link.js +148 -0
  130. data/test/ext/jsdoc-toolkit/app/frame/Namespace.js +10 -0
  131. data/test/ext/jsdoc-toolkit/app/frame/Opt.js +134 -0
  132. data/test/ext/jsdoc-toolkit/app/frame/Reflection.js +26 -0
  133. data/test/ext/jsdoc-toolkit/app/frame/String.js +93 -0
  134. data/test/ext/jsdoc-toolkit/app/frame/Testrun.js +129 -0
  135. data/test/ext/jsdoc-toolkit/app/frame.js +33 -0
  136. data/test/ext/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
  137. data/test/ext/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
  138. data/test/ext/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
  139. data/test/ext/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
  140. data/test/ext/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
  141. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +200 -0
  142. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
  143. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +126 -0
  144. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
  145. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
  146. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/Parser.js +107 -0
  147. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
  148. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +643 -0
  149. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +229 -0
  150. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
  151. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
  152. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
  153. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
  154. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
  155. data/test/ext/jsdoc-toolkit/app/lib/JSDOC/Walker.js +459 -0
  156. data/test/ext/jsdoc-toolkit/app/lib/JSDOC.js +101 -0
  157. data/test/ext/jsdoc-toolkit/app/main.js +111 -0
  158. data/test/ext/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
  159. data/test/ext/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
  160. data/test/ext/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
  161. data/test/ext/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
  162. data/test/ext/jsdoc-toolkit/app/plugins/symbolLink.js +9 -0
  163. data/test/ext/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
  164. data/test/ext/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
  165. data/test/ext/jsdoc-toolkit/app/run.js +348 -0
  166. data/test/ext/jsdoc-toolkit/app/t/TestDoc.js +144 -0
  167. data/test/ext/jsdoc-toolkit/app/t/runner.js +13 -0
  168. data/test/ext/jsdoc-toolkit/app/test/addon.js +24 -0
  169. data/test/ext/jsdoc-toolkit/app/test/anon_inner.js +14 -0
  170. data/test/ext/jsdoc-toolkit/app/test/augments.js +31 -0
  171. data/test/ext/jsdoc-toolkit/app/test/augments2.js +26 -0
  172. data/test/ext/jsdoc-toolkit/app/test/borrows.js +41 -0
  173. data/test/ext/jsdoc-toolkit/app/test/borrows2.js +23 -0
  174. data/test/ext/jsdoc-toolkit/app/test/config.js +22 -0
  175. data/test/ext/jsdoc-toolkit/app/test/constructs.js +18 -0
  176. data/test/ext/jsdoc-toolkit/app/test/encoding.js +10 -0
  177. data/test/ext/jsdoc-toolkit/app/test/encoding_other.js +12 -0
  178. data/test/ext/jsdoc-toolkit/app/test/event.js +54 -0
  179. data/test/ext/jsdoc-toolkit/app/test/functions_anon.js +39 -0
  180. data/test/ext/jsdoc-toolkit/app/test/functions_nested.js +33 -0
  181. data/test/ext/jsdoc-toolkit/app/test/global.js +13 -0
  182. data/test/ext/jsdoc-toolkit/app/test/globals.js +25 -0
  183. data/test/ext/jsdoc-toolkit/app/test/ignore.js +10 -0
  184. data/test/ext/jsdoc-toolkit/app/test/inner.js +16 -0
  185. data/test/ext/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
  186. data/test/ext/jsdoc-toolkit/app/test/lend.js +33 -0
  187. data/test/ext/jsdoc-toolkit/app/test/memberof.js +19 -0
  188. data/test/ext/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
  189. data/test/ext/jsdoc-toolkit/app/test/name.js +19 -0
  190. data/test/ext/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
  191. data/test/ext/jsdoc-toolkit/app/test/nocode.js +13 -0
  192. data/test/ext/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
  193. data/test/ext/jsdoc-toolkit/app/test/overview.js +20 -0
  194. data/test/ext/jsdoc-toolkit/app/test/param_inline.js +37 -0
  195. data/test/ext/jsdoc-toolkit/app/test/params_optional.js +8 -0
  196. data/test/ext/jsdoc-toolkit/app/test/prototype.js +17 -0
  197. data/test/ext/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
  198. data/test/ext/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
  199. data/test/ext/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
  200. data/test/ext/jsdoc-toolkit/app/test/public.js +10 -0
  201. data/test/ext/jsdoc-toolkit/app/test/shared.js +42 -0
  202. data/test/ext/jsdoc-toolkit/app/test/shared2.js +2 -0
  203. data/test/ext/jsdoc-toolkit/app/test/shortcuts.js +22 -0
  204. data/test/ext/jsdoc-toolkit/app/test/static_this.js +13 -0
  205. data/test/ext/jsdoc-toolkit/app/test/synonyms.js +31 -0
  206. data/test/ext/jsdoc-toolkit/app/test/tosource.js +23 -0
  207. data/test/ext/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
  208. data/test/ext/jsdoc-toolkit/app/test.js +307 -0
  209. data/test/ext/jsdoc-toolkit/changes.txt +75 -0
  210. data/test/ext/jsdoc-toolkit/conf/sample.conf +31 -0
  211. data/test/ext/jsdoc-toolkit/java/build.xml +36 -0
  212. data/test/ext/jsdoc-toolkit/java/build_1.4.xml +36 -0
  213. data/test/ext/jsdoc-toolkit/java/classes/js.jar +0 -0
  214. data/test/ext/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
  215. data/test/ext/jsdoc-toolkit/java/src/JsRun.java +21 -0
  216. data/test/ext/jsdoc-toolkit/jsdebug.jar +0 -0
  217. data/test/ext/jsdoc-toolkit/jsrun.jar +0 -0
  218. data/test/ext/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
  219. data/test/ext/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
  220. data/test/ext/jsdoc-toolkit/templates/jsdoc/class.tmpl +646 -0
  221. data/test/ext/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
  222. data/test/ext/jsdoc-toolkit/templates/jsdoc/publish.js +184 -0
  223. data/test/ext/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
  224. data/test/ext/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
  225. data/test/ext/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
  226. data/test/ext/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
  227. data/test/lib/test1.js +0 -0
  228. data/test/lib/test2.js +0 -0
  229. metadata +294 -0
@@ -0,0 +1,348 @@
1
+ /**
2
+ * @fileOverview
3
+ * A bootstrap script that creates some basic required objects
4
+ * for loading other scripts.
5
+ * @author Michael Mathews, micmath@gmail.com
6
+ * @version $Id: run.js 756 2009-01-07 21:32:58Z micmath $
7
+ */
8
+
9
+ /**
10
+ * @namespace Keep track of any messages from the running script.
11
+ */
12
+ LOG = {
13
+ warn: function(msg, e) {
14
+ if (JSDOC.opt.q) return;
15
+ if (e) msg = e.fileName+", line "+e.lineNumber+": "+msg;
16
+
17
+ msg = ">> WARNING: "+msg;
18
+ LOG.warnings.push(msg);
19
+ if (LOG.out) LOG.out.write(msg+"\n");
20
+ else print(msg);
21
+ },
22
+
23
+ inform: function(msg) {
24
+ if (JSDOC.opt.q) return;
25
+ msg = " > "+msg;
26
+ if (LOG.out) LOG.out.write(msg+"\n");
27
+ else if (typeof LOG.verbose != "undefined" && LOG.verbose) print(msg);
28
+ }
29
+ };
30
+ LOG.warnings = [];
31
+ LOG.verbose = false
32
+ LOG.out = undefined;
33
+
34
+ /**
35
+ * @class Manipulate a filepath.
36
+ */
37
+ function FilePath(absPath, separator) {
38
+ this.slash = separator || "/";
39
+ this.root = this.slash;
40
+ this.path = [];
41
+ this.file = "";
42
+
43
+ var parts = absPath.split(/[\\\/]/);
44
+ if (parts) {
45
+ if (parts.length) this.root = parts.shift() + this.slash;
46
+ if (parts.length) this.file = parts.pop()
47
+ if (parts.length) this.path = parts;
48
+ }
49
+
50
+ this.path = this.resolvePath();
51
+ }
52
+
53
+ /** Collapse any dot-dot or dot items in a filepath. */
54
+ FilePath.prototype.resolvePath = function() {
55
+ var resolvedPath = [];
56
+ for (var i = 0; i < this.path.length; i++) {
57
+ if (this.path[i] == "..") resolvedPath.pop();
58
+ else if (this.path[i] != ".") resolvedPath.push(this.path[i]);
59
+ }
60
+ return resolvedPath;
61
+ }
62
+
63
+ /** Trim off the filename. */
64
+ FilePath.prototype.toDir = function() {
65
+ if (this.file) this.file = "";
66
+ return this;
67
+ }
68
+
69
+ /** Go up a directory. */
70
+ FilePath.prototype.upDir = function() {
71
+ this.toDir();
72
+ if (this.path.length) this.path.pop();
73
+ return this;
74
+ }
75
+
76
+ FilePath.prototype.toString = function() {
77
+ return this.root
78
+ + this.path.join(this.slash)
79
+ + ((this.path.length > 0)? this.slash : "")
80
+ + this.file;
81
+ }
82
+
83
+ /**
84
+ * Turn a path into just the name of the file.
85
+ */
86
+ FilePath.fileName = function(path) {
87
+ var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
88
+ return path.substring(nameStart);
89
+ }
90
+
91
+ /**
92
+ * Get the extension of a filename
93
+ */
94
+ FilePath.fileExtension = function(filename) {
95
+ return filename.split(".").pop().toLowerCase();
96
+ };
97
+
98
+ /**
99
+ * Turn a path into just the directory part.
100
+ */
101
+ FilePath.dir = function(path) {
102
+ var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
103
+ return path.substring(0, nameStart-1);
104
+ }
105
+
106
+
107
+ importClass(java.lang.System);
108
+
109
+ /**
110
+ * @namespace A collection of information about your system.
111
+ */
112
+ SYS = {
113
+ /**
114
+ * Information about your operating system: arch, name, version.
115
+ * @type string
116
+ */
117
+ os: [
118
+ new String(System.getProperty("os.arch")),
119
+ new String(System.getProperty("os.name")),
120
+ new String(System.getProperty("os.version"))
121
+ ].join(", "),
122
+
123
+ /**
124
+ * Which way does your slash lean.
125
+ * @type string
126
+ */
127
+ slash: System.getProperty("file.separator")||"/",
128
+
129
+ /**
130
+ * The path to the working directory where you ran java.
131
+ * @type string
132
+ */
133
+ userDir: new String(System.getProperty("user.dir")),
134
+
135
+ /**
136
+ * Where is Java's home folder.
137
+ * @type string
138
+ */
139
+ javaHome: new String(System.getProperty("java.home")),
140
+
141
+ /**
142
+ * The absolute path to the directory containing this script.
143
+ * @type string
144
+ */
145
+ pwd: undefined
146
+ };
147
+
148
+ // jsrun appends an argument, with the path to here.
149
+ if (arguments[arguments.length-1].match(/^-j=(.+)/)) {
150
+ if (RegExp.$1.charAt(0) == SYS.slash || RegExp.$1.charAt(1) == ":") { // absolute path to here
151
+ SYS.pwd = new FilePath(RegExp.$1).toDir().toString();
152
+ }
153
+ else { // relative path to here
154
+ SYS.pwd = new FilePath(SYS.userDir + SYS.slash + RegExp.$1).toDir().toString();
155
+ }
156
+ arguments.pop();
157
+ }
158
+ else {
159
+ print("The run.js script requires you use jsrun.jar.");
160
+ quit();
161
+ }
162
+
163
+ // shortcut
164
+ var File = Packages.java.io.File;
165
+
166
+ /**
167
+ * @namespace A collection of functions that deal with reading a writing to disk.
168
+ */
169
+ IO = {
170
+
171
+ /**
172
+ * Create a new file in the given directory, with the given name and contents.
173
+ */
174
+ saveFile: function(/**string*/ outDir, /**string*/ fileName, /**string*/ content) {
175
+ var out = new Packages.java.io.PrintWriter(
176
+ new Packages.java.io.OutputStreamWriter(
177
+ new Packages.java.io.FileOutputStream(outDir+SYS.slash+fileName),
178
+ IO.encoding
179
+ )
180
+ );
181
+ out.write(content);
182
+ out.flush();
183
+ out.close();
184
+ },
185
+
186
+ /**
187
+ * @type string
188
+ */
189
+ readFile: function(/**string*/ path) {
190
+ if (!IO.exists(path)) {
191
+ throw "File doesn't exist there: "+path;
192
+ }
193
+ return readFile(path, IO.encoding);
194
+ },
195
+
196
+ /**
197
+ * @param inFile
198
+ * @param outDir
199
+ * @param [fileName=The original filename]
200
+ */
201
+ copyFile: function(/**string*/ inFile, /**string*/ outDir, /**string*/ fileName) {
202
+ if (fileName == null) fileName = FilePath.fileName(inFile);
203
+
204
+ var inFile = new File(inFile);
205
+ var outFile = new File(outDir+SYS.slash+fileName);
206
+
207
+ var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096);
208
+ var bos = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outFile), 4096);
209
+ var theChar;
210
+ while ((theChar = bis.read()) != -1) {
211
+ bos.write(theChar);
212
+ }
213
+ bos.close();
214
+ bis.close();
215
+ },
216
+
217
+ /**
218
+ * Creates a series of nested directories.
219
+ */
220
+ mkPath: function(/**Array*/ path) {
221
+ if (path.constructor != Array) path = path.split(/[\\\/]/);
222
+ var make = "";
223
+ for (var i = 0, l = path.length; i < l; i++) {
224
+ make += path[i] + SYS.slash;
225
+ if (! IO.exists(make)) {
226
+ IO.makeDir(make);
227
+ }
228
+ }
229
+ },
230
+
231
+ /**
232
+ * Creates a directory at the given path.
233
+ */
234
+ makeDir: function(/**string*/ path) {
235
+ (new File(path)).mkdir();
236
+ },
237
+
238
+ /**
239
+ * @type string[]
240
+ * @param dir The starting directory to look in.
241
+ * @param [recurse=1] How many levels deep to scan.
242
+ * @returns An array of all the paths to files in the given dir.
243
+ */
244
+ ls: function(/**string*/ dir, /**number*/ recurse, _allFiles, _path) {
245
+ if (_path === undefined) { // initially
246
+ var _allFiles = [];
247
+ var _path = [dir];
248
+ }
249
+ if (_path.length == 0) return _allFiles;
250
+ if (recurse === undefined) recurse = 1;
251
+
252
+ dir = new File(dir);
253
+ if (!dir.directory) return [String(dir)];
254
+ var files = dir.list();
255
+
256
+ for (var f = 0; f < files.length; f++) {
257
+ var file = String(files[f]);
258
+ if (file.match(/^\.[^\.\/\\]/)) continue; // skip dot files
259
+
260
+ if ((new File(_path.join(SYS.slash)+SYS.slash+file)).list()) { // it's a directory
261
+ _path.push(file);
262
+ if (_path.length-1 < recurse) IO.ls(_path.join(SYS.slash), recurse, _allFiles, _path);
263
+ _path.pop();
264
+ }
265
+ else {
266
+ _allFiles.push((_path.join(SYS.slash)+SYS.slash+file).replace(SYS.slash+SYS.slash, SYS.slash));
267
+ }
268
+ }
269
+
270
+ return _allFiles;
271
+ },
272
+
273
+ /**
274
+ * @type boolean
275
+ */
276
+ exists: function(/**string*/ path) {
277
+ file = new File(path);
278
+
279
+ if (file.isDirectory()){
280
+ return true;
281
+ }
282
+ if (!file.exists()){
283
+ return false;
284
+ }
285
+ if (!file.canRead()){
286
+ return false;
287
+ }
288
+ return true;
289
+ },
290
+
291
+ /**
292
+ *
293
+ */
294
+ open: function(/**string*/ path, /**string*/ append) {
295
+ var append = true;
296
+ var outFile = new File(path);
297
+ var out = new Packages.java.io.PrintWriter(
298
+ new Packages.java.io.OutputStreamWriter(
299
+ new Packages.java.io.FileOutputStream(outFile, append),
300
+ IO.encoding
301
+ )
302
+ );
303
+ return out;
304
+ },
305
+
306
+ /**
307
+ * Sets {@link IO.encoding}.
308
+ * Encoding is used when reading and writing text to files,
309
+ * and in the meta tags of HTML output.
310
+ */
311
+ setEncoding: function(/**string*/ encoding) {
312
+ if (/ISO-8859-([0-9]+)/i.test(encoding)) {
313
+ IO.encoding = "ISO8859_"+RegExp.$1;
314
+ }
315
+ else {
316
+ IO.encoding = encoding;
317
+ }
318
+ },
319
+
320
+ /**
321
+ * @default "utf-8"
322
+ * @private
323
+ */
324
+ encoding: "utf-8",
325
+
326
+ /**
327
+ * Load the given script.
328
+ */
329
+ include: function(relativePath) {
330
+ load(SYS.pwd+relativePath);
331
+ },
332
+
333
+ /**
334
+ * Loads all scripts from the given directory path.
335
+ */
336
+ includeDir: function(path) {
337
+ if (!path) return;
338
+
339
+ for (var lib = IO.ls(SYS.pwd+path), i = 0; i < lib.length; i++)
340
+ if (/\.js$/i.test(lib[i])) load(lib[i]);
341
+ }
342
+ }
343
+
344
+ // now run the application
345
+ IO.include("frame.js");
346
+ IO.include("main.js");
347
+
348
+ main();
@@ -0,0 +1,144 @@
1
+ var TestDoc = {
2
+ fails: 0,
3
+ plans: 0,
4
+ passes: 0,
5
+ results: []
6
+ };
7
+
8
+ TestDoc.record = function(result) {
9
+ TestDoc.results.push(result);
10
+ if (typeof result.verdict == "boolean") {
11
+ if (result.verdict === false) TestDoc.fails++;
12
+ if (result.verdict === true) TestDoc.passes++;
13
+ }
14
+ }
15
+
16
+ TestDoc.prove = function(filePath) {
17
+ if (typeof document != "undefined" && typeof document.write != "undefined") {
18
+ if (TestDoc.console) print = function(s) { TestDoc.console.appendChild(document.createTextNode(s+"\n")); }
19
+ else print = function(s) { document.write(s+"<br />"); }
20
+ }
21
+ TestDoc.run(TestDoc.readFile(filePath));
22
+ }
23
+
24
+ TestDoc.run = function(src) {
25
+ try { eval(src); } catch(e) { print("# ERROR! "+e); }
26
+
27
+ var chunks = src.split(/\/\*t:/);
28
+
29
+ var run = function(chunk) {
30
+ // local shortcuts
31
+ var is = TestDoc.assertEquals;
32
+ var isnt = TestDoc.assertNotEquals;
33
+ var plan = TestDoc.plan;
34
+ var requires = TestDoc.requires;
35
+
36
+ try { eval(chunk); } catch(e) { print("# ERROR! "+e); }
37
+ }
38
+ for (var start = -1, end = 0; (start = src.indexOf("/*t:", end)) > end; start = end) {
39
+ run(
40
+ src.substring(
41
+ start+4,
42
+ (end = src.indexOf("*/", start))
43
+ )
44
+ );
45
+ }
46
+ }
47
+
48
+ TestDoc.Result = function(verdict, message) {
49
+ this.verdict = verdict;
50
+ this.message = message;
51
+ }
52
+
53
+ TestDoc.Result.prototype.toString = function() {
54
+ if (typeof this.verdict == "boolean") {
55
+ return (this.verdict? "ok" : "not ok") + " " + (++TestDoc.report.counter) + " - " + this.message;
56
+ }
57
+
58
+ return "# " + this.message;
59
+ }
60
+
61
+ TestDoc.requires = function(file) {
62
+ if (!TestDoc.requires.loaded[file]) {
63
+ load(file);
64
+ TestDoc.requires.loaded[file] = true;
65
+ }
66
+ }
67
+ TestDoc.requires.loaded = {};
68
+
69
+ TestDoc.report = function() {
70
+ TestDoc.report.counter = 0;
71
+ print("1.."+TestDoc.plans);
72
+ for (var i = 0; i < TestDoc.results.length; i++) {
73
+ print(TestDoc.results[i]);
74
+ }
75
+ print("----------------------------------------");
76
+ if (TestDoc.fails == 0 && TestDoc.passes == TestDoc.plans) {
77
+ print("All tests successful.");
78
+ }
79
+ else {
80
+ print("Failed " + TestDoc.fails + "/" + TestDoc.plans + " tests, "+((TestDoc.plans == 0)? 0 : Math.round(TestDoc.passes/(TestDoc.passes+TestDoc.fails)*10000)/100)+"% okay. Planned to run "+TestDoc.plans+", did run "+(TestDoc.passes+TestDoc.fails)+".")
81
+ }
82
+ }
83
+
84
+ TestDoc.plan = function(n, message) {
85
+ TestDoc.plans += n;
86
+ TestDoc.record(new TestDoc.Result(null, message+" ("+n+" tests)"));
87
+ }
88
+
89
+ TestDoc.assertEquals = function(a, b, message) {
90
+ var result = (a == b);
91
+ if (!result) message += "\n#\n# " + a + " does not equal " + b + "\n#";
92
+ TestDoc.record(new TestDoc.Result(result, message));
93
+ }
94
+
95
+ TestDoc.assertNotEquals = function(a, b, message) {
96
+ var result = (a != b);
97
+ if (!result) message += "\n#\n# " + a + " equals " + b + "\n#";
98
+ TestDoc.record(new TestDoc.Result(result, message));
99
+ }
100
+
101
+ TestDoc.readFile = (function(){
102
+ // rhino
103
+ if (typeof readFile == "function") {
104
+ return function(url) {
105
+ var text = readFile(url);
106
+ return text || "";
107
+ }
108
+ }
109
+
110
+ // a web browser
111
+ else {
112
+ return function(url) {
113
+ var httpRequest;
114
+
115
+ if (window.XMLHttpRequest) { // Mozilla, Safari, etc
116
+ httpRequest = new XMLHttpRequest();
117
+ }
118
+ else if (window.ActiveXObject) { // IE
119
+ try {
120
+ httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
121
+ }
122
+ catch (e) {
123
+ try {
124
+ httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
125
+ }
126
+ catch (e) {
127
+ }
128
+ }
129
+ }
130
+
131
+ if (!httpRequest) { throw "Cannot create HTTP Request."; }
132
+
133
+ httpRequest.open('GET', url, false);
134
+ httpRequest.send('');
135
+ if (httpRequest.readyState == 4) {
136
+ if (httpRequest.status >= 400) {
137
+ throw "The HTTP Request returned an error code: "+httpRequest.status;
138
+ }
139
+ }
140
+
141
+ return httpRequest.responseText || "";
142
+ }
143
+ }
144
+ })();
@@ -0,0 +1,13 @@
1
+ // try: java -jar ../../jsrun.jar runner.js
2
+
3
+ load("TestDoc.js");
4
+
5
+ TestDoc.prove("../frame/Opt.js");
6
+ TestDoc.prove("../lib/JSDOC.js");
7
+ TestDoc.prove("../frame/String.js");
8
+ TestDoc.prove("../lib/JSDOC/DocTag.js");
9
+ TestDoc.prove("../lib/JSDOC/DocComment.js");
10
+ TestDoc.prove("../lib/JSDOC/TokenReader.js");
11
+ TestDoc.prove("../lib/JSDOC/Symbol.js");
12
+
13
+ TestDoc.report();
@@ -0,0 +1,24 @@
1
+ String.prototype.reverse = function() {
2
+ }
3
+
4
+ String.prototype.reverse.utf8 = function() {
5
+ }
6
+
7
+ Function.count = function() {
8
+ }
9
+
10
+ /** @memberOf Function */
11
+ Function.count.reset = function() {
12
+ }
13
+
14
+ /** @memberOf Function */
15
+ count.getValue = function() {
16
+ }
17
+
18
+ /** @memberOf Function.prototype */
19
+ getSig = function() {
20
+ }
21
+
22
+ /** @memberOf Function.prototype */
23
+ Function.prototype.getProps = function() {
24
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @name bar
3
+ * @namespace
4
+ */
5
+
6
+ new function() {
7
+ /**
8
+ * @name bar-foo
9
+ * @function
10
+ * @param {number} x
11
+ */
12
+ function foo(x) {
13
+ }
14
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ @constructor
3
+ */
4
+ function Layout(p) {
5
+ this.init = function(p) {
6
+ }
7
+
8
+ this.getId = function() {
9
+ }
10
+
11
+ /** @type Page */
12
+ this.orientation = "landscape";
13
+ }
14
+
15
+ /**
16
+ @constructor
17
+ @augments Layout
18
+ */
19
+ function Page() {
20
+ this.reset = function(b) {
21
+ }
22
+ }
23
+
24
+ /**
25
+ @extends Page
26
+ @constructor
27
+ */
28
+ function ThreeColumnPage() {
29
+ this.init = function(resetCode) {
30
+ }
31
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ @constructor
3
+ */
4
+ function LibraryItem() {
5
+ this.reserve = function() {
6
+ }
7
+ }
8
+
9
+ /**
10
+ @constructor
11
+ */
12
+ function Junkmail() {
13
+ this.annoy = function() {
14
+ }
15
+ }
16
+
17
+ /**
18
+ @inherits Junkmail.prototype.annoy as pester
19
+ @augments ThreeColumnPage
20
+ @augments LibraryItem
21
+ @constructor
22
+ */
23
+ function NewsletterPage() {
24
+ this.getHeadline = function() {
25
+ }
26
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ @constructor
3
+ */
4
+ function Layout(p) {
5
+ /** initilize 1 */
6
+ this.init = function(p) {
7
+ }
8
+
9
+ /** get the id */
10
+ this.getId = function() {
11
+ }
12
+
13
+ /** @type string */
14
+ this.orientation = "landscape";
15
+
16
+ function getInnerElements(elementSecretId){
17
+ }
18
+ }
19
+
20
+ /**
21
+ @constructor
22
+ @borrows Layout#orientation as #orientation
23
+ @borrows Layout-getInnerElements as myGetInnerElements
24
+ */
25
+ function Page() {
26
+ /** reset the page */
27
+ this.reset = function(b) {
28
+ }
29
+ }
30
+
31
+ /**
32
+ @constructor
33
+ @borrows Layout.prototype.orientation as this.orientation
34
+ @borrows Layout.prototype.init as #init
35
+ @inherits Page.prototype.reset as #reset
36
+ */
37
+ function ThreeColumnPage() {
38
+ /** initilize 2 */
39
+ this.init = function(p) {
40
+ }
41
+ }
@@ -0,0 +1,23 @@
1
+ // testing circular borrows
2
+
3
+ /**
4
+ @class
5
+ @borrows Bar#zop as this.my_zop
6
+ */
7
+ function Foo() {
8
+ /** this is a zip. */
9
+ this.zip = function() {}
10
+
11
+ this.my_zop = new Bar().zop;
12
+ }
13
+
14
+ /**
15
+ @class
16
+ @borrows Foo#zip as this.my_zip
17
+ */
18
+ function Bar() {
19
+ /** this is a zop. */
20
+ this.zop = function() {}
21
+
22
+ this.my_zip = new Foo().zip;
23
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @constructor
3
+ * @param person The person.
4
+ * @param {string} person.name The person's name.
5
+ * @config {integer} age The person's age.
6
+ * @config [id=1] Optional id number to use.
7
+ * @param connection
8
+ */
9
+ function Contact(person, connection) {
10
+
11
+ }
12
+
13
+ /**
14
+ * @constructor
15
+ * @param persons
16
+ * @config {string} Father The paternal person.
17
+ * @config {string} Mother The maternal person.
18
+ * @config {string[]} Children And the rest.
19
+ */
20
+ function Family(/**Object*/persons) {
21
+
22
+ }
@@ -0,0 +1,18 @@
1
+ var Person = makeClass(
2
+ /**
3
+ @scope Person
4
+ */
5
+ {
6
+ /**
7
+ This is just another way to define a constructor.
8
+ @constructs
9
+ @param {string} name The name of the person.
10
+ */
11
+ initialize: function(name) {
12
+ this.name = name;
13
+ },
14
+ say: function(message) {
15
+ return this.name + " says: " + message;
16
+ }
17
+ }
18
+ );