sproutcore 0.9.13 → 0.9.14
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +19 -0
- data/Manifest.txt +103 -26
- data/app_generators/sproutcore/templates/README +1 -1
- data/bin/sc-build +1 -1
- data/bin/sc-gen +0 -0
- data/bin/sc-ide +278 -0
- data/bin/sc-init +38 -0
- data/bin/sc-install +96 -0
- data/bin/sc-remove +94 -0
- data/bin/sc-server +4 -0
- data/bin/sc-update +94 -0
- data/bin/sproutcore +3 -14
- data/clients/sc_docs/controllers/docs.js +1 -1
- data/clients/sc_docs/models/doc.js +6 -0
- data/clients/sc_docs/views/doc_frame.js +1 -1
- data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
- data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
- data/frameworks/sproutcore/HISTORY +34 -2
- data/frameworks/sproutcore/controllers/array.js +1 -1
- data/frameworks/sproutcore/controllers/controller.js +1 -1
- data/frameworks/sproutcore/controllers/object.js +9 -6
- data/frameworks/sproutcore/core.js +19 -4
- data/frameworks/sproutcore/english.lproj/blank.gif +0 -0
- data/frameworks/sproutcore/english.lproj/core.css +1 -0
- data/frameworks/sproutcore/english.lproj/menu.css +1 -0
- data/frameworks/sproutcore/foundation/application.js +3 -3
- data/frameworks/sproutcore/foundation/benchmark.js +1 -1
- data/frameworks/sproutcore/foundation/node_descriptor.js +13 -1
- data/frameworks/sproutcore/foundation/page.js +3 -2
- data/frameworks/sproutcore/foundation/path_module.js +33 -16
- data/frameworks/sproutcore/foundation/run_loop.js +1 -1
- data/frameworks/sproutcore/foundation/server.js +68 -18
- data/frameworks/sproutcore/foundation/string.js +1 -1
- data/frameworks/sproutcore/globals/window.js +62 -15
- data/frameworks/sproutcore/lib/core_views.rb +1 -0
- data/frameworks/sproutcore/lib/index.rhtml +4 -3
- data/frameworks/sproutcore/lib/menu_views.rb +2 -2
- data/frameworks/sproutcore/models/collection.js +122 -107
- data/frameworks/sproutcore/models/record.js +2 -2
- data/frameworks/sproutcore/panes/manager.js +1 -1
- data/frameworks/sproutcore/panes/overlay.js +3 -3
- data/frameworks/sproutcore/tests/controllers/object.rhtml +26 -0
- data/frameworks/sproutcore/tests/views/collection/incremental_rendering.rhtml +2 -2
- data/frameworks/sproutcore/views/button/disclosure.js +1 -1
- data/frameworks/sproutcore/views/collection/collection.js +19 -15
- data/frameworks/sproutcore/views/collection/source_list.js +1 -1
- data/frameworks/sproutcore/views/collection/table.js +2 -2
- data/frameworks/sproutcore/views/error_explanation.js +1 -1
- data/frameworks/sproutcore/views/field/checkbox_field.js +1 -1
- data/frameworks/sproutcore/views/field/field.js +1 -1
- data/frameworks/sproutcore/views/field/radio_field.js +1 -1
- data/frameworks/sproutcore/views/field/select_field.js +1 -1
- data/frameworks/sproutcore/views/form.js +1 -1
- data/frameworks/sproutcore/views/image.js +1 -1
- data/frameworks/sproutcore/views/menu_item.js +1 -1
- data/frameworks/sproutcore/views/popup_button.js +1 -1
- data/frameworks/sproutcore/views/popup_menu.js +1 -1
- data/frameworks/sproutcore/views/progress.js +4 -2
- data/frameworks/sproutcore/views/radio_group.js +1 -1
- data/frameworks/sproutcore/views/scroll.js +1 -1
- data/frameworks/sproutcore/views/source_list_group.js +1 -1
- data/frameworks/sproutcore/views/split.js +1 -1
- data/frameworks/sproutcore/views/tab.js +3 -1
- data/frameworks/sproutcore/views/view.js +19 -3
- data/jsdoc/README.txt +89 -57
- data/jsdoc/app/frame/Chain.js +102 -0
- data/jsdoc/app/frame/Dumper.js +144 -0
- data/jsdoc/app/frame/Hash.js +47 -0
- data/jsdoc/app/frame/Link.js +142 -0
- data/jsdoc/app/frame/Namespace.js +10 -0
- data/jsdoc/app/frame/Opt.js +134 -0
- data/jsdoc/app/frame/Reflection.js +26 -0
- data/jsdoc/app/frame/String.js +93 -0
- data/jsdoc/app/frame/Testrun.js +129 -0
- data/jsdoc/app/frame.js +33 -0
- data/jsdoc/app/handlers/FOODOC.js +26 -0
- data/jsdoc/app/handlers/XMLDOC/DomReader.js +159 -0
- data/jsdoc/app/handlers/XMLDOC/XMLDoc.js +16 -0
- data/jsdoc/app/handlers/XMLDOC/XMLParse.js +292 -0
- data/jsdoc/app/handlers/XMLDOC.js +26 -0
- data/jsdoc/app/lib/JSDOC/DocComment.js +200 -0
- data/jsdoc/app/lib/JSDOC/DocTag.js +294 -0
- data/jsdoc/app/lib/JSDOC/JsDoc.js +180 -0
- data/jsdoc/app/lib/JSDOC/JsPlate.js +100 -0
- data/jsdoc/app/lib/JSDOC/Lang.js +144 -0
- data/jsdoc/app/lib/JSDOC/Parser.js +109 -0
- data/jsdoc/app/lib/JSDOC/PluginManager.js +33 -0
- data/jsdoc/app/lib/JSDOC/Symbol.js +600 -0
- data/jsdoc/app/lib/JSDOC/SymbolSet.js +220 -0
- data/jsdoc/app/lib/JSDOC/TextStream.js +41 -0
- data/jsdoc/app/lib/JSDOC/Token.js +18 -0
- data/jsdoc/app/lib/JSDOC/TokenReader.js +323 -0
- data/jsdoc/app/lib/JSDOC/TokenStream.js +133 -0
- data/jsdoc/app/lib/JSDOC/Util.js +32 -0
- data/jsdoc/app/lib/JSDOC/Walker.js +416 -0
- data/jsdoc/app/lib/JSDOC.js +97 -0
- data/jsdoc/app/main.js +74 -0
- data/jsdoc/app/plugins/commentSrcJson.js +19 -0
- data/jsdoc/app/plugins/frameworkPrototype.js +16 -0
- data/jsdoc/app/plugins/functionCall.js +10 -0
- data/jsdoc/app/plugins/publishSrcHilite.js +62 -0
- data/jsdoc/app/plugins/sproutcoreTags.js +26 -0
- data/jsdoc/app/plugins/symbolLink.js +9 -0
- data/jsdoc/app/plugins/tagParamConfig.js +31 -0
- data/jsdoc/app/plugins/tagSynonyms.js +43 -0
- data/jsdoc/app/run.js +339 -137
- data/jsdoc/changes.txt +47 -0
- data/jsdoc/conf/sample.conf +31 -0
- data/jsdoc/java/build.xml +36 -0
- data/jsdoc/java/build_1.4.xml +36 -0
- data/jsdoc/java/classes/js.jar +0 -0
- data/jsdoc/java/src/JsDebugRun.java +21 -0
- data/jsdoc/java/src/JsRun.java +21 -0
- data/jsdoc/jsdebug.jar +0 -0
- data/jsdoc/jsrun.jar +0 -0
- data/jsdoc/t/TestDoc.js +144 -0
- data/jsdoc/t/runner.js +13 -0
- data/jsdoc/templates/sproutcore/allclasses.tmpl +17 -0
- data/jsdoc/templates/sproutcore/allfiles.tmpl +56 -0
- data/jsdoc/templates/sproutcore/class.tmpl +408 -326
- data/jsdoc/templates/sproutcore/index.tmpl +30 -31
- data/jsdoc/templates/sproutcore/publish.js +173 -81
- data/jsdoc/templates/sproutcore/static/default.css +191 -0
- data/jsdoc/templates/sproutcore/static/header.html +2 -0
- data/jsdoc/templates/sproutcore/static/index.html +19 -0
- data/jsdoc/templates/sproutcore/symbol.tmpl +35 -0
- data/jsdoc/test/addon.js +24 -0
- data/jsdoc/test/anon_inner.js +14 -0
- data/jsdoc/test/augments.js +31 -0
- data/jsdoc/test/augments2.js +26 -0
- data/jsdoc/test/borrows.js +41 -0
- data/jsdoc/test/borrows2.js +23 -0
- data/jsdoc/test/config.js +22 -0
- data/jsdoc/test/constructs.js +18 -0
- data/jsdoc/test/encoding.js +10 -0
- data/jsdoc/test/encoding_other.js +12 -0
- data/jsdoc/test/functions_anon.js +39 -0
- data/jsdoc/test/functions_nested.js +33 -0
- data/jsdoc/test/global.js +13 -0
- data/jsdoc/test/globals.js +25 -0
- data/jsdoc/test/ignore.js +10 -0
- data/jsdoc/test/inner.js +16 -0
- data/jsdoc/test/jsdoc_test.js +477 -0
- data/jsdoc/test/lend.js +33 -0
- data/jsdoc/test/memberof.js +20 -0
- data/jsdoc/test/memberof_constructor.js +15 -0
- data/jsdoc/test/name.js +19 -0
- data/jsdoc/test/namespace_nested.js +23 -0
- data/jsdoc/test/nocode.js +13 -0
- data/jsdoc/test/oblit_anon.js +20 -0
- data/jsdoc/test/overview.js +20 -0
- data/jsdoc/test/param_inline.js +37 -0
- data/jsdoc/test/params_optional.js +8 -0
- data/jsdoc/test/prototype.js +17 -0
- data/jsdoc/test/prototype_nested.js +9 -0
- data/jsdoc/test/prototype_oblit.js +13 -0
- data/jsdoc/test/prototype_oblit_constructor.js +24 -0
- data/jsdoc/test/public.js +10 -0
- data/jsdoc/test/shared.js +42 -0
- data/jsdoc/test/shared2.js +2 -0
- data/jsdoc/test/shortcuts.js +22 -0
- data/jsdoc/test/static_this.js +13 -0
- data/jsdoc/test/synonyms.js +23 -0
- data/jsdoc/test/tosource.js +23 -0
- data/jsdoc/test/variable_redefine.js +14 -0
- data/jsdoc/test.js +304 -0
- data/lib/sproutcore/build_tools/resource_builder.rb +6 -1
- data/lib/sproutcore/bundle_installer.rb +268 -0
- data/lib/sproutcore/jsdoc.rb +7 -6
- data/lib/sproutcore/library.rb +38 -0
- data/lib/sproutcore/merb/bundle_controller.rb +8 -4
- data/lib/sproutcore/version.rb +1 -1
- data/lib/sproutcore.rb +1 -1
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/txt2html +0 -0
- metadata +117 -29
- data/clients/view_builder/core.js +0 -19
- data/clients/view_builder/english.lproj/body.css +0 -149
- data/clients/view_builder/english.lproj/body.rhtml +0 -18
- data/clients/view_builder/english.lproj/strings.js +0 -14
- data/clients/view_builder/main.js +0 -37
- data/jsdoc/app/DocFile.js +0 -137
- data/jsdoc/app/DocTag.js +0 -110
- data/jsdoc/app/Doclet.js +0 -63
- data/jsdoc/app/Dumper.js +0 -143
- data/jsdoc/app/JsDoc.js +0 -103
- data/jsdoc/app/JsHilite.js +0 -45
- data/jsdoc/app/JsIO.js +0 -163
- data/jsdoc/app/JsParse.js +0 -385
- data/jsdoc/app/JsPlate.js +0 -130
- data/jsdoc/app/JsTestrun.js +0 -129
- data/jsdoc/app/JsToke.js +0 -564
- data/jsdoc/app/Symbol.js +0 -298
- data/jsdoc/app/Transformer.js +0 -14
- data/jsdoc/app/Util.js +0 -97
- data/jsdoc/app/js.jar +0 -0
- data/jsdoc/plugins/min.js +0 -316
- data/jsdoc/plugins/strip.js +0 -20
- data/jsdoc/templates/sproutcore/default.css +0 -191
- data/jsdoc/templates/sproutcore/index.html +0 -13
- data/jsdoc/templates/sproutcore/prototype.js +0 -4186
- data/jsdoc/templates/sproutcore/splash.html +0 -7
@@ -0,0 +1,200 @@
|
|
1
|
+
if (typeof JSDOC == "undefined") JSDOC = {};
|
2
|
+
|
3
|
+
/**
|
4
|
+
Create a new DocComment. This takes a raw documentation comment,
|
5
|
+
and wraps it in useful accessors.
|
6
|
+
@class Represents a documentation comment object.
|
7
|
+
*/
|
8
|
+
JSDOC.DocComment = function(/**String*/comment) {
|
9
|
+
this.init();
|
10
|
+
if (typeof comment != "undefined") {
|
11
|
+
this.parse(comment);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
JSDOC.DocComment.prototype.init = function() {
|
16
|
+
this.isUserComment = true;
|
17
|
+
this.src = "";
|
18
|
+
this.meta = "";
|
19
|
+
this.tagTexts = [];
|
20
|
+
this.tags = [];
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
@requires JSDOC.DocTag
|
25
|
+
*/
|
26
|
+
JSDOC.DocComment.prototype.parse = function(/**String*/comment) {
|
27
|
+
if (comment == "") {
|
28
|
+
comment = "/** @desc */";
|
29
|
+
this.isUserComment = false;
|
30
|
+
}
|
31
|
+
|
32
|
+
this.src = JSDOC.DocComment.unwrapComment(comment);
|
33
|
+
|
34
|
+
this.meta = "";
|
35
|
+
if (this.src.indexOf("#") == 0) {
|
36
|
+
this.src.match(/#(.+[+-])([\s\S]*)$/);
|
37
|
+
if (RegExp.$1) this.meta = RegExp.$1;
|
38
|
+
if (RegExp.$2) this.src = RegExp.$2;
|
39
|
+
}
|
40
|
+
|
41
|
+
this.fixDesc();
|
42
|
+
|
43
|
+
if (typeof JSDOC.PluginManager != "undefined") {
|
44
|
+
JSDOC.PluginManager.run("onDocCommentSrc", this);
|
45
|
+
}
|
46
|
+
|
47
|
+
this.src = JSDOC.DocComment.shared+"\n"+this.src;
|
48
|
+
|
49
|
+
this.tagTexts =
|
50
|
+
this.src
|
51
|
+
.split(/(^|[\r\n])\s*@/)
|
52
|
+
.filter(function($){return $.match(/\S/)});
|
53
|
+
|
54
|
+
/**
|
55
|
+
The tags found in the comment.
|
56
|
+
@type JSDOC.DocTag[]
|
57
|
+
*/
|
58
|
+
this.tags = this.tagTexts.map(function($){return new JSDOC.DocTag($)});
|
59
|
+
|
60
|
+
if (typeof JSDOC.PluginManager != "undefined") {
|
61
|
+
JSDOC.PluginManager.run("onDocCommentTags", this);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
/*t:
|
66
|
+
plan(5, "testing JSDOC.DocComment");
|
67
|
+
requires("../frame/String.js");
|
68
|
+
requires("../lib/JSDOC/DocTag.js");
|
69
|
+
|
70
|
+
var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
|
71
|
+
is(com.tagTexts[0], "foo some\ncomment here", "first tag text is found.");
|
72
|
+
is(com.tags[0].title, "foo", "the title is found in a comment with one tag.");
|
73
|
+
|
74
|
+
var com = new JSDOC.DocComment("/** @foo first\n* @bar second*"+"/");
|
75
|
+
is(com.getTag("bar").length, 1, "getTag() returns one tag by that title.");
|
76
|
+
|
77
|
+
JSDOC.DocComment.shared = "@author John Smith";
|
78
|
+
var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/");
|
79
|
+
is(com.tags[0].title, "author", "shared comment is added.");
|
80
|
+
is(com.tags[1].title, "foo", "shared comment is added to existing tag.");
|
81
|
+
*/
|
82
|
+
|
83
|
+
/**
|
84
|
+
If no @desc tag is provided, this function will add it.
|
85
|
+
*/
|
86
|
+
JSDOC.DocComment.prototype.fixDesc = function() {
|
87
|
+
if (this.meta && this.meta != "@+") return;
|
88
|
+
if (/^\s*[^@\s]/.test(this.src)) {
|
89
|
+
this.src = "@desc "+this.src;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
/*t:
|
94
|
+
plan(5, "testing JSDOC.DocComment#fixDesc");
|
95
|
+
|
96
|
+
var com = new JSDOC.DocComment();
|
97
|
+
|
98
|
+
com.src = "this is a desc\n@author foo";
|
99
|
+
com.fixDesc();
|
100
|
+
is(com.src, "@desc this is a desc\n@author foo", "if no @desc tag is provided one is added.");
|
101
|
+
|
102
|
+
com.src = "x";
|
103
|
+
com.fixDesc();
|
104
|
+
is(com.src, "@desc x", "if no @desc tag is provided one is added to a single character.");
|
105
|
+
|
106
|
+
com.src = "\nx";
|
107
|
+
com.fixDesc();
|
108
|
+
is(com.src, "@desc \nx", "if no @desc tag is provided one is added to return and character.");
|
109
|
+
|
110
|
+
com.src = " ";
|
111
|
+
com.fixDesc();
|
112
|
+
is(com.src, " ", "if no @desc tag is provided one is not added to just whitespace.");
|
113
|
+
|
114
|
+
com.src = "";
|
115
|
+
com.fixDesc();
|
116
|
+
is(com.src, "", "if no @desc tag is provided one is not added to empty.");
|
117
|
+
*/
|
118
|
+
|
119
|
+
/**
|
120
|
+
Remove slash-star comment wrapper from a raw comment string.
|
121
|
+
@type String
|
122
|
+
*/
|
123
|
+
JSDOC.DocComment.unwrapComment = function(/**String*/comment) {
|
124
|
+
if (!comment) return "";
|
125
|
+
var unwrapped = comment.replace(/(^\/\*\*|\*\/$)/g, "").replace(/^\s*\* ?/gm, "");
|
126
|
+
return unwrapped;
|
127
|
+
}
|
128
|
+
|
129
|
+
/*t:
|
130
|
+
plan(5, "testing JSDOC.DocComment.unwrapComment");
|
131
|
+
|
132
|
+
var com = "/**x*"+"/";
|
133
|
+
var unwrapped = JSDOC.DocComment.unwrapComment(com);
|
134
|
+
is(unwrapped, "x", "a single character jsdoc is found.");
|
135
|
+
|
136
|
+
com = "/***x*"+"/";
|
137
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
138
|
+
is(unwrapped, "x", "three stars are allowed in the opener.");
|
139
|
+
|
140
|
+
com = "/****x*"+"/";
|
141
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
142
|
+
is(unwrapped, "*x", "fourth star in the opener is kept.");
|
143
|
+
|
144
|
+
com = "/**x\n * y\n*"+"/";
|
145
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
146
|
+
is(unwrapped, "x\ny\n", "leading stars and spaces are trimmed.");
|
147
|
+
|
148
|
+
com = "/**x\n * y\n*"+"/";
|
149
|
+
unwrapped = JSDOC.DocComment.unwrapComment(com);
|
150
|
+
is(unwrapped, "x\n y\n", "only first space after leading stars are trimmed.");
|
151
|
+
*/
|
152
|
+
|
153
|
+
/**
|
154
|
+
Provides a printable version of the comment.
|
155
|
+
@type String
|
156
|
+
*/
|
157
|
+
JSDOC.DocComment.prototype.toString = function() {
|
158
|
+
return this.src;
|
159
|
+
}
|
160
|
+
|
161
|
+
/*t:
|
162
|
+
plan(1, "testing JSDOC.DocComment#fixDesc");
|
163
|
+
var com = new JSDOC.DocComment();
|
164
|
+
com.src = "foo";
|
165
|
+
is(""+com, "foo", "stringifying a comment returns the unwrapped src.");
|
166
|
+
*/
|
167
|
+
|
168
|
+
/**
|
169
|
+
Given the title of a tag, returns all tags that have that title.
|
170
|
+
@type JSDOC.DocTag[]
|
171
|
+
*/
|
172
|
+
JSDOC.DocComment.prototype.getTag = function(/**String*/tagTitle) {
|
173
|
+
return this.tags.filter(function($){return $.title == tagTitle});
|
174
|
+
}
|
175
|
+
|
176
|
+
/*t:
|
177
|
+
plan(1, "testing JSDOC.DocComment#getTag");
|
178
|
+
requires("../frame/String.js");
|
179
|
+
requires("../lib/JSDOC/DocTag.js");
|
180
|
+
|
181
|
+
var com = new JSDOC.DocComment("/**@foo some\n* @bar\n* @bar*"+"/");
|
182
|
+
is(com.getTag("bar").length, 2, "getTag returns expected number of tags.");
|
183
|
+
*/
|
184
|
+
|
185
|
+
/**
|
186
|
+
Used to store the currently shared tag text.
|
187
|
+
*/
|
188
|
+
JSDOC.DocComment.shared = "";
|
189
|
+
|
190
|
+
/*t:
|
191
|
+
plan(2, "testing JSDOC.DocComment.shared");
|
192
|
+
requires("../frame/String.js");
|
193
|
+
requires("../lib/JSDOC/DocTag.js");
|
194
|
+
|
195
|
+
JSDOC.DocComment.shared = "@author Michael";
|
196
|
+
|
197
|
+
var com = new JSDOC.DocComment("/**@foo\n* @foo*"+"/");
|
198
|
+
is(com.getTag("author").length, 1, "getTag returns shared tag.");
|
199
|
+
is(com.getTag("foo").length, 2, "getTag returns unshared tags too.");
|
200
|
+
*/
|
@@ -0,0 +1,294 @@
|
|
1
|
+
if (typeof JSDOC == "undefined") JSDOC = {};
|
2
|
+
|
3
|
+
/**
|
4
|
+
@constructor
|
5
|
+
*/
|
6
|
+
JSDOC.DocTag = function(src) {
|
7
|
+
this.init();
|
8
|
+
if (typeof src != "undefined") {
|
9
|
+
this.parse(src);
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
/**
|
14
|
+
Create and initialize the properties of this.
|
15
|
+
*/
|
16
|
+
JSDOC.DocTag.prototype.init = function() {
|
17
|
+
this.title = "";
|
18
|
+
this.type = "";
|
19
|
+
this.name = "";
|
20
|
+
this.isOptional = false;
|
21
|
+
this.defaultValue = "";
|
22
|
+
this.desc = "";
|
23
|
+
|
24
|
+
return this;
|
25
|
+
}
|
26
|
+
|
27
|
+
/**
|
28
|
+
Populate the properties of this from the given tag src.
|
29
|
+
@param {string} src
|
30
|
+
*/
|
31
|
+
JSDOC.DocTag.prototype.parse = function(src) {
|
32
|
+
if (typeof src != "string") throw "src must be a string not "+(typeof src);
|
33
|
+
|
34
|
+
try {
|
35
|
+
src = this.nibbleTitle(src);
|
36
|
+
if (JSDOC.PluginManager) {
|
37
|
+
JSDOC.PluginManager.run("onDocTagSynonym", this);
|
38
|
+
}
|
39
|
+
|
40
|
+
src = this.nibbleType(src);
|
41
|
+
|
42
|
+
// only some tags are allowed to have names.
|
43
|
+
if (this.title == "param" || this.title == "property" || this.title == "config") { // @config is deprecated
|
44
|
+
src = this.nibbleName(src);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
catch(e) {
|
48
|
+
if (LOG) LOG.warn(e);
|
49
|
+
else throw e;
|
50
|
+
}
|
51
|
+
this.desc = src; // whatever is left
|
52
|
+
|
53
|
+
// example tags need to have whitespace preserved
|
54
|
+
if (this.title != "example") this.desc = this.desc.trim();
|
55
|
+
|
56
|
+
if (JSDOC.PluginManager) {
|
57
|
+
JSDOC.PluginManager.run("onDocTag", this);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
/**
|
62
|
+
Automatically called when this is stringified.
|
63
|
+
*/
|
64
|
+
JSDOC.DocTag.prototype.toString = function() {
|
65
|
+
return this.desc;
|
66
|
+
}
|
67
|
+
|
68
|
+
/*t:
|
69
|
+
plan(1, "testing JSDOC.DocTag#toString");
|
70
|
+
|
71
|
+
var tag = new JSDOC.DocTag("param {object} date A valid date.");
|
72
|
+
is(""+tag, "A valid date.", "stringifying a tag returns the desc.");
|
73
|
+
*/
|
74
|
+
|
75
|
+
/**
|
76
|
+
Find and shift off the title of a tag.
|
77
|
+
@param {string} src
|
78
|
+
@return src
|
79
|
+
*/
|
80
|
+
JSDOC.DocTag.prototype.nibbleTitle = function(src) {
|
81
|
+
if (typeof src != "string") throw "src must be a string not "+(typeof src);
|
82
|
+
|
83
|
+
var parts = src.match(/^\s*(\S+)(?:\s([\s\S]*))?$/);
|
84
|
+
|
85
|
+
if (parts && parts[1]) this.title = parts[1];
|
86
|
+
if (parts && parts[2]) src = parts[2];
|
87
|
+
else src = "";
|
88
|
+
|
89
|
+
return src;
|
90
|
+
}
|
91
|
+
|
92
|
+
/*t:
|
93
|
+
plan(8, "testing JSDOC.DocTag#nibbleTitle");
|
94
|
+
|
95
|
+
var tag = new JSDOC.DocTag();
|
96
|
+
|
97
|
+
tag.init().nibbleTitle("aTitleGoesHere");
|
98
|
+
is(tag.title, "aTitleGoesHere", "a title can be found in a single-word string.");
|
99
|
+
|
100
|
+
var src = tag.init().nibbleTitle("aTitleGoesHere and the rest");
|
101
|
+
is(tag.title, "aTitleGoesHere", "a title can be found in a multi-word string.");
|
102
|
+
is(src, "and the rest", "the rest is returned when the title is nibbled off.");
|
103
|
+
|
104
|
+
src = tag.init().nibbleTitle("");
|
105
|
+
is(tag.title, "", "given an empty string the title is empty.");
|
106
|
+
is(src, "", "the rest is empty when the tag is empty.");
|
107
|
+
|
108
|
+
var src = tag.init().nibbleTitle(" aTitleGoesHere\n a description");
|
109
|
+
is(tag.title, "aTitleGoesHere", "leading and trailing spaces are not part of the title.");
|
110
|
+
is(src, " a description", "leading spaces (less one) are part of the description.");
|
111
|
+
|
112
|
+
tag.init().nibbleTitle("a.Title::Goes_Here foo");
|
113
|
+
is(tag.title, "a.Title::Goes_Here", "titles with punctuation are allowed.");
|
114
|
+
*/
|
115
|
+
|
116
|
+
/**
|
117
|
+
Find and shift off the type of a tag.
|
118
|
+
@requires frame/String.js
|
119
|
+
@param {string} src
|
120
|
+
@return src
|
121
|
+
*/
|
122
|
+
JSDOC.DocTag.prototype.nibbleType = function(src) {
|
123
|
+
if (typeof src != "string") throw "src must be a string not "+(typeof src);
|
124
|
+
|
125
|
+
if (src.match(/^\s*\{/)) {
|
126
|
+
var typeRange = src.balance("{", "}");
|
127
|
+
if (typeRange[1] == -1) {
|
128
|
+
throw "Malformed comment tag ignored. Tag type requires an opening { and a closing }: "+src;
|
129
|
+
}
|
130
|
+
this.type = src.substring(typeRange[0]+1, typeRange[1]).trim();
|
131
|
+
this.type = this.type.replace(/\s*,\s*/g, "|"); // multiples can be separated by , or |
|
132
|
+
src = src.substring(typeRange[1]+1);
|
133
|
+
}
|
134
|
+
|
135
|
+
return src;
|
136
|
+
}
|
137
|
+
|
138
|
+
/*t:
|
139
|
+
plan(5, "testing JSDOC.DocTag.parser.nibbleType");
|
140
|
+
requires("../frame/String.js");
|
141
|
+
|
142
|
+
var tag = new JSDOC.DocTag();
|
143
|
+
|
144
|
+
tag.init().nibbleType("{String[]} aliases");
|
145
|
+
is(tag.type, "String[]", "type can have non-alpha characters.");
|
146
|
+
|
147
|
+
tag.init().nibbleType("{ aTypeGoesHere } etc etc");
|
148
|
+
is(tag.type, "aTypeGoesHere", "type is trimmed.");
|
149
|
+
|
150
|
+
tag.init().nibbleType("{ oneType, twoType ,\n threeType } etc etc");
|
151
|
+
is(tag.type, "oneType|twoType|threeType", "multiple types can be separated by commas.");
|
152
|
+
|
153
|
+
var error;
|
154
|
+
try { tag.init().nibbleType("{widget foo"); }
|
155
|
+
catch(e) { error = e; }
|
156
|
+
is(typeof error, "string", "malformed tag type throws error.");
|
157
|
+
isnt(error.indexOf("Malformed"), -1, "error message tells tag is malformed.");
|
158
|
+
*/
|
159
|
+
|
160
|
+
/**
|
161
|
+
Find and shift off the name of a tag.
|
162
|
+
@requires frame/String.js
|
163
|
+
@param {string} src
|
164
|
+
@return src
|
165
|
+
*/
|
166
|
+
JSDOC.DocTag.prototype.nibbleName = function(src) {
|
167
|
+
if (typeof src != "string") throw "src must be a string not "+(typeof src);
|
168
|
+
|
169
|
+
src = src.trim();
|
170
|
+
|
171
|
+
// is optional?
|
172
|
+
if (src.charAt(0) == "[") {
|
173
|
+
var nameRange = src.balance("[", "]");
|
174
|
+
if (nameRange[1] == -1) {
|
175
|
+
throw "Malformed comment tag ignored. Tag optional name requires an opening [ and a closing ]: "+src;
|
176
|
+
}
|
177
|
+
this.name = src.substring(nameRange[0]+1, nameRange[1]).trim();
|
178
|
+
this.isOptional = true;
|
179
|
+
|
180
|
+
src = src.substring(nameRange[1]+1);
|
181
|
+
|
182
|
+
// has default value?
|
183
|
+
var nameAndValue = this.name.split("=");
|
184
|
+
if (nameAndValue.length) {
|
185
|
+
this.name = nameAndValue.shift().trim();
|
186
|
+
this.defaultValue = nameAndValue.join("=");
|
187
|
+
}
|
188
|
+
}
|
189
|
+
else {
|
190
|
+
var parts = src.match(/^(\S+)(?:\s([\s\S]*))?$/);
|
191
|
+
if (parts) {
|
192
|
+
if (parts[1]) this.name = parts[1];
|
193
|
+
if (parts[2]) src = parts[2].trim();
|
194
|
+
else src = "";
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
return src;
|
199
|
+
}
|
200
|
+
|
201
|
+
/*t:
|
202
|
+
requires("../frame/String.js");
|
203
|
+
plan(9, "testing JSDOC.DocTag.parser.nibbleName");
|
204
|
+
|
205
|
+
var tag = new JSDOC.DocTag();
|
206
|
+
|
207
|
+
tag.init().nibbleName("[foo] This is a description.");
|
208
|
+
is(tag.isOptional, true, "isOptional syntax is detected.");
|
209
|
+
is(tag.name, "foo", "optional param name is found.");
|
210
|
+
|
211
|
+
tag.init().nibbleName("[foo] This is a description.");
|
212
|
+
is(tag.isOptional, true, "isOptional syntax is detected when no type.");
|
213
|
+
is(tag.name, "foo", "optional param name is found when no type.");
|
214
|
+
|
215
|
+
tag.init().nibbleName("[foo=7] This is a description.");
|
216
|
+
is(tag.name, "foo", "optional param name is found when default value.");
|
217
|
+
is(tag.defaultValue, 7, "optional param default value is found when default value.");
|
218
|
+
|
219
|
+
//tag.init().nibbleName("[foo= a value] This is a description.");
|
220
|
+
//is(tag.defaultValue, " a value", "optional param default value is found when default value has spaces (issue #112).");
|
221
|
+
|
222
|
+
tag.init().nibbleName("[foo=[]] This is a description.");
|
223
|
+
is(tag.defaultValue, "[]", "optional param default value is found when default value is [] (issue #95).");
|
224
|
+
|
225
|
+
tag.init().nibbleName("[foo=a=b] This is a description.");
|
226
|
+
is(tag.name, "foo", "optional param name is found when default value is a=b.");
|
227
|
+
is(tag.defaultValue, "a=b", "optional param default value is found when default value is a=b.")
|
228
|
+
*/
|
229
|
+
|
230
|
+
/*t:
|
231
|
+
plan(32, "Testing JSDOC.DocTag.parser.");
|
232
|
+
requires("../frame/String.js");
|
233
|
+
|
234
|
+
var tag = new JSDOC.DocTag();
|
235
|
+
|
236
|
+
is(typeof tag, "object", "JSDOC.DocTag.parser with an empty string returns an object.");
|
237
|
+
is(typeof tag.title, "string", "returned object has a string property 'title'.");
|
238
|
+
is(typeof tag.type, "string", "returned object has a string property 'type'.");
|
239
|
+
is(typeof tag.name, "string", "returned object has a string property 'name'.");
|
240
|
+
is(typeof tag.defaultValue, "string", "returned object has a string property 'defaultValue'.");
|
241
|
+
is(typeof tag.isOptional, "boolean", "returned object has a boolean property 'isOptional'.");
|
242
|
+
is(typeof tag.desc, "string", "returned object has a string property 'desc'.");
|
243
|
+
|
244
|
+
tag = new JSDOC.DocTag("param {widget} foo");
|
245
|
+
is(tag.title, "param", "param title is found.");
|
246
|
+
is(tag.name, "foo", "param name is found when desc is missing.");
|
247
|
+
is(tag.desc, "", "param desc is empty when missing.");
|
248
|
+
|
249
|
+
tag = new JSDOC.DocTag("param {object} date A valid date.");
|
250
|
+
is(tag.name, "date", "param name is found with a type.");
|
251
|
+
is(tag.type, "object", "param type is found.");
|
252
|
+
is(tag.desc, "A valid date.", "param desc is found with a type.");
|
253
|
+
|
254
|
+
tag = new JSDOC.DocTag("param aName a description goes\n here.");
|
255
|
+
is(tag.name, "aName", "param name is found without a type.");
|
256
|
+
is(tag.desc, "a description goes\n here.", "param desc is found without a type.");
|
257
|
+
|
258
|
+
tag = new JSDOC.DocTag("param {widget}");
|
259
|
+
is(tag.name, "", "param name is empty when it is not given.");
|
260
|
+
|
261
|
+
tag = new JSDOC.DocTag("param {widget} [foo] This is a description.");
|
262
|
+
is(tag.name, "foo", "optional param name is found.");
|
263
|
+
|
264
|
+
tag = new JSDOC.DocTag("return {aType} This is a description.");
|
265
|
+
is(tag.type, "aType", "when return tag has no name, type is found.");
|
266
|
+
is(tag.desc, "This is a description.", "when return tag has no name, desc is found.");
|
267
|
+
|
268
|
+
tag = new JSDOC.DocTag("author Joe Coder <jcoder@example.com>");
|
269
|
+
is(tag.title, "author", "author tag has a title.");
|
270
|
+
is(tag.type, "", "the author tag has no type.");
|
271
|
+
is(tag.name, "", "the author tag has no name.");
|
272
|
+
is(tag.desc, "Joe Coder <jcoder@example.com>", "author tag has desc.");
|
273
|
+
|
274
|
+
tag = new JSDOC.DocTag("private \t\n ");
|
275
|
+
is(tag.title, "private", "private tag has a title.");
|
276
|
+
is(tag.type, "", "the private tag has no type.");
|
277
|
+
is(tag.name, "", "the private tag has no name.");
|
278
|
+
is(tag.desc, "", "private tag has no desc.");
|
279
|
+
|
280
|
+
tag = new JSDOC.DocTag("example\n example(code);\n more();");
|
281
|
+
is(tag.desc, " example(code);\n more();", "leading whitespace (less one) in examples code is preserved.");
|
282
|
+
|
283
|
+
tag = new JSDOC.DocTag("param theName \n");
|
284
|
+
is(tag.name, "theName", "name only is found.");
|
285
|
+
|
286
|
+
tag = new JSDOC.DocTag("type theDesc \n");
|
287
|
+
is(tag.desc, "theDesc", "desc only is found.");
|
288
|
+
|
289
|
+
tag = new JSDOC.DocTag("type {theType} \n");
|
290
|
+
is(tag.type, "theType", "type only is found.");
|
291
|
+
|
292
|
+
tag = new JSDOC.DocTag("");
|
293
|
+
is(tag.title, "", "title is empty when tag is empty.");
|
294
|
+
*/
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/**
|
2
|
+
@constructor
|
3
|
+
@param [opt] Used to override the commandline options. Useful for testing.
|
4
|
+
@version $Id: JsDoc.js 592 2008-05-09 07:43:33Z micmath $
|
5
|
+
*/
|
6
|
+
JSDOC.JsDoc = function(/**object*/ opt) {
|
7
|
+
if (opt) {
|
8
|
+
JSDOC.opt = opt;
|
9
|
+
}
|
10
|
+
|
11
|
+
// the -c option: use a configuration file
|
12
|
+
if (JSDOC.opt.c) {
|
13
|
+
eval("JSDOC.conf = " + IO.readFile(JSDOC.opt.c));
|
14
|
+
|
15
|
+
LOG.inform("Using configuration file at '"+JSDOC.opt.c+"'.");
|
16
|
+
|
17
|
+
for (var c in JSDOC.conf) {
|
18
|
+
if (c !== "D" && !defined(JSDOC.opt[c])) { // commandline overrules config file
|
19
|
+
JSDOC.opt[c] = JSDOC.conf[c];
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
if (typeof JSDOC.conf["_"] != "undefined") {
|
24
|
+
JSDOC.opt["_"] = JSDOC.opt["_"].concat(JSDOC.conf["_"]);
|
25
|
+
}
|
26
|
+
|
27
|
+
LOG.inform("With configuration: ");
|
28
|
+
for (var o in JSDOC.opt) {
|
29
|
+
LOG.inform(" "+o+": "+JSDOC.opt[o]);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
if (JSDOC.opt.h) {
|
34
|
+
JSDOC.usage();
|
35
|
+
quit();
|
36
|
+
}
|
37
|
+
|
38
|
+
// defend against options that are not sane
|
39
|
+
if (JSDOC.opt._.length == 0) {
|
40
|
+
LOG.warn("No source files to work on. Nothing to do.");
|
41
|
+
quit();
|
42
|
+
}
|
43
|
+
if (JSDOC.opt.t === true || JSDOC.opt.d === true) {
|
44
|
+
JSDOC.usage();
|
45
|
+
}
|
46
|
+
|
47
|
+
if (typeof JSDOC.opt.d == "string") {
|
48
|
+
if (!JSDOC.opt.d.charAt(JSDOC.opt.d.length-1).match(/[\\\/]/)) {
|
49
|
+
JSDOC.opt.d = JSDOC.opt.d+"/";
|
50
|
+
}
|
51
|
+
LOG.inform("Output directory set to '"+JSDOC.opt.d+"'.");
|
52
|
+
IO.mkPath(JSDOC.opt.d);
|
53
|
+
}
|
54
|
+
if (JSDOC.opt.e) IO.setEncoding(JSDOC.opt.e);
|
55
|
+
|
56
|
+
// the -r option: scan source directories recursively
|
57
|
+
if (typeof JSDOC.opt.r == "boolean") JSDOC.opt.r = 10;
|
58
|
+
else if (!isNaN(parseInt(JSDOC.opt.r))) JSDOC.opt.r = parseInt(JSDOC.opt.r);
|
59
|
+
else JSDOC.opt.r = 1;
|
60
|
+
|
61
|
+
// the -D option: define user variables
|
62
|
+
var D = {};
|
63
|
+
if (JSDOC.opt.D) {
|
64
|
+
for (var i = 0; i < JSDOC.opt.D.length; i++) {
|
65
|
+
var defineParts = JSDOC.opt.D[i].split(":", 2);
|
66
|
+
if (defineParts) D[defineParts[0]] = defineParts[1];
|
67
|
+
}
|
68
|
+
}
|
69
|
+
JSDOC.opt.D = D;
|
70
|
+
// combine any conf file D options with the commandline D options
|
71
|
+
if (defined(JSDOC.conf)) for (var c in JSDOC.conf.D) {
|
72
|
+
if (!defined(JSDOC.opt.D[c])) {
|
73
|
+
JSDOC.opt.D[c] = JSDOC.conf.D[c];
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
// Load additional file handlers
|
78
|
+
// the -H option: filetype handlers
|
79
|
+
JSDOC.handlers = {};
|
80
|
+
/*
|
81
|
+
if (JSDOC.opt.H) {
|
82
|
+
for (var i = 0; i < JSDOC.opt.H.length; i++) {
|
83
|
+
var handlerDef = JSDOC.opt.H[i].split(":");
|
84
|
+
LOG.inform("Adding '." + handlerDef[0] + "' content handler from handlers/" + handlerDef[1] + ".js");
|
85
|
+
IO.include("handlers/" + handlerDef[1] + ".js");
|
86
|
+
if (!eval("typeof "+handlerDef[1])) {
|
87
|
+
LOG.warn(handlerDef[1] + "is not defined in "+handlerDef[1] + ".js");
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
JSDOC.handlers[handlerDef[0]] = eval(handlerDef[1]);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
*/
|
95
|
+
// Give plugins a chance to initialize
|
96
|
+
if (defined(JSDOC.PluginManager)) {
|
97
|
+
JSDOC.PluginManager.run("onInit", this);
|
98
|
+
}
|
99
|
+
|
100
|
+
JSDOC.opt.srcFiles = this._getSrcFiles();
|
101
|
+
this._parseSrcFiles();
|
102
|
+
//var handler = symbols.handler;
|
103
|
+
this.symbolSet = JSDOC.Parser.symbols;
|
104
|
+
//this.symbolGroup.handler = handler;
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
Retrieve source file list.
|
109
|
+
@returns {String[]} The pathnames of the files to be parsed.
|
110
|
+
*/
|
111
|
+
JSDOC.JsDoc.prototype._getSrcFiles = function() {
|
112
|
+
this.srcFiles = [];
|
113
|
+
|
114
|
+
var ext = ["js"];
|
115
|
+
if (JSDOC.opt.x) {
|
116
|
+
ext = JSDOC.opt.x.split(",").map(function($) {return $.toLowerCase()});
|
117
|
+
}
|
118
|
+
|
119
|
+
for (var i = 0; i < JSDOC.opt._.length; i++) {
|
120
|
+
this.srcFiles = this.srcFiles.concat(
|
121
|
+
IO.ls(JSDOC.opt._[i], JSDOC.opt.r).filter(
|
122
|
+
function($) {
|
123
|
+
var thisExt = $.split(".").pop().toLowerCase();
|
124
|
+
return (ext.indexOf(thisExt) > -1 || thisExt in JSDOC.handlers); // we're only interested in files with certain extensions
|
125
|
+
}
|
126
|
+
)
|
127
|
+
);
|
128
|
+
}
|
129
|
+
|
130
|
+
return this.srcFiles;
|
131
|
+
}
|
132
|
+
|
133
|
+
JSDOC.JsDoc.prototype._parseSrcFiles = function() {
|
134
|
+
JSDOC.Parser.init();
|
135
|
+
for (var i = 0, l = this.srcFiles.length; i < l; i++) {
|
136
|
+
var srcFile = this.srcFiles[i];
|
137
|
+
|
138
|
+
try {
|
139
|
+
var src = IO.readFile(srcFile);
|
140
|
+
}
|
141
|
+
catch(e) {
|
142
|
+
LOG.warn("Can't read source file '"+srcFile+"': "+e.message);
|
143
|
+
}
|
144
|
+
|
145
|
+
var tr = new JSDOC.TokenReader();
|
146
|
+
var ts = new JSDOC.TokenStream(tr.tokenize(new JSDOC.TextStream(src)));
|
147
|
+
|
148
|
+
JSDOC.Parser.parse(ts, srcFile);
|
149
|
+
|
150
|
+
// try {
|
151
|
+
// LOG.warn("Processing " + srcFile);
|
152
|
+
// var dump = [];
|
153
|
+
// var sym = null;
|
154
|
+
//
|
155
|
+
// for (var idx = 0, len = syms.length; idx < len; idx++) {
|
156
|
+
// sym = syms[idx];
|
157
|
+
// dump.push('"' + sym.alias + '": ' + sym.serialize());
|
158
|
+
// IO.saveFile(JSDOC.opt.d + 'cache/', JSDOC.cacheName(srcFile), '{' + dump.join(',') + '}');
|
159
|
+
// }
|
160
|
+
// } catch(e) {
|
161
|
+
// LOG.warn('problem dumping cache file for ' + srcFile + ': ' + e);
|
162
|
+
// }
|
163
|
+
}
|
164
|
+
JSDOC.Parser.finish();
|
165
|
+
}
|
166
|
+
|
167
|
+
JSDOC.cacheName = function(path) {
|
168
|
+
var parts = path.split('/') ;
|
169
|
+
|
170
|
+
var rootIndex = parts.indexOf('frameworks') ;
|
171
|
+
if (rootIndex < 0) rootIndex = parts.indexOf('clients') ;
|
172
|
+
|
173
|
+
if (rootIndex < 0) {
|
174
|
+
LOG.warn('bad srcPath passed to JSDOC.cacheName');
|
175
|
+
return parts[parts.length - 2] ;
|
176
|
+
}
|
177
|
+
else {
|
178
|
+
return parts.slice(rootIndex, parts.length).join('.') ;
|
179
|
+
}
|
180
|
+
}
|