sproutcore 0.9.13 → 0.9.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. data/History.txt +19 -0
  2. data/Manifest.txt +103 -26
  3. data/app_generators/sproutcore/templates/README +1 -1
  4. data/bin/sc-build +1 -1
  5. data/bin/sc-gen +0 -0
  6. data/bin/sc-ide +278 -0
  7. data/bin/sc-init +38 -0
  8. data/bin/sc-install +96 -0
  9. data/bin/sc-remove +94 -0
  10. data/bin/sc-server +4 -0
  11. data/bin/sc-update +94 -0
  12. data/bin/sproutcore +3 -14
  13. data/clients/sc_docs/controllers/docs.js +1 -1
  14. data/clients/sc_docs/models/doc.js +6 -0
  15. data/clients/sc_docs/views/doc_frame.js +1 -1
  16. data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
  17. data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
  18. data/frameworks/sproutcore/HISTORY +34 -2
  19. data/frameworks/sproutcore/controllers/array.js +1 -1
  20. data/frameworks/sproutcore/controllers/controller.js +1 -1
  21. data/frameworks/sproutcore/controllers/object.js +9 -6
  22. data/frameworks/sproutcore/core.js +19 -4
  23. data/frameworks/sproutcore/english.lproj/blank.gif +0 -0
  24. data/frameworks/sproutcore/english.lproj/core.css +1 -0
  25. data/frameworks/sproutcore/english.lproj/menu.css +1 -0
  26. data/frameworks/sproutcore/foundation/application.js +3 -3
  27. data/frameworks/sproutcore/foundation/benchmark.js +1 -1
  28. data/frameworks/sproutcore/foundation/node_descriptor.js +13 -1
  29. data/frameworks/sproutcore/foundation/page.js +3 -2
  30. data/frameworks/sproutcore/foundation/path_module.js +33 -16
  31. data/frameworks/sproutcore/foundation/run_loop.js +1 -1
  32. data/frameworks/sproutcore/foundation/server.js +68 -18
  33. data/frameworks/sproutcore/foundation/string.js +1 -1
  34. data/frameworks/sproutcore/globals/window.js +62 -15
  35. data/frameworks/sproutcore/lib/core_views.rb +1 -0
  36. data/frameworks/sproutcore/lib/index.rhtml +4 -3
  37. data/frameworks/sproutcore/lib/menu_views.rb +2 -2
  38. data/frameworks/sproutcore/models/collection.js +122 -107
  39. data/frameworks/sproutcore/models/record.js +2 -2
  40. data/frameworks/sproutcore/panes/manager.js +1 -1
  41. data/frameworks/sproutcore/panes/overlay.js +3 -3
  42. data/frameworks/sproutcore/tests/controllers/object.rhtml +26 -0
  43. data/frameworks/sproutcore/tests/views/collection/incremental_rendering.rhtml +2 -2
  44. data/frameworks/sproutcore/views/button/disclosure.js +1 -1
  45. data/frameworks/sproutcore/views/collection/collection.js +19 -15
  46. data/frameworks/sproutcore/views/collection/source_list.js +1 -1
  47. data/frameworks/sproutcore/views/collection/table.js +2 -2
  48. data/frameworks/sproutcore/views/error_explanation.js +1 -1
  49. data/frameworks/sproutcore/views/field/checkbox_field.js +1 -1
  50. data/frameworks/sproutcore/views/field/field.js +1 -1
  51. data/frameworks/sproutcore/views/field/radio_field.js +1 -1
  52. data/frameworks/sproutcore/views/field/select_field.js +1 -1
  53. data/frameworks/sproutcore/views/form.js +1 -1
  54. data/frameworks/sproutcore/views/image.js +1 -1
  55. data/frameworks/sproutcore/views/menu_item.js +1 -1
  56. data/frameworks/sproutcore/views/popup_button.js +1 -1
  57. data/frameworks/sproutcore/views/popup_menu.js +1 -1
  58. data/frameworks/sproutcore/views/progress.js +4 -2
  59. data/frameworks/sproutcore/views/radio_group.js +1 -1
  60. data/frameworks/sproutcore/views/scroll.js +1 -1
  61. data/frameworks/sproutcore/views/source_list_group.js +1 -1
  62. data/frameworks/sproutcore/views/split.js +1 -1
  63. data/frameworks/sproutcore/views/tab.js +3 -1
  64. data/frameworks/sproutcore/views/view.js +19 -3
  65. data/jsdoc/README.txt +89 -57
  66. data/jsdoc/app/frame/Chain.js +102 -0
  67. data/jsdoc/app/frame/Dumper.js +144 -0
  68. data/jsdoc/app/frame/Hash.js +47 -0
  69. data/jsdoc/app/frame/Link.js +142 -0
  70. data/jsdoc/app/frame/Namespace.js +10 -0
  71. data/jsdoc/app/frame/Opt.js +134 -0
  72. data/jsdoc/app/frame/Reflection.js +26 -0
  73. data/jsdoc/app/frame/String.js +93 -0
  74. data/jsdoc/app/frame/Testrun.js +129 -0
  75. data/jsdoc/app/frame.js +33 -0
  76. data/jsdoc/app/handlers/FOODOC.js +26 -0
  77. data/jsdoc/app/handlers/XMLDOC/DomReader.js +159 -0
  78. data/jsdoc/app/handlers/XMLDOC/XMLDoc.js +16 -0
  79. data/jsdoc/app/handlers/XMLDOC/XMLParse.js +292 -0
  80. data/jsdoc/app/handlers/XMLDOC.js +26 -0
  81. data/jsdoc/app/lib/JSDOC/DocComment.js +200 -0
  82. data/jsdoc/app/lib/JSDOC/DocTag.js +294 -0
  83. data/jsdoc/app/lib/JSDOC/JsDoc.js +180 -0
  84. data/jsdoc/app/lib/JSDOC/JsPlate.js +100 -0
  85. data/jsdoc/app/lib/JSDOC/Lang.js +144 -0
  86. data/jsdoc/app/lib/JSDOC/Parser.js +109 -0
  87. data/jsdoc/app/lib/JSDOC/PluginManager.js +33 -0
  88. data/jsdoc/app/lib/JSDOC/Symbol.js +600 -0
  89. data/jsdoc/app/lib/JSDOC/SymbolSet.js +220 -0
  90. data/jsdoc/app/lib/JSDOC/TextStream.js +41 -0
  91. data/jsdoc/app/lib/JSDOC/Token.js +18 -0
  92. data/jsdoc/app/lib/JSDOC/TokenReader.js +323 -0
  93. data/jsdoc/app/lib/JSDOC/TokenStream.js +133 -0
  94. data/jsdoc/app/lib/JSDOC/Util.js +32 -0
  95. data/jsdoc/app/lib/JSDOC/Walker.js +416 -0
  96. data/jsdoc/app/lib/JSDOC.js +97 -0
  97. data/jsdoc/app/main.js +74 -0
  98. data/jsdoc/app/plugins/commentSrcJson.js +19 -0
  99. data/jsdoc/app/plugins/frameworkPrototype.js +16 -0
  100. data/jsdoc/app/plugins/functionCall.js +10 -0
  101. data/jsdoc/app/plugins/publishSrcHilite.js +62 -0
  102. data/jsdoc/app/plugins/sproutcoreTags.js +26 -0
  103. data/jsdoc/app/plugins/symbolLink.js +9 -0
  104. data/jsdoc/app/plugins/tagParamConfig.js +31 -0
  105. data/jsdoc/app/plugins/tagSynonyms.js +43 -0
  106. data/jsdoc/app/run.js +339 -137
  107. data/jsdoc/changes.txt +47 -0
  108. data/jsdoc/conf/sample.conf +31 -0
  109. data/jsdoc/java/build.xml +36 -0
  110. data/jsdoc/java/build_1.4.xml +36 -0
  111. data/jsdoc/java/classes/js.jar +0 -0
  112. data/jsdoc/java/src/JsDebugRun.java +21 -0
  113. data/jsdoc/java/src/JsRun.java +21 -0
  114. data/jsdoc/jsdebug.jar +0 -0
  115. data/jsdoc/jsrun.jar +0 -0
  116. data/jsdoc/t/TestDoc.js +144 -0
  117. data/jsdoc/t/runner.js +13 -0
  118. data/jsdoc/templates/sproutcore/allclasses.tmpl +17 -0
  119. data/jsdoc/templates/sproutcore/allfiles.tmpl +56 -0
  120. data/jsdoc/templates/sproutcore/class.tmpl +408 -326
  121. data/jsdoc/templates/sproutcore/index.tmpl +30 -31
  122. data/jsdoc/templates/sproutcore/publish.js +173 -81
  123. data/jsdoc/templates/sproutcore/static/default.css +191 -0
  124. data/jsdoc/templates/sproutcore/static/header.html +2 -0
  125. data/jsdoc/templates/sproutcore/static/index.html +19 -0
  126. data/jsdoc/templates/sproutcore/symbol.tmpl +35 -0
  127. data/jsdoc/test/addon.js +24 -0
  128. data/jsdoc/test/anon_inner.js +14 -0
  129. data/jsdoc/test/augments.js +31 -0
  130. data/jsdoc/test/augments2.js +26 -0
  131. data/jsdoc/test/borrows.js +41 -0
  132. data/jsdoc/test/borrows2.js +23 -0
  133. data/jsdoc/test/config.js +22 -0
  134. data/jsdoc/test/constructs.js +18 -0
  135. data/jsdoc/test/encoding.js +10 -0
  136. data/jsdoc/test/encoding_other.js +12 -0
  137. data/jsdoc/test/functions_anon.js +39 -0
  138. data/jsdoc/test/functions_nested.js +33 -0
  139. data/jsdoc/test/global.js +13 -0
  140. data/jsdoc/test/globals.js +25 -0
  141. data/jsdoc/test/ignore.js +10 -0
  142. data/jsdoc/test/inner.js +16 -0
  143. data/jsdoc/test/jsdoc_test.js +477 -0
  144. data/jsdoc/test/lend.js +33 -0
  145. data/jsdoc/test/memberof.js +20 -0
  146. data/jsdoc/test/memberof_constructor.js +15 -0
  147. data/jsdoc/test/name.js +19 -0
  148. data/jsdoc/test/namespace_nested.js +23 -0
  149. data/jsdoc/test/nocode.js +13 -0
  150. data/jsdoc/test/oblit_anon.js +20 -0
  151. data/jsdoc/test/overview.js +20 -0
  152. data/jsdoc/test/param_inline.js +37 -0
  153. data/jsdoc/test/params_optional.js +8 -0
  154. data/jsdoc/test/prototype.js +17 -0
  155. data/jsdoc/test/prototype_nested.js +9 -0
  156. data/jsdoc/test/prototype_oblit.js +13 -0
  157. data/jsdoc/test/prototype_oblit_constructor.js +24 -0
  158. data/jsdoc/test/public.js +10 -0
  159. data/jsdoc/test/shared.js +42 -0
  160. data/jsdoc/test/shared2.js +2 -0
  161. data/jsdoc/test/shortcuts.js +22 -0
  162. data/jsdoc/test/static_this.js +13 -0
  163. data/jsdoc/test/synonyms.js +23 -0
  164. data/jsdoc/test/tosource.js +23 -0
  165. data/jsdoc/test/variable_redefine.js +14 -0
  166. data/jsdoc/test.js +304 -0
  167. data/lib/sproutcore/build_tools/resource_builder.rb +6 -1
  168. data/lib/sproutcore/bundle_installer.rb +268 -0
  169. data/lib/sproutcore/jsdoc.rb +7 -6
  170. data/lib/sproutcore/library.rb +38 -0
  171. data/lib/sproutcore/merb/bundle_controller.rb +8 -4
  172. data/lib/sproutcore/version.rb +1 -1
  173. data/lib/sproutcore.rb +1 -1
  174. data/script/destroy +0 -0
  175. data/script/generate +0 -0
  176. data/script/txt2html +0 -0
  177. metadata +117 -29
  178. data/clients/view_builder/core.js +0 -19
  179. data/clients/view_builder/english.lproj/body.css +0 -149
  180. data/clients/view_builder/english.lproj/body.rhtml +0 -18
  181. data/clients/view_builder/english.lproj/strings.js +0 -14
  182. data/clients/view_builder/main.js +0 -37
  183. data/jsdoc/app/DocFile.js +0 -137
  184. data/jsdoc/app/DocTag.js +0 -110
  185. data/jsdoc/app/Doclet.js +0 -63
  186. data/jsdoc/app/Dumper.js +0 -143
  187. data/jsdoc/app/JsDoc.js +0 -103
  188. data/jsdoc/app/JsHilite.js +0 -45
  189. data/jsdoc/app/JsIO.js +0 -163
  190. data/jsdoc/app/JsParse.js +0 -385
  191. data/jsdoc/app/JsPlate.js +0 -130
  192. data/jsdoc/app/JsTestrun.js +0 -129
  193. data/jsdoc/app/JsToke.js +0 -564
  194. data/jsdoc/app/Symbol.js +0 -298
  195. data/jsdoc/app/Transformer.js +0 -14
  196. data/jsdoc/app/Util.js +0 -97
  197. data/jsdoc/app/js.jar +0 -0
  198. data/jsdoc/plugins/min.js +0 -316
  199. data/jsdoc/plugins/strip.js +0 -20
  200. data/jsdoc/templates/sproutcore/default.css +0 -191
  201. data/jsdoc/templates/sproutcore/index.html +0 -13
  202. data/jsdoc/templates/sproutcore/prototype.js +0 -4186
  203. data/jsdoc/templates/sproutcore/splash.html +0 -7
data/jsdoc/app/run.js CHANGED
@@ -1,144 +1,346 @@
1
- var VERBOSE = false;
2
- try {
3
- importClass(java.lang.System);
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 554 2008-04-01 00:12:25Z 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 (e) msg = e.fileName+", line "+e.lineNumber+": "+msg;
15
+
16
+ msg = ">> WARNING: "+msg;
17
+ LOG.warnings.push(msg);
18
+ if (LOG.out) LOG.out.write(msg+"\n");
19
+ else print(msg);
20
+ },
21
+
22
+ inform: function(msg) {
23
+ msg = " > "+msg;
24
+ if (LOG.out) LOG.out.write(msg+"\n");
25
+ else if (typeof LOG.verbose != "undefined" && LOG.verbose) print(msg);
26
+ }
27
+ };
28
+ LOG.warnings = [];
29
+ LOG.verbose = false
30
+ LOG.out = undefined;
31
+
32
+ /**
33
+ * @class Manipulate a filepath.
34
+ */
35
+ function FilePath(absPath, separator) {
36
+ this.slash = separator || "/";
37
+ this.root = this.slash;
38
+ this.path = [];
39
+ this.file = "";
40
+
41
+ var parts = absPath.split(/[\\\/]/);
42
+ if (parts) {
43
+ if (parts.length) this.root = parts.shift() + this.slash;
44
+ if (parts.length) this.file = parts.pop()
45
+ if (parts.length) this.path = parts;
46
+ }
47
+
48
+ this.path = this.resolvePath();
49
+ }
50
+
51
+ /** Collapse any dot-dot or dot items in a filepath. */
52
+ FilePath.prototype.resolvePath = function() {
53
+ var resolvedPath = [];
54
+ for (var i = 0; i < this.path.length; i++) {
55
+ if (this.path[i] == "..") resolvedPath.pop();
56
+ else if (this.path[i] != ".") resolvedPath.push(this.path[i]);
57
+ }
58
+ return resolvedPath;
59
+ }
60
+
61
+ /** Trim off the filename. */
62
+ FilePath.prototype.toDir = function() {
63
+ if (this.file) this.file = "";
64
+ return this;
4
65
  }
5
- catch (e) {
6
- throw "RuntimeException: The class java.lang.System is required to run this script.";
66
+
67
+ /** Go up a directory. */
68
+ FilePath.prototype.upDir = function() {
69
+ this.toDir();
70
+ if (this.path.length) this.path.pop();
71
+ return this;
7
72
  }
8
73
 
9
- var __DIR__ = (System.getProperty("jsdoc.dir")||System.getProperty("user.dir"))+Packages.java.io.File.separator;
10
-
11
- /** Load required libraries. */
12
- function require(lib) {
13
- var libDirs = ['', __DIR__, __DIR__+'app/', __DIR__+'../'];
14
- var libErrors = [];
15
- for(var i = 0; i < libDirs.length; i++) {
16
- try {
17
- var file = new Packages.java.io.File(libDirs[i]+lib);
18
- if(!file.exists()) {
19
- libErrors.push('Could not find: ['+(libDirs[i]+lib)+']');
20
- }
21
- else {
22
- if (VERBOSE) print("Loading: ["+(libDirs[i]+lib)+"] ...");
23
- load(libDirs[i]+lib);
24
- return;
25
- }
26
- }
27
- catch (e) {
28
- libErrors.push('Error loading: ['+(libDirs[i]+lib)+']');
29
- }
30
- }
31
- for(var i=0; i < libErrors.length; i++) {
32
- print("ERROR: ["+libErrors[i]+"]");
33
- }
34
- quit();
74
+ FilePath.prototype.toString = function() {
75
+ return this.root
76
+ + this.path.join(this.slash)
77
+ + ((this.path.length > 0)? this.slash : "")
78
+ + this.file;
35
79
  }
36
80
 
37
- require("app/JsDoc.js");
38
- require("app/Util.js");
39
-
40
- JsDoc.opt = Util.getOptions(arguments, {d:'directory', t:'template', r:'recurse', x:'ext', p:'private', a:'allfunctions', A:'Allfunctions', e:'encoding', o:'out', h:'help', 'D[]':'define'});
41
- VERBOSE = JsDoc.opt.v;
42
-
43
- require("app/JsIO.js");
44
- require("app/Symbol.js");
45
- require("app/JsToke.js");
46
- require("app/JsParse.js");
47
- require("app/DocTag.js");
48
- require("app/Doclet.js");
49
- require("app/DocFile.js");
50
- require("app/JsPlate.js");
51
-
52
- /** The main function. Called automatically. */
53
- function Main() {
54
- if (JsDoc.opt.o) LOG.out = IO.open(JsDoc.opt.o, true);
55
- if (!JsDoc.opt.e) JsDoc.opt.e = "utf-8";
56
- IO.setEncoding(JsDoc.opt.e);
57
-
58
- if (JsDoc.opt.c) {
59
- eval('conf = '+IO.readFile(JsDoc.opt.c));
60
-
61
- for (var c in conf) {
62
- if (c !== "D") {
63
- JsDoc.opt[c] = conf[c];
64
- }
65
- }
66
- }
67
- if (JsDoc.opt.h || JsDoc.opt._.length == 0 || JsDoc.opt.t === true) JsDoc.usage();
68
-
69
- var ext = ["js"];
70
- if (JsDoc.opt.x) ext = JsDoc.opt.x.split(",").map(function(x) {return x.toLowerCase()});
71
-
72
- if (typeof(JsDoc.opt.r) == "boolean") JsDoc.opt.r = 10;
73
- else if (!isNaN(parseInt(JsDoc.opt.r))) JsDoc.opt.r = parseInt(JsDoc.opt.r);
74
- else JsDoc.opt.r = 1;
75
-
76
- if (JsDoc.opt.d === true || JsDoc.opt.t === true) { // like when a user enters: -d mydir
77
- LOG.warn("Option malformed.");
78
- JsDoc.usage();
79
- }
80
- else if (!JsDoc.opt.d) {
81
- JsDoc.opt.d = "js_docs_out";
82
- }
83
-
84
- JsDoc.opt.d += (JsDoc.opt.d.indexOf(IO.FileSeparator) == JsDoc.opt.d.length-1)?
85
- "" : IO.FileSeparator;
86
- LOG.inform("Creating output directory: "+JsDoc.opt.d);
87
- IO.makeDir(JsDoc.opt.d);
88
-
89
- LOG.inform("Scanning for source files: recursion set to "+JsDoc.opt.r+" subdir"+((JsDoc.opt.r==1)?"":"s")+".");
90
- function isJs(element, index, array) {
91
- var thisExt = element.split(".").pop().toLowerCase();
92
- return (ext.indexOf(thisExt) > -1); // we're only interested in files with certain extensions
93
- }
94
- var srcFiles = [];
95
- for (var d = 0; d < JsDoc.opt._.length; d++) {
96
- srcFiles = srcFiles.concat(
97
- IO.ls(JsDoc.opt._[d], JsDoc.opt.r).filter(isJs)
98
- );
99
- }
100
-
101
- LOG.inform(srcFiles.length+" source file"+((srcFiles ==1)?"":"s")+" found:\n\t"+srcFiles.join("\n\t"));
102
- var fileGroup = JsDoc.parse(srcFiles, JsDoc.opt);
103
-
104
- var D = {};
105
- if (JsDoc.opt.D) {
106
- for (var i = 0; i < JsDoc.opt.D.length; i++) {
107
- var defineParts = JsDoc.opt.D[i].split(":", 2);
108
- D[defineParts[0]] = defineParts[1];
109
- }
110
- JsDoc.opt.D = D;
111
- }
112
- else {
113
- JsDoc.opt.D = {};
114
- }
115
-
116
- // combine any conf file D options with the commandline D options
117
- if (typeof conf != "undefined") for (var c in conf.D) {
118
- if (typeof JsDoc.opt.D[c] == "undefined") {
119
- JsDoc.opt.D[c] = conf.D[c];
120
- }
121
- }
122
-
123
- if (JsDoc.opt.t && IO.exists(JsDoc.opt.t)) {
124
- JsDoc.opt.t += (JsDoc.opt.t.indexOf(IO.FileSeparator)==JsDoc.opt.t.length-1)?
125
- "" : IO.FileSeparator;
126
- LOG.inform("Loading template: "+JsDoc.opt.t+"publish.js");
127
- require(JsDoc.opt.t+"publish.js");
128
-
129
- LOG.inform("Publishing all files...");
130
- publish(fileGroup, JsDoc.opt);
131
- LOG.inform("Finished.");
132
- }
133
- else {
134
- LOG.warn("Use the -t option to specify a template for formatting.");
135
- LOG.warn("Dumping results to stdout.");
136
- require("app/Dumper.js");
137
- print(Dumper.dump(fileGroup));
138
- }
139
-
140
- if (LOG.out) LOG.out.close();
141
- if (LOG.warnings.length > 0) print(LOG.warnings.length+" warnings.");
81
+ /**
82
+ * Turn a path into just the name of the file.
83
+ */
84
+ FilePath.fileName = function(path) {
85
+ var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
86
+ return path.substring(nameStart);
142
87
  }
143
88
 
144
- Main();
89
+ /**
90
+ * Get the extension of a filename
91
+ */
92
+ FilePath.fileExtension = function(filename) {
93
+ return filename.split(".").pop().toLowerCase();
94
+ };
95
+
96
+ /**
97
+ * Turn a path into just the directory part.
98
+ */
99
+ FilePath.dir = function(path) {
100
+ var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0);
101
+ return path.substring(0, nameStart-1);
102
+ }
103
+
104
+
105
+ importClass(java.lang.System);
106
+
107
+ /**
108
+ * @namespace A collection of information about your system.
109
+ */
110
+ SYS = {
111
+ /**
112
+ * Information about your operating system: arch, name, version.
113
+ * @type string
114
+ */
115
+ os: [
116
+ new String(System.getProperty("os.arch")),
117
+ new String(System.getProperty("os.name")),
118
+ new String(System.getProperty("os.version"))
119
+ ].join(", "),
120
+
121
+ /**
122
+ * Which way does your slash lean.
123
+ * @type string
124
+ */
125
+ slash: System.getProperty("file.separator")||"/",
126
+
127
+ /**
128
+ * The path to the working directory where you ran java.
129
+ * @type string
130
+ */
131
+ userDir: new String(System.getProperty("user.dir")),
132
+
133
+ /**
134
+ * Where is Java's home folder.
135
+ * @type string
136
+ */
137
+ javaHome: new String(System.getProperty("java.home")),
138
+
139
+ /**
140
+ * The absolute path to the directory containing this script.
141
+ * @type string
142
+ */
143
+ pwd: undefined
144
+ };
145
+
146
+ // jsrun appends an argument, with the path to here.
147
+ if (arguments[arguments.length-1].match(/^-j=(.+)/)) {
148
+ if (RegExp.$1.charAt(0) == SYS.slash || RegExp.$1.charAt(1) == ":") { // absolute path to here
149
+ SYS.pwd = new FilePath(RegExp.$1).toDir().toString();
150
+ }
151
+ else { // relative path to here
152
+ SYS.pwd = new FilePath(SYS.userDir + SYS.slash + RegExp.$1).toDir().toString();
153
+ }
154
+ arguments.pop();
155
+ }
156
+ else {
157
+ print("The run.js script requires you use jsrun.jar.");
158
+ quit();
159
+ }
160
+
161
+ // shortcut
162
+ var File = Packages.java.io.File;
163
+
164
+ /**
165
+ * @namespace A collection of functions that deal with reading a writing to disk.
166
+ */
167
+ IO = {
168
+
169
+ /**
170
+ * Create a new file in the given directory, with the given name and contents.
171
+ */
172
+ saveFile: function(/**string*/ outDir, /**string*/ fileName, /**string*/ content) {
173
+ var out = new Packages.java.io.PrintWriter(
174
+ new Packages.java.io.OutputStreamWriter(
175
+ new Packages.java.io.FileOutputStream(outDir+SYS.slash+fileName),
176
+ IO.encoding
177
+ )
178
+ );
179
+ out.write(content);
180
+ out.flush();
181
+ out.close();
182
+ },
183
+
184
+ /**
185
+ * @type string
186
+ */
187
+ readFile: function(/**string*/ path) {
188
+ if (!IO.exists(path)) {
189
+ throw "File doesn't exist there: "+path;
190
+ }
191
+ return readFile(path, IO.encoding);
192
+ },
193
+
194
+ /**
195
+ * @param inFile
196
+ * @param outDir
197
+ * @param [fileName=The original filename]
198
+ */
199
+ copyFile: function(/**string*/ inFile, /**string*/ outDir, /**string*/ fileName) {
200
+ if (fileName == null) fileName = FilePath.fileName(inFile);
201
+
202
+ var inFile = new File(inFile);
203
+ var outFile = new File(outDir+SYS.slash+fileName);
204
+
205
+ var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096);
206
+ var bos = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outFile), 4096);
207
+ var theChar;
208
+ while ((theChar = bis.read()) != -1) {
209
+ bos.write(theChar);
210
+ }
211
+ bos.close();
212
+ bis.close();
213
+ },
214
+
215
+ /**
216
+ * Creates a series of nested directories.
217
+ */
218
+ mkPath: function(/**Array*/ path) {
219
+ if (path.constructor != Array) path = path.split(/[\\\/]/);
220
+ var make = "";
221
+ for (var i = 0, l = path.length; i < l; i++) {
222
+ make += path[i] + SYS.slash;
223
+ if (! IO.exists(make)) {
224
+ IO.makeDir(make);
225
+ }
226
+ }
227
+ },
228
+
229
+ /**
230
+ * Creates a directory at the given path.
231
+ */
232
+ makeDir: function(/**string*/ path) {
233
+ (new File(path)).mkdir();
234
+ },
235
+
236
+ /**
237
+ * @type string[]
238
+ * @param dir The starting directory to look in.
239
+ * @param [recurse=1] How many levels deep to scan.
240
+ * @returns An array of all the paths to files in the given dir.
241
+ */
242
+ ls: function(/**string*/ dir, /**number*/ recurse, _allFiles, _path) {
243
+ if (_path === undefined) { // initially
244
+ var _allFiles = [];
245
+ var _path = [dir];
246
+ }
247
+ if (_path.length == 0) return _allFiles;
248
+ if (recurse === undefined) recurse = 1;
249
+
250
+ dir = new File(dir);
251
+ if (!dir.directory) return [String(dir)];
252
+ var files = dir.list();
253
+
254
+ for (var f = 0; f < files.length; f++) {
255
+ var file = String(files[f]);
256
+ if (file.match(/^\.[^\.\/\\]/)) continue; // skip dot files
257
+
258
+ if ((new File(_path.join(SYS.slash)+SYS.slash+file)).list()) { // it's a directory
259
+ _path.push(file);
260
+ if (_path.length-1 < recurse) IO.ls(_path.join(SYS.slash), recurse, _allFiles, _path);
261
+ _path.pop();
262
+ }
263
+ else {
264
+ _allFiles.push((_path.join(SYS.slash)+SYS.slash+file).replace(SYS.slash+SYS.slash, SYS.slash));
265
+ }
266
+ }
267
+
268
+ return _allFiles;
269
+ },
270
+
271
+ /**
272
+ * @type boolean
273
+ */
274
+ exists: function(/**string*/ path) {
275
+ file = new File(path);
276
+
277
+ if (file.isDirectory()){
278
+ return true;
279
+ }
280
+ if (!file.exists()){
281
+ return false;
282
+ }
283
+ if (!file.canRead()){
284
+ return false;
285
+ }
286
+ return true;
287
+ },
288
+
289
+ /**
290
+ *
291
+ */
292
+ open: function(/**string*/ path, /**string*/ append) {
293
+ var append = true;
294
+ var outFile = new File(path);
295
+ var out = new Packages.java.io.PrintWriter(
296
+ new Packages.java.io.OutputStreamWriter(
297
+ new Packages.java.io.FileOutputStream(outFile, append),
298
+ IO.encoding
299
+ )
300
+ );
301
+ return out;
302
+ },
303
+
304
+ /**
305
+ * Sets {@link IO.encoding}.
306
+ * Encoding is used when reading and writing text to files,
307
+ * and in the meta tags of HTML output.
308
+ */
309
+ setEncoding: function(/**string*/ encoding) {
310
+ if (/ISO-8859-([0-9]+)/i.test(encoding)) {
311
+ IO.encoding = "ISO8859_"+RegExp.$1;
312
+ }
313
+ else {
314
+ IO.encoding = encoding;
315
+ }
316
+ },
317
+
318
+ /**
319
+ * @default "utf-8"
320
+ * @private
321
+ */
322
+ encoding: "utf-8",
323
+
324
+ /**
325
+ * Load the given script.
326
+ */
327
+ include: function(relativePath) {
328
+ load(SYS.pwd+relativePath);
329
+ },
330
+
331
+ /**
332
+ * Loads all scripts from the given directory path.
333
+ */
334
+ includeDir: function(path) {
335
+ if (!path) return;
336
+
337
+ for (var lib = IO.ls(SYS.pwd+path), i = 0; i < lib.length; i++)
338
+ load(lib[i]);
339
+ }
340
+ }
341
+
342
+ // now run the application
343
+ IO.include("frame.js");
344
+ IO.include("main.js");
345
+
346
+ main();
data/jsdoc/changes.txt ADDED
@@ -0,0 +1,47 @@
1
+ == 2.0.1 ==
2
+
3
+ * Fixed bug that prevented @fileOverview tag from being recognized.
4
+ * Added support for @fieldOf as a synonym for @field plus @memberOf.
5
+ * Added support for @name tag in a @fileOverview comment to control the displayed name of the file.
6
+ * Added support for multiple @example tags. ( issue #152 )
7
+ * Modified style sheet of jsdoc template to make more readable. ( issue #151 )
8
+ * Fixed bug that prevented @since documentation from displaying correctly when it appeared in a class. ( issue #150 )
9
+ * Fixed bug that caused inhertited properties to sometimes not resolve correctly. ( issue #144 )
10
+ * Modified so that trailing whitespace in @example is always trimmed. ( issue #153 )
11
+ * Added support for elseif to JsPlate. (hat tip to fredck)
12
+ * Added support for @location urls in the @overview comment to the jsdoc template.
13
+
14
+ == Changes From Versions 1.4.0 to 2.0.0 ==
15
+
16
+ * Upgraded included version of Rhino from 1.6 to 1.7R1.
17
+ * Removed circular references in parsed documentation objects.
18
+ * Improved inheritance handling, now properties and events can be inherited same as methods.
19
+ * Improved handling of cross-file relationships, now having two related objects in separate files is not a problem.
20
+ * Improved ability to recognize membership of previously defined objects.
21
+ * Added ability to redefine parsing behavior with plugins.
22
+ * @methodOf is a synonym for @function and @memberOf.
23
+ * Added @default to document default values of members that are objects.
24
+ * Added ability to parse and refer to inner functions.
25
+ * Fixed bug that appeared when calling a method to set properties of the instance referred to by "this".
26
+ * Added ability to automatically create links to other symbols.
27
+ * New "jsdoc" template now produces fully W3C valid XHTML.
28
+ * Inline parameter type hint comments are now documented.
29
+ * Fixed error: Locally scoped variables (declared with var) no longer appear as global.
30
+ * It is now possible to run JsDoc Toolkit from any directory.
31
+ * Added support for inline {@link ...} tags.
32
+ * Added support for the -H command-line option to allow for custom content handlers.
33
+ * Tag names @inherits and @scope changed to @borrows and @lends.
34
+ ? Combining @constructor in a doclet with @lends now supported.
35
+ * Multiple @lend tags now supported.
36
+ * Added support for the @constructs tag, used inside a @lends block.
37
+ * Added support for the @constant tag.
38
+ * Fixed bug that prevented the use of [] as a default value.
39
+ * Added support for the @field tag.
40
+ * Added support for the @public tag (applied to inner functions).
41
+ * @namespace tag can now be applied to functions, not just object literals.
42
+ * Added support for the -s command line option to suppress source code output.
43
+ * Added new unit test framework.
44
+ * Underscored symbols are now treated as if they have a @private tag by default.
45
+ * Improved support for anonymous constructors.
46
+ * Added support for the nocode meta tag.
47
+
@@ -0,0 +1,31 @@
1
+ /*
2
+ This is an example of one way you could set up a configuration file to more
3
+ conveniently define some commandline options. You might like to do this if
4
+ you frequently reuse the same options. Note that you don't need to define
5
+ every option in this file, you can combine a configuration file with
6
+ additional options on the commandline if your wish.
7
+
8
+ You would include this configuration file by running JsDoc Toolkit like so:
9
+ java -jar jsrun.jar app/run.js -c=conf/sample.conf
10
+
11
+ */
12
+
13
+ {
14
+ // source files to use
15
+ _: ['app/test/jsdoc_test.js'],
16
+
17
+ // document all functions, even uncommented ones
18
+ a: true,
19
+
20
+ // including those marked @private
21
+ p: true,
22
+
23
+ // some extra variables I want to include
24
+ D: {generatedBy: "Michael Mathews", copyright: "2008"},
25
+
26
+ // use this directory as the output directory
27
+ d: "docs",
28
+
29
+ // use this template
30
+ t: "templates/sproutcore"
31
+ }
@@ -0,0 +1,36 @@
1
+ <project>
2
+ <target name="clean">
3
+ <delete dir="build"/>
4
+ </target>
5
+
6
+ <target name="compile">
7
+ <mkdir dir="build/classes"/>
8
+ <javac
9
+ srcdir="src" destdir="build/classes"
10
+ classpath="./classes/js.jar"
11
+ />
12
+ </target>
13
+
14
+ <target name="jar">
15
+ <mkdir dir="build/jar"/>
16
+ <jar destfile="build/jar/jsrun.jar" basedir="build/classes">
17
+ <manifest>
18
+ <attribute name="Main-Class" value="JsRun"/>
19
+ <attribute name="Class-Path" value="./java/classes/js.jar"/>
20
+ </manifest>
21
+ </jar>
22
+ </target>
23
+
24
+ <target name="debugjar">
25
+ <mkdir dir="build/jar"/>
26
+ <jar destfile="build/jar/jsdebug.jar" basedir="build/classes">
27
+ <manifest>
28
+ <attribute name="Main-Class" value="JsDebugRun"/>
29
+ <attribute name="Class-Path" value="./java/classes/js.jar"/>
30
+ </manifest>
31
+ </jar>
32
+ </target>
33
+
34
+ <target name="clean-build" depends="clean,compile,jar"/>
35
+ <target name="clean-debug" depends="clean,compile,debugjar"/>
36
+ </project>
@@ -0,0 +1,36 @@
1
+ <project default="clean-build"><!-- use this build script if you are stuck with ant version 1.4 -->
2
+ <target name="clean">
3
+ <delete dir="build"/>
4
+ </target>
5
+
6
+ <target name="compile">
7
+ <mkdir dir="build/classes"/>
8
+ <javac
9
+ srcdir="src" destdir="build/classes"
10
+ classpath="./classes/js.jar"
11
+ />
12
+ </target>
13
+
14
+ <target name="jar">
15
+ <mkdir dir="build/jar"/>
16
+ <jar jarfile="build/jar/jsrun.jar" basedir="build/classes">
17
+ <manifest>
18
+ <attribute name="Main-Class" value="JsRun"/>
19
+ <attribute name="Class-Path" value="./java/classes/js.jar"/>
20
+ </manifest>
21
+ </jar>
22
+ </target>
23
+
24
+ <target name="debugjar">
25
+ <mkdir dir="build/jar"/>
26
+ <jar jarfile="build/jar/jsdebug.jar" basedir="build/classes">
27
+ <manifest>
28
+ <attribute name="Main-Class" value="JsDebugRun"/>
29
+ <attribute name="Class-Path" value="./java/classes/js.jar"/>
30
+ </manifest>
31
+ </jar>
32
+ </target>
33
+
34
+ <target name="clean-build" depends="clean,compile,jar"/>
35
+ <target name="clean-debug" depends="clean,compile,debugjar"/>
36
+ </project>
Binary file
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A trivial bootstrap class that simply adds the path to the
3
+ * .js file as an argument to the Rhino call. This little hack
4
+ * allows the code in the .js file to have access to it's own
5
+ * path via the Rhino arguments object. This is necessary to
6
+ * allow the .js code to find resource files in a location
7
+ * relative to itself.
8
+ *
9
+ * USAGE: java -jar jsdebug.jar path/to/file.js
10
+ */
11
+ public class JsDebugRun {
12
+ public static void main(String[] args) {
13
+ String[] jsargs = {"-j="+args[0]};
14
+
15
+ String[] allArgs = new String[jsargs.length + args.length];
16
+ System.arraycopy(args, 0, allArgs, 0, args.length);
17
+ System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length);
18
+
19
+ org.mozilla.javascript.tools.debugger.Main.main(allArgs);
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A trivial bootstrap class that simply adds the path to the
3
+ * .js file as an argument to the Rhino call. This little hack
4
+ * allows the code in the .js file to have access to it's own
5
+ * path via the Rhino arguments object. This is necessary to
6
+ * allow the .js code to find resource files in a location
7
+ * relative to itself.
8
+ *
9
+ * USAGE: java -jar jsrun.jar path/to/file.js
10
+ */
11
+ public class JsRun {
12
+ public static void main(String[] args) {
13
+ String[] jsargs = {"-j="+args[0]};
14
+
15
+ String[] allArgs = new String[jsargs.length + args.length];
16
+ System.arraycopy(args, 0, allArgs, 0, args.length);
17
+ System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length);
18
+
19
+ org.mozilla.javascript.tools.shell.Main.main(allArgs);
20
+ }
21
+ }
data/jsdoc/jsdebug.jar ADDED
Binary file
data/jsdoc/jsrun.jar ADDED
Binary file