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/JsDoc.js DELETED
@@ -1,103 +0,0 @@
1
- /**
2
- * @fileOverview
3
- * @name JsDoc Toolkit
4
- * @author Michael Mathews micmath@gmail.com
5
- * @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-1.4.0b/app/JsDoc.js $
6
- * @revision $Id: JsDoc.js 327 2007-11-13 00:18:23Z micmath $
7
- * @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
8
- * (See the accompanying README file for full details.)
9
- */
10
-
11
- /** @class Handle reporting messages to the user.
12
- @static
13
- */
14
- LOG = {
15
- warn: function(msg, e) {
16
- if (e) msg = e.fileName+", line "+e.lineNumber+": "+msg;
17
-
18
- msg = ">> WARNING: "+msg;
19
- LOG.warnings.push(msg);
20
- if (LOG.out) LOG.out.write(msg+"\n");
21
- else print(msg);
22
- },
23
-
24
- inform: function(msg) {
25
- msg = " > "+msg;
26
- if (LOG.out) LOG.out.write(msg+"\n");
27
- else if (typeof VERBOSE != "undefined" && VERBOSE) print(msg);
28
- }
29
- };
30
- LOG.warnings = [];
31
-
32
- /**
33
- @class An automated documentation publishing system for JavaScript.
34
- @static
35
- @author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
36
- */
37
- JsDoc = {
38
- /** The version number of this release. */
39
- VERSION: "1.4.0b",
40
-
41
- /**
42
- * Print out the expected usage syntax for this script on the command
43
- * line. This is called automatically by using the -h/--help option.
44
- */
45
- usage: function() {
46
- print("USAGE: java -jar app/js.jar app/jsdoc.js [OPTIONS] <SRC_DIR> <SRC_FILE> ...");
47
- print("");
48
- print("OPTIONS:");
49
- print(" -t=<PATH> or --template=<PATH>\n Required. Use this template to format the output.\n");
50
- print(" -d=<PATH> or --directory=<PATH>\n Output to this directory (defaults to js_docs_out).\n");
51
- print(" -e=<ENCODING> or --encoding=<ENCODING>\n Use this encoding to read and write files.\n");
52
-
53
- print(" -r=<DEPTH> or --recurse=<DEPTH>\n Descend into src directories.\n");
54
- print(" -x=<EXT>[,EXT]... or --ext=<EXT>[,EXT]...\n Scan source files with the given extension/s (defaults to js).\n");
55
- print(" -a or --allfunctions\n Include all functions, even undocumented ones.\n");
56
- print(" -A or --Allfunctions\n Include all functions, even undocumented, underscored ones.\n");
57
- print(" -p or --private\n Include symbols tagged as private.\n");
58
- print(" -o=<PATH> or --out=<PATH>\n Print log messages to a file (defaults to stdout).\n");
59
- print(" -h or --help\n Show this message and exit.\n");
60
-
61
- java.lang.System.exit(0);
62
- },
63
-
64
- /**
65
- * @param {string[]} srcFiles Paths to files to be documented
66
- * @return {DocFile[]}
67
- */
68
- parse: function(srcFiles) {
69
- var files = [];
70
-
71
- if (typeof srcFiles == "string") srcFiles = [srcFiles];
72
- var parser = new JsParse();
73
-
74
- srcFiles = srcFiles.sort();
75
-
76
- var docs = new DocFileGroup();
77
-
78
- // handle setting up relationships between symbols here
79
- for (var f = 0; f < srcFiles.length; f++) {
80
- var srcFile = srcFiles[f];
81
-
82
- LOG.inform("Tokenizing: file "+(f+1)+", "+srcFile);
83
- var src = IO.readFile(srcFile);
84
-
85
- var tokens = new TokenReader(src).tokenize();
86
- LOG.inform("\t"+tokens.length+" tokens found.");
87
- var ts = new TokenStream(tokens);
88
-
89
- var file = new DocFile(srcFile);
90
- parser.parse(ts);
91
- LOG.inform("\t"+parser.symbols.length+" symbols found.");
92
-
93
- file.addSymbols(parser.symbols, JsDoc.opt);
94
- if (parser.overview) file.overview = parser.overview;
95
-
96
- docs.addDocFile(file);
97
- }
98
- return docs;
99
- }
100
- };
101
-
102
- /** Override this dummy function in your template. */
103
- function publish() {}
@@ -1,45 +0,0 @@
1
- /**
2
- * @fileOverview
3
- * @name JsHilite
4
- * @author Michael Mathews micmath@gmail.com
5
- * @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-1.4.0b/app/JsHilite.js $
6
- * @revision $Id: JsHilite.js 300 2007-11-11 16:51:53Z micmath $
7
- * @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
8
- * (See the accompanying README file for full details.)
9
- */
10
-
11
- require("app/JsToke.js");
12
-
13
- /**
14
- * @class Turn source code into HTML with tokens marked for hilighting with CSS.
15
- */
16
- function JsHilite(sourceCode, charset) {
17
- this.tokenizer = new TokenReader(sourceCode);
18
- this.tokenizer.keepComments = true;
19
- this.tokenizer.keepDocs = true;
20
- this.tokenizer.keepWhite = true;
21
- Token.prototype.toString = function() {
22
- return "<span class=\""+this.type+"\">"+this.data.replace(/</g, "&lt;")+"</span>";
23
- }
24
- if (!charset) charset = "utf-8";
25
-
26
- this.header = '<html><head><meta http-equiv="content-type" content="text/html; charset='+charset+'"> '+
27
- "<style>\n\
28
- .KEYW {color: #933;}\n\
29
- .COMM {color: #bbb; font-style: italic;}\n\
30
- .NUMB {color: #393;}\n\
31
- .STRN {color: #393;}\n\
32
- .REGX {color: #339;}\n\
33
- .linenumber {border-right: 1px dotted #666; color: #666; font-style: normal;}\n\
34
- </style></head><body><pre>";
35
- this.footer = "</pre></body></html>";
36
- this.showLinenumbers = true;
37
- }
38
-
39
- JsHilite.prototype.hilite = function() {
40
- var hilited = this.tokenizer.tokenize().join("");
41
- var linenumber = 1;
42
- if (this.showLinenumbers) hilited = hilited.replace(/(^|\n)/g, function(m){return m+"<span class='linenumber'>"+((linenumber<10)? " ":"")+((linenumber<100)? " ":"")+(linenumber++)+"</span> "});
43
-
44
- return this.header+hilited+this.footer;
45
- }
data/jsdoc/app/JsIO.js DELETED
@@ -1,163 +0,0 @@
1
- /**
2
- * @fileOverview
3
- * @name JsIO
4
- * @author Michael Mathews micmath@gmail.com
5
- * @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-1.4.0b/app/JsIO.js $
6
- * @revision $Id: JsIO.js 303 2007-11-11 18:59:08Z micmath $
7
- * @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
8
- * (See the accompanying README file for full details.)
9
- */
10
-
11
- // shortcuts
12
- FileWriter = Packages.java.io.FileWriter;
13
- File = Packages.java.io.File;
14
-
15
- /**
16
- * @class Friendly interface to Java file operations. Requires Rhino.
17
- * @static
18
- */
19
- var IO = {
20
- FileSeparator: Packages.java.io.File.separator,
21
-
22
- /**
23
- * Use to save content to a file.
24
- * @param {string} outDir Path to directory to save into.
25
- * @param {string} fileName Name to use for the new file.
26
- * @param {string} content To write to the new file.
27
- */
28
- saveFile: function(outDir, fileName, content) {
29
- var out = new Packages.java.io.PrintWriter(
30
- new Packages.java.io.OutputStreamWriter(
31
- new Packages.java.io.FileOutputStream(outDir+IO.FileSeparator+fileName),
32
- IO.encoding
33
- )
34
- );
35
- out.write(content);
36
- out.flush();
37
- out.close();
38
- },
39
-
40
- /**
41
- * Gets the contents of a file.
42
- * @param {path|url} url
43
- * @return {string} The contents of the file at the given location.
44
- */
45
- readFile: function(path) {
46
- return readFile(path, IO.encoding);
47
- },
48
-
49
- /**
50
- * Use to copy a file from one directory to another. Can take binary files too.
51
- * @param {string} inFile Path to the source file.
52
- * @param {string} outDir Path to directory to save into.
53
- * @param {string} fileName Name to use for the new file.
54
- */
55
- copyFile: function(inFile, outDir, fileName) {
56
- if (fileName == null) fileName = Util.fileName(inFile);
57
-
58
- var inFile = new File(inFile);
59
- var outFile = new File(outDir+IO.FileSeparator+fileName);
60
-
61
- var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096);
62
- var bos = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outFile), 4096);
63
- var theChar;
64
- while ((theChar = bis.read()) != -1) {
65
- bos.write(theChar);
66
- }
67
- bos.close();
68
- bis.close();
69
- },
70
-
71
- /**
72
- * Use to create a new directory.
73
- * @param {string} dirname Path of directory you wish to create.
74
- */
75
- makeDir: function(dirName) {
76
- (new File(dirName)).mkdir();
77
- },
78
-
79
- /**
80
- * Get recursive list of files in a directory.
81
- * @param {array} dirs Paths to directories to search.
82
- * @param {int} recurse How many levels to descend, defaults to 1.
83
- * @return {array} Paths to found files.
84
- */
85
- ls: function(dir, recurse, allFiles, path) {
86
- if (path === undefined) { // initially
87
- var allFiles = [];
88
- var path = [dir];
89
- }
90
- if (path.length == 0) return allFiles;
91
- if (recurse === undefined) recurse = 1;
92
-
93
- dir = new File(dir);
94
- if (!dir.directory) return [String(dir)];
95
- var files = dir.list();
96
-
97
- for (var f = 0; f < files.length; f++) {
98
- var file = String(files[f]);
99
- if (file.match(/^\.[^\.\/\\]/)) continue; // skip dot files
100
-
101
- if ((new File(path.join("/")+"/"+file)).list()) { // it's a directory
102
- path.push(file);
103
- if (path.length-1 < recurse) IO.ls(path.join("/"), recurse, allFiles, path);
104
- path.pop();
105
- }
106
- else {
107
- allFiles.push((path.join("/")+"/"+file).replace("//", "/"));
108
- }
109
- }
110
-
111
- return allFiles;
112
- },
113
-
114
- /**
115
- * Check if a filepath exists.
116
- * @author vinces1979
117
- */
118
- exists: function(path) {
119
- file = new File(path);
120
-
121
- if (file.isDirectory()){
122
- return true;
123
- }
124
- if (!file.exists()){
125
- LOG.inform('Path not found: ' + path);
126
- return false;
127
- }
128
- if (!file.canRead()){
129
- LOG.inform('Path not readable: ' + path);
130
- return false;
131
- }
132
- return true;
133
- },
134
-
135
- /**
136
- * Create an open filehandle.
137
- * @param {string} path Path to file to open.
138
- * @param {boolean} append Open in append mode?
139
- * @return {FileWriter} A filehandle that can write(string) and close().
140
- */
141
- open: function(path, append) {
142
- var append = true;
143
- var outFile = new Packages.java.io.File(path);
144
- var out = new Packages.java.io.PrintWriter(
145
- new Packages.java.io.OutputStreamWriter(
146
- new Packages.java.io.FileOutputStream(outFile, append),
147
- IO.encoding
148
- )
149
- );
150
- return out;
151
- },
152
-
153
- setEncoding: function(encoding) {
154
- if (/ISO-8859-([0-9]+)/i.test(encoding)) {
155
- IO.encoding = "ISO8859_"+RegExp.$1;
156
- }
157
- else {
158
- IO.encoding = encoding
159
- }
160
- }
161
- };
162
-
163
- IO.encoding = "utf-8";
data/jsdoc/app/JsParse.js DELETED
@@ -1,385 +0,0 @@
1
- /**
2
- * @fileOverview
3
- * @name JsParse
4
- * @author Michael Mathews micmath@gmail.com
5
- * @url $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-1.4.0b/app/JsParse.js $
6
- * @revision $Id: JsParse.js 329 2007-11-13 00:48:15Z micmath $
7
- * @license <a href="http://en.wikipedia.org/wiki/MIT_License">X11/MIT License</a>
8
- * (See the accompanying README file for full details.)
9
- */
10
-
11
- /**
12
- * @class Find objects in tokenized JavaScript source code.
13
- * @constructor
14
- * @author Michael Mathews <a href="mailto:micmath@gmail.com">micmath@gmail.com</a>
15
- */
16
- function JsParse() {};
17
-
18
- /**
19
- * Populate the symbols array with symbols found in the
20
- * given token stream.
21
- * @param {TokenStream} tokenStream
22
- */
23
- JsParse.prototype.parse = function(tokenStream) {
24
- /**
25
- * All symbols found in the tokenStream.
26
- * @type Symbol[]
27
- */
28
- this.symbols = [];
29
-
30
- /**
31
- * Overview found in the tokenStream.
32
- * @type Symbol
33
- */
34
- this.overview = null;
35
-
36
- while(tokenStream.next()) {
37
- if (this._findDocComment(tokenStream)) continue;
38
- if (this._findFunction(tokenStream)) continue;
39
- if (this._findVariable(tokenStream)) continue;
40
- }
41
- }
42
-
43
- /**
44
- * Try to find a JsDoc comment in the tokenStream.
45
- * @param {TokenStream} ts
46
- * @return {boolean} Was a JsDoc comment found?
47
- */
48
- JsParse.prototype._findDocComment = function(ts) {
49
- if (ts.look().is("JSDOC")) {
50
-
51
- ts.look().data = ts.look().data.replace(/@namespace\b/, "@static\n@class");
52
-
53
- var doc = ts.look().data;
54
-
55
-
56
- if (doc.indexOf("/**#") == 0) {
57
- new Symbol("", [], "META", doc);
58
- delete ts.tokens[ts.cursor];
59
- return true;
60
- }
61
- else if (/@(projectdescription|(file)?overview)\b/i.test(doc)) {
62
- this.overview = new Symbol("", [], "FILE", doc);
63
- delete ts.tokens[ts.cursor];
64
- return true;
65
- }
66
- else if (/@name\s+([a-z0-9_$.]+)\s*/i.test(doc)) {
67
- this.symbols.push(new Symbol(RegExp.$1, [], SYM.VIRTUAL, doc));
68
- delete ts.tokens[ts.cursor];
69
- return true;
70
- }
71
- else if (/@scope\s+([a-z0-9_$.]+)\s*/i.test(doc)) {
72
- var scope = RegExp.$1;
73
- if (scope) {
74
- scope = scope.replace(/\.prototype\b/, "/");
75
- this._onObLiteral(scope, new TokenStream(ts.balance("LEFT_CURLY")));
76
- return true;
77
- }
78
- }
79
- }
80
- return false;
81
- }
82
-
83
- /**
84
- * Try to find a function definition in the tokenStream
85
- * @param {TokenStream} ts
86
- * @return {boolean} Was a function definition found?
87
- */
88
- JsParse.prototype._findFunction = function(ts) {
89
- if (ts.look().is("NAME")) {
90
- var name = ts.look().data;
91
- var doc = "";
92
- var isa = null;
93
- var body = "";
94
- var paramTokens = [];
95
- var params = [];
96
-
97
- // like function foo()
98
- if (ts.look(-1).is("FUNCTION")) {
99
- isa = SYM.FUNCTION;
100
-
101
- if (ts.look(-2).is("JSDOC")) {
102
- doc = ts.look(-2).data;
103
- }
104
- paramTokens = ts.balance("LEFT_PAREN");
105
- body = ts.balance("LEFT_CURLY");
106
- }
107
-
108
- // like var foo = function()
109
- else if (ts.look(1).is("ASSIGN") && ts.look(2).is("FUNCTION")) {
110
- isa = SYM.FUNCTION;
111
-
112
- if (ts.look(-1).is("VAR") && ts.look(-2).is("JSDOC")) {
113
- doc = ts.look(-2).data;
114
- }
115
- else if (ts.look(-1).is("JSDOC")) {
116
- doc = ts.look(-1).data;
117
- }
118
- paramTokens = ts.balance("LEFT_PAREN");
119
- body = ts.balance("LEFT_CURLY");
120
-
121
- // like foo = function(n) {return n}(42)
122
- if (ts.look(1).is("LEFT_PAREN")) {
123
- isa = SYM.OBJECT;
124
-
125
- ts.balance("LEFT_PAREN");
126
- if (doc) { // we only keep these if they're documented
127
- name = name.replace(/\.prototype\.?/, "/");
128
-
129
- if (!/\/$/.test(name)) { // assigning to prototype of already existing symbol
130
- this.symbols.push(new Symbol(name, [], isa, doc));
131
- }
132
- }
133
- this._onFnBody(name, new TokenStream(body));
134
- return true;
135
- }
136
- }
137
-
138
- // like var foo = new function()
139
- else if (ts.look(1).is("ASSIGN") && ts.look(2).is("NEW") && ts.look(3).is("FUNCTION")) {
140
- isa = SYM.OBJECT;
141
-
142
- if (ts.look(-1).is("VAR") && ts.look(-2).is("JSDOC")) {
143
- doc = ts.look(-2).data;
144
- }
145
- else if (ts.look(-1).is("JSDOC")) {
146
- doc = ts.look(-1).data;
147
- }
148
-
149
- paramTokens = ts.balance("LEFT_PAREN");
150
- body = ts.balance("LEFT_CURLY");
151
- if (doc) { // we only keep these if they're documented
152
- name = name.replace(/\.prototype\.?/, "/");
153
-
154
- if (!/\/$/.test(name)) { // assigning to prototype of already existing symbol
155
- this.symbols.push(new Symbol(name, [], isa, doc));
156
- }
157
- }
158
- this._onFnBody(name, new TokenStream(body));
159
- return true;
160
- }
161
-
162
- if (isa && name) {
163
- if (isa == SYM.FUNCTION) {
164
- for (var i = 0; i < paramTokens.length; i++) {
165
- if (paramTokens[i].is("NAME"))
166
- params.push(paramTokens[i].data);
167
- }
168
- }
169
-
170
- // like Foo.bar.prototype.baz = function() {}
171
- var ns = name;
172
- if (name.indexOf(".prototype") > 0) {
173
- isa = SYM.FUNCTION;
174
- name = name.replace(/\.prototype\.?/, "/");
175
- }
176
-
177
- this.symbols.push(new Symbol(name, params, isa, doc));
178
-
179
- if (body) {
180
- if (ns.indexOf(".prototype") > 0) {
181
- if (/@constructor\b/.test(doc)) {
182
- ns = ns.replace(/\.prototype\.?/, "/");
183
- }
184
- else {
185
- ns = ns.replace(/\.prototype\.[^.]+$/, "/");
186
- }
187
- }
188
- this._onFnBody(ns, new TokenStream(body));
189
- }
190
- return true;
191
- }
192
- }
193
- return false;
194
- }
195
-
196
- /**
197
- * Try to find a variable definition in the tokenStream
198
- * @param {TokenStream} ts
199
- * @return {boolean} Was a variable definition found?
200
- */
201
- JsParse.prototype._findVariable = function(ts) {
202
- if (ts.look().is("NAME") && ts.look(1).is("ASSIGN")) {
203
- // like var foo = 1
204
- var name = ts.look().data;
205
- isa = SYM.OBJECT;
206
-
207
- var doc;
208
- if (ts.look(-1).is("JSDOC")) doc = ts.look(-1).data;
209
- else if (ts.look(-1).is("VAR") && ts.look(-2).is("JSDOC")) doc = ts.look(-2).data;
210
- name = name.replace(/\.prototype\.?/, "/");
211
-
212
- if (doc) { // we only keep these if they're documented
213
- if (!/\/$/.test(name)) { // assigning to prototype of already existing symbol
214
- this.symbols.push(new Symbol(name, [], isa, doc));
215
- }
216
- if (/@class\b/i.test(doc)) {
217
- name = name +"/";
218
- }
219
- }
220
-
221
- // like foo = {
222
- if (ts.look(2).is("LEFT_CURLY")) {
223
- this._onObLiteral(name, new TokenStream(ts.balance("LEFT_CURLY")));
224
- }
225
- return true;
226
- }
227
- return false;
228
- }
229
-
230
- /**
231
- * Handle sub-parsing of the content within an object literal.
232
- * @private
233
- * @param {String} nspace The name attached to this object.
234
- * @param {TokenStream} ts The content of the object literal.
235
- */
236
- JsParse.prototype._onObLiteral = function(nspace, ts) {
237
- while (ts.next()) {
238
- if (this._findDocComment(ts)) {
239
-
240
- }
241
- else if (ts.look().is("NAME") && ts.look(1).is("COLON")) {
242
- var name = nspace+((nspace.charAt(nspace.length-1)=="/")?"":".")+ts.look().data;
243
-
244
- // like foo: function
245
- if (ts.look(2).is("FUNCTION")) {
246
- var isa = SYM.FUNCTION;
247
- var doc = "";
248
-
249
- if (ts.look(-1).is("JSDOC")) doc = ts.look(-1).data;
250
-
251
- var paramTokens = ts.balance("LEFT_PAREN");
252
- var params = [];
253
- for (var i = 0; i < paramTokens.length; i++) {
254
- if (paramTokens[i].is("NAME"))
255
- params.push(paramTokens[i].data);
256
- }
257
-
258
- var body = ts.balance("LEFT_CURLY");
259
-
260
- // like foo: function(n) {return n}(42)
261
- if (ts.look(1).is("LEFT_PAREN")) {
262
- isa = SYM.OBJECT;
263
-
264
- ts.balance("LEFT_PAREN");
265
- //if (doc) { // we only keep these if they're documented
266
- //name = name.replace(/\.prototype\.?/, "/");
267
-
268
- //if (!/\/$/.test(name)) { // assigning to prototype of already existing symbol
269
- // this.symbols.push(new Symbol(name, [], isa, doc));
270
- //}
271
- //}
272
- //this._onFnBody(name, new TokenStream(body));
273
- //return true;
274
- }
275
-
276
- this.symbols.push(new Symbol(name, params, isa, doc));
277
-
278
- // find methods in the body of this function
279
- this._onFnBody(name, new TokenStream(body));
280
- }
281
- // like foo: {...}
282
- else if (ts.look(2).is("LEFT_CURLY")) { // another nested object literal
283
- if (ts.look(-1).is("JSDOC")) {
284
- var isa = SYM.OBJECT;
285
- var doc = ts.look(-1).data;
286
-
287
- this.symbols.push(new Symbol(name, [], isa, doc));
288
- }
289
-
290
- this._onObLiteral(name, new TokenStream(ts.balance("LEFT_CURLY"))); // recursive
291
- }
292
- else { // like foo: 1, or foo: "one"
293
- if (ts.look(-1).is("JSDOC")) { // we only grab these if they are documented
294
- var isa = SYM.OBJECT;
295
- var doc = ts.look(-1).data;
296
-
297
- this.symbols.push(new Symbol(name, [], isa, doc));
298
- }
299
-
300
- while (!ts.look().is("COMMA")) { // skip to end of RH value ignoring things like bar({blah, blah})
301
- if (ts.look().is("LEFT_PAREN")) ts.balance("LEFT_PAREN");
302
- else if (ts.look().is("LEFT_CURLY")) ts.balance("LEFT_CURLY");
303
- else if (!ts.next()) break;
304
- }
305
- }
306
- }
307
- }
308
- }
309
-
310
- /**
311
- * Handle sub-parsing of the content within a function body.
312
- * @private
313
- * @param {String} nspace The name attached to this function.
314
- * @param {TokenStream} fs The content of the function body.
315
- */
316
- JsParse.prototype._onFnBody = function(nspace, fs) {
317
- while (fs.look()) {
318
- if (this._findDocComment(fs)) {
319
-
320
- }
321
- else if (fs.look().is("NAME") && fs.look(1).is("ASSIGN")) {
322
- var name = fs.look().data;
323
-
324
- // like this.foo =
325
- if (name.indexOf("this.") == 0) {
326
- // like this.foo = function
327
- if (fs.look(2).is("FUNCTION")) {
328
- var isa = SYM.FUNCTION;
329
- var doc = (fs.look(-1).is("JSDOC"))? fs.look(-1).data : "";
330
- name = name.replace(/^this\./, (nspace+"/").replace("//", "/"))
331
-
332
- var paramTokens = fs.balance("LEFT_PAREN");
333
- var params = [];
334
- for (var i = 0; i < paramTokens.length; i++) {
335
- if (paramTokens[i].is("NAME")) params.push(paramTokens[i].data);
336
- }
337
-
338
- body = fs.balance("LEFT_CURLY");
339
-
340
- // like this.foo = function(n) {return n}(42)
341
- if (fs.look(1).is("LEFT_PAREN")) { // false alarm, it's not really a named function definition
342
- isa = SYM.OBJECT;
343
- fs.balance("LEFT_PAREN");
344
- if (doc) { // we only grab these if they are documented
345
- this.symbols.push(
346
- new Symbol(name, [], isa, doc)
347
- );
348
- }
349
- break;
350
- }
351
-
352
- this.symbols.push(
353
- new Symbol(name, params, isa, doc)
354
- );
355
-
356
- if (body) {
357
- this._onFnBody(name, new TokenStream(body)); // recursive
358
- }
359
- }
360
- else {
361
- var isa = SYM.OBJECT;
362
- var doc = (fs.look(-1).is("JSDOC"))? fs.look(-1).data : "";
363
- name = name.replace(/^this\./, (nspace+"/").replace("//", "/"))
364
-
365
- if (doc) {
366
- this.symbols.push(
367
- new Symbol(name, [], isa, doc)
368
- );
369
- }
370
-
371
- // like this.foo = { ... }
372
- if (fs.look(2).is("LEFT_CURLY")) {
373
- var literal = fs.balance("LEFT_CURLY");
374
- this._onObLiteral(name, new TokenStream(literal));
375
- }
376
- }
377
- }
378
- // like <thisfunction>.prototype.foo =
379
- else if (name.indexOf(nspace+".prototype.") == 0) {
380
- this._findFunction(fs);
381
- }
382
- }
383
- if (!fs.next()) break;
384
- }
385
- }