sc-docs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/.gitignore +4 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +5 -0
  4. data/Gemfile.lock +48 -0
  5. data/LICENSE +21 -0
  6. data/README.md +59 -0
  7. data/bin/sc-docs +5 -0
  8. data/lib/sc_docs.rb +3 -0
  9. data/lib/sc_docs/cli.rb +54 -0
  10. data/lib/sc_docs/docs/Buildfile +8 -0
  11. data/lib/sc_docs/docs/README +8 -0
  12. data/lib/sc_docs/docs/apps/docs/Buildfile +15 -0
  13. data/lib/sc_docs/docs/apps/docs/controllers/classes.js +27 -0
  14. data/lib/sc_docs/docs/apps/docs/controllers/search_controller.js +62 -0
  15. data/lib/sc_docs/docs/apps/docs/controllers/selected_class.js +143 -0
  16. data/lib/sc_docs/docs/apps/docs/core.js +148 -0
  17. data/lib/sc_docs/docs/apps/docs/main.js +41 -0
  18. data/lib/sc_docs/docs/apps/docs/models/class.js +63 -0
  19. data/lib/sc_docs/docs/apps/docs/models/entity.js +29 -0
  20. data/lib/sc_docs/docs/apps/docs/models/method.js +79 -0
  21. data/lib/sc_docs/docs/apps/docs/models/property.js +48 -0
  22. data/lib/sc_docs/docs/apps/docs/resources/images/method_icon.png +0 -0
  23. data/lib/sc_docs/docs/apps/docs/resources/images/property_icon.png +0 -0
  24. data/lib/sc_docs/docs/apps/docs/resources/loading.rhtml +9 -0
  25. data/lib/sc_docs/docs/apps/docs/resources/main_page.css +156 -0
  26. data/lib/sc_docs/docs/apps/docs/resources/main_page.js +91 -0
  27. data/lib/sc_docs/docs/apps/docs/resources/templates/details.handlebars +81 -0
  28. data/lib/sc_docs/docs/apps/docs/resources/templates/extensions/signature.js +0 -0
  29. data/lib/sc_docs/docs/apps/docs/system/jquery_ui.js +62 -0
  30. data/lib/sc_docs/docs/apps/docs/system/showdown.js +1297 -0
  31. data/lib/sc_docs/docs/apps/docs/theme.js +29 -0
  32. data/lib/sc_docs/docs/apps/docs/views/detail_list.js +24 -0
  33. data/lib/sc_docs/docs/apps/docs/views/master_list.js +35 -0
  34. data/lib/sc_docs/docs/apps/docs/views/methods_collection.js +80 -0
  35. data/lib/sc_docs/docs/apps/docs/views/properties_collection.js +9 -0
  36. data/lib/sc_docs/generator.rb +145 -0
  37. data/lib/sc_docs/server.rb +21 -0
  38. data/lib/sc_docs/templates/docs.sproutcore.com/allclasses.tmpl +31 -0
  39. data/lib/sc_docs/templates/docs.sproutcore.com/allfiles.tmpl +66 -0
  40. data/lib/sc_docs/templates/docs.sproutcore.com/class.tmpl +437 -0
  41. data/lib/sc_docs/templates/docs.sproutcore.com/index.tmpl +52 -0
  42. data/lib/sc_docs/templates/docs.sproutcore.com/output/css/api.css +619 -0
  43. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/apidocs.jpg +0 -0
  44. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/apidocs.png +0 -0
  45. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/clearinput.png +0 -0
  46. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/cross.png +0 -0
  47. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/ddiagonal.png +0 -0
  48. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/diagonal.png +0 -0
  49. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/docbullet.jpg +0 -0
  50. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/docbullet.png +0 -0
  51. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/glow.png +0 -0
  52. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/logo.png +0 -0
  53. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/pixels.png +0 -0
  54. data/lib/sc_docs/templates/docs.sproutcore.com/output/img/search.png +0 -0
  55. data/lib/sc_docs/templates/docs.sproutcore.com/output/js/api.js +134 -0
  56. data/lib/sc_docs/templates/docs.sproutcore.com/output/js/jquery-bbq.js +18 -0
  57. data/lib/sc_docs/templates/docs.sproutcore.com/output/js/lib/jquery-1.5.1.min.js +16 -0
  58. data/lib/sc_docs/templates/docs.sproutcore.com/output/js/lib/modernizr-1.7.min.js +2 -0
  59. data/lib/sc_docs/templates/docs.sproutcore.com/output/js/plugin.js +1 -0
  60. data/lib/sc_docs/templates/docs.sproutcore.com/output/js/script.js +5 -0
  61. data/lib/sc_docs/templates/docs.sproutcore.com/publish.js +200 -0
  62. data/lib/sc_docs/templates/docs.sproutcore.com/static/default.css +300 -0
  63. data/lib/sc_docs/templates/docs.sproutcore.com/static/header.html +19 -0
  64. data/lib/sc_docs/templates/docs.sproutcore.com/static/index.html +19 -0
  65. data/lib/sc_docs/templates/docs.sproutcore.com/symbol.tmpl +35 -0
  66. data/lib/sc_docs/templates/sc_fixture/publish.js +632 -0
  67. data/lib/sc_docs/version.rb +4 -0
  68. data/sc_docs.gemspec +27 -0
  69. data/vendor/jsdoc/README.txt +109 -0
  70. data/vendor/jsdoc/app/frame.js +33 -0
  71. data/vendor/jsdoc/app/frame/Chain.js +102 -0
  72. data/vendor/jsdoc/app/frame/Dumper.js +144 -0
  73. data/vendor/jsdoc/app/frame/Hash.js +84 -0
  74. data/vendor/jsdoc/app/frame/Link.js +173 -0
  75. data/vendor/jsdoc/app/frame/Namespace.js +10 -0
  76. data/vendor/jsdoc/app/frame/Opt.js +134 -0
  77. data/vendor/jsdoc/app/frame/Reflection.js +26 -0
  78. data/vendor/jsdoc/app/frame/String.js +93 -0
  79. data/vendor/jsdoc/app/frame/Testrun.js +129 -0
  80. data/vendor/jsdoc/app/handlers/FOODOC.js +26 -0
  81. data/vendor/jsdoc/app/handlers/XMLDOC.js +26 -0
  82. data/vendor/jsdoc/app/handlers/XMLDOC/DomReader.js +159 -0
  83. data/vendor/jsdoc/app/handlers/XMLDOC/XMLDoc.js +16 -0
  84. data/vendor/jsdoc/app/handlers/XMLDOC/XMLParse.js +292 -0
  85. data/vendor/jsdoc/app/lib/JSDOC.js +106 -0
  86. data/vendor/jsdoc/app/lib/JSDOC/DocComment.js +204 -0
  87. data/vendor/jsdoc/app/lib/JSDOC/DocTag.js +294 -0
  88. data/vendor/jsdoc/app/lib/JSDOC/JsDoc.js +140 -0
  89. data/vendor/jsdoc/app/lib/JSDOC/JsPlate.js +109 -0
  90. data/vendor/jsdoc/app/lib/JSDOC/Lang.js +144 -0
  91. data/vendor/jsdoc/app/lib/JSDOC/Parser.js +146 -0
  92. data/vendor/jsdoc/app/lib/JSDOC/PluginManager.js +33 -0
  93. data/vendor/jsdoc/app/lib/JSDOC/Symbol.js +644 -0
  94. data/vendor/jsdoc/app/lib/JSDOC/SymbolSet.js +243 -0
  95. data/vendor/jsdoc/app/lib/JSDOC/TextStream.js +41 -0
  96. data/vendor/jsdoc/app/lib/JSDOC/Token.js +18 -0
  97. data/vendor/jsdoc/app/lib/JSDOC/TokenReader.js +332 -0
  98. data/vendor/jsdoc/app/lib/JSDOC/TokenStream.js +133 -0
  99. data/vendor/jsdoc/app/lib/JSDOC/Util.js +32 -0
  100. data/vendor/jsdoc/app/lib/JSDOC/Walker.js +507 -0
  101. data/vendor/jsdoc/app/main.js +111 -0
  102. data/vendor/jsdoc/app/plugins/commentSrcJson.js +20 -0
  103. data/vendor/jsdoc/app/plugins/frameworkPrototype.js +16 -0
  104. data/vendor/jsdoc/app/plugins/functionCall.js +10 -0
  105. data/vendor/jsdoc/app/plugins/publishSrcHilite.js +62 -0
  106. data/vendor/jsdoc/app/plugins/symbolLink.js +10 -0
  107. data/vendor/jsdoc/app/plugins/tagParamConfig.js +31 -0
  108. data/vendor/jsdoc/app/plugins/tagSynonyms.js +43 -0
  109. data/vendor/jsdoc/app/run.js +297 -0
  110. data/vendor/jsdoc/app/t/TestDoc.js +144 -0
  111. data/vendor/jsdoc/app/t/runner.js +13 -0
  112. data/vendor/jsdoc/app/test.js +342 -0
  113. data/vendor/jsdoc/app/test/addon.js +24 -0
  114. data/vendor/jsdoc/app/test/anon_inner.js +14 -0
  115. data/vendor/jsdoc/app/test/augments.js +31 -0
  116. data/vendor/jsdoc/app/test/augments2.js +26 -0
  117. data/vendor/jsdoc/app/test/borrows.js +46 -0
  118. data/vendor/jsdoc/app/test/borrows2.js +23 -0
  119. data/vendor/jsdoc/app/test/config.js +22 -0
  120. data/vendor/jsdoc/app/test/constructs.js +18 -0
  121. data/vendor/jsdoc/app/test/encoding.js +10 -0
  122. data/vendor/jsdoc/app/test/encoding_other.js +12 -0
  123. data/vendor/jsdoc/app/test/event.js +54 -0
  124. data/vendor/jsdoc/app/test/exports.js +14 -0
  125. data/vendor/jsdoc/app/test/functions_anon.js +39 -0
  126. data/vendor/jsdoc/app/test/functions_nested.js +33 -0
  127. data/vendor/jsdoc/app/test/global.js +13 -0
  128. data/vendor/jsdoc/app/test/globals.js +25 -0
  129. data/vendor/jsdoc/app/test/ignore.js +10 -0
  130. data/vendor/jsdoc/app/test/inner.js +16 -0
  131. data/vendor/jsdoc/app/test/jsdoc_test.js +477 -0
  132. data/vendor/jsdoc/app/test/lend.js +33 -0
  133. data/vendor/jsdoc/app/test/memberof.js +19 -0
  134. data/vendor/jsdoc/app/test/memberof2.js +38 -0
  135. data/vendor/jsdoc/app/test/memberof3.js +33 -0
  136. data/vendor/jsdoc/app/test/memberof_constructor.js +17 -0
  137. data/vendor/jsdoc/app/test/module.js +17 -0
  138. data/vendor/jsdoc/app/test/multi_methods.js +25 -0
  139. data/vendor/jsdoc/app/test/name.js +19 -0
  140. data/vendor/jsdoc/app/test/namespace_nested.js +23 -0
  141. data/vendor/jsdoc/app/test/nocode.js +13 -0
  142. data/vendor/jsdoc/app/test/oblit_anon.js +20 -0
  143. data/vendor/jsdoc/app/test/overview.js +20 -0
  144. data/vendor/jsdoc/app/test/param_inline.js +37 -0
  145. data/vendor/jsdoc/app/test/params_optional.js +8 -0
  146. data/vendor/jsdoc/app/test/prototype.js +17 -0
  147. data/vendor/jsdoc/app/test/prototype_nested.js +9 -0
  148. data/vendor/jsdoc/app/test/prototype_oblit.js +13 -0
  149. data/vendor/jsdoc/app/test/prototype_oblit_constructor.js +24 -0
  150. data/vendor/jsdoc/app/test/public.js +10 -0
  151. data/vendor/jsdoc/app/test/scripts/code.js +5 -0
  152. data/vendor/jsdoc/app/test/scripts/notcode.txt +5 -0
  153. data/vendor/jsdoc/app/test/shared.js +42 -0
  154. data/vendor/jsdoc/app/test/shared2.js +2 -0
  155. data/vendor/jsdoc/app/test/shortcuts.js +22 -0
  156. data/vendor/jsdoc/app/test/static_this.js +13 -0
  157. data/vendor/jsdoc/app/test/synonyms.js +31 -0
  158. data/vendor/jsdoc/app/test/tosource.js +23 -0
  159. data/vendor/jsdoc/app/test/variable_redefine.js +14 -0
  160. data/vendor/jsdoc/changes.txt +127 -0
  161. data/vendor/jsdoc/conf/sample.conf +31 -0
  162. metadata +240 -0
@@ -0,0 +1,144 @@
1
+ var TestDoc = {
2
+ fails: 0,
3
+ plans: 0,
4
+ passes: 0,
5
+ results: []
6
+ };
7
+
8
+ TestDoc.record = function(result) {
9
+ TestDoc.results.push(result);
10
+ if (typeof result.verdict == "boolean") {
11
+ if (result.verdict === false) TestDoc.fails++;
12
+ if (result.verdict === true) TestDoc.passes++;
13
+ }
14
+ }
15
+
16
+ TestDoc.prove = function(filePath) {
17
+ if (typeof document != "undefined" && typeof document.write != "undefined") {
18
+ if (TestDoc.console) print = function(s) { TestDoc.console.appendChild(document.createTextNode(s+"\n")); }
19
+ else print = function(s) { document.write(s+"<br />"); }
20
+ }
21
+ TestDoc.run(TestDoc.readFile(filePath));
22
+ }
23
+
24
+ TestDoc.run = function(src) {
25
+ try { eval(src); } catch(e) { print("# ERROR! "+e); }
26
+
27
+ var chunks = src.split(/\/\*t:/);
28
+
29
+ var run = function(chunk) {
30
+ // local shortcuts
31
+ var is = TestDoc.assertEquals;
32
+ var isnt = TestDoc.assertNotEquals;
33
+ var plan = TestDoc.plan;
34
+ var requires = TestDoc.requires;
35
+
36
+ try { eval(chunk); } catch(e) { print("# ERROR! "+e); }
37
+ }
38
+ for (var start = -1, end = 0; (start = src.indexOf("/*t:", end)) > end; start = end) {
39
+ run(
40
+ src.substring(
41
+ start+4,
42
+ (end = src.indexOf("*/", start))
43
+ )
44
+ );
45
+ }
46
+ }
47
+
48
+ TestDoc.Result = function(verdict, message) {
49
+ this.verdict = verdict;
50
+ this.message = message;
51
+ }
52
+
53
+ TestDoc.Result.prototype.toString = function() {
54
+ if (typeof this.verdict == "boolean") {
55
+ return (this.verdict? "ok" : "not ok") + " " + (++TestDoc.report.counter) + " - " + this.message;
56
+ }
57
+
58
+ return "# " + this.message;
59
+ }
60
+
61
+ TestDoc.requires = function(file) {
62
+ if (!TestDoc.requires.loaded[file]) {
63
+ load(file);
64
+ TestDoc.requires.loaded[file] = true;
65
+ }
66
+ }
67
+ TestDoc.requires.loaded = {};
68
+
69
+ TestDoc.report = function() {
70
+ TestDoc.report.counter = 0;
71
+ print("1.."+TestDoc.plans);
72
+ for (var i = 0; i < TestDoc.results.length; i++) {
73
+ print(TestDoc.results[i]);
74
+ }
75
+ print("----------------------------------------");
76
+ if (TestDoc.fails == 0 && TestDoc.passes == TestDoc.plans) {
77
+ print("All tests successful.");
78
+ }
79
+ else {
80
+ print("Failed " + TestDoc.fails + "/" + TestDoc.plans + " tests, "+((TestDoc.plans == 0)? 0 : Math.round(TestDoc.passes/(TestDoc.passes+TestDoc.fails)*10000)/100)+"% okay. Planned to run "+TestDoc.plans+", did run "+(TestDoc.passes+TestDoc.fails)+".")
81
+ }
82
+ }
83
+
84
+ TestDoc.plan = function(n, message) {
85
+ TestDoc.plans += n;
86
+ TestDoc.record(new TestDoc.Result(null, message+" ("+n+" tests)"));
87
+ }
88
+
89
+ TestDoc.assertEquals = function(a, b, message) {
90
+ var result = (a == b);
91
+ if (!result) message += "\n#\n# " + a + " does not equal " + b + "\n#";
92
+ TestDoc.record(new TestDoc.Result(result, message));
93
+ }
94
+
95
+ TestDoc.assertNotEquals = function(a, b, message) {
96
+ var result = (a != b);
97
+ if (!result) message += "\n#\n# " + a + " equals " + b + "\n#";
98
+ TestDoc.record(new TestDoc.Result(result, message));
99
+ }
100
+
101
+ TestDoc.readFile = (function(){
102
+ // rhino
103
+ if (typeof readFile == "function") {
104
+ return function(url) {
105
+ var text = readFile(url);
106
+ return text || "";
107
+ }
108
+ }
109
+
110
+ // a web browser
111
+ else {
112
+ return function(url) {
113
+ var httpRequest;
114
+
115
+ if (window.XMLHttpRequest) { // Mozilla, Safari, etc
116
+ httpRequest = new XMLHttpRequest();
117
+ }
118
+ else if (window.ActiveXObject) { // IE
119
+ try {
120
+ httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
121
+ }
122
+ catch (e) {
123
+ try {
124
+ httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
125
+ }
126
+ catch (e) {
127
+ }
128
+ }
129
+ }
130
+
131
+ if (!httpRequest) { throw "Cannot create HTTP Request."; }
132
+
133
+ httpRequest.open('GET', url, false);
134
+ httpRequest.send('');
135
+ if (httpRequest.readyState == 4) {
136
+ if (httpRequest.status >= 400) {
137
+ throw "The HTTP Request returned an error code: "+httpRequest.status;
138
+ }
139
+ }
140
+
141
+ return httpRequest.responseText || "";
142
+ }
143
+ }
144
+ })();
@@ -0,0 +1,13 @@
1
+ // try: java -jar ../../jsrun.jar runner.js
2
+
3
+ load("TestDoc.js");
4
+
5
+ TestDoc.prove("../frame/Opt.js");
6
+ TestDoc.prove("../lib/JSDOC.js");
7
+ TestDoc.prove("../frame/String.js");
8
+ TestDoc.prove("../lib/JSDOC/DocTag.js");
9
+ TestDoc.prove("../lib/JSDOC/DocComment.js");
10
+ TestDoc.prove("../lib/JSDOC/TokenReader.js");
11
+ TestDoc.prove("../lib/JSDOC/Symbol.js");
12
+
13
+ TestDoc.report();
@@ -0,0 +1,342 @@
1
+ load("app/frame/Dumper.js");
2
+ function symbolize(opt) {
3
+ symbols = null;
4
+ JSDOC.JsDoc(opt);
5
+ symbols = JSDOC.JsDoc.symbolSet;
6
+ }
7
+
8
+ var testCases = [
9
+ function() {
10
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/overview.js"]});
11
+ //print(Dumper.dump(symbols));
12
+ is('symbols.getSymbolByName("My Cool Library").name', 'My Cool Library', 'File overview can be found by alias.');
13
+ }
14
+ ,
15
+ function() {
16
+ symbolize({_: [SYS.pwd+"test/name.js"]});
17
+
18
+ is('symbols.getSymbol("Response").name', "Response", 'Virtual class name is found.');
19
+ is('symbols.getSymbol("Response#text").alias', "Response#text", 'Virtual method name is found.');
20
+ is('symbols.getSymbol("Response#text").memberOf', "Response", 'Virtual method parent name is found.');
21
+ }
22
+ ,
23
+ function() {
24
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/prototype.js"]});
25
+
26
+ is('symbols.getSymbol("Article").name', "Article", 'Function set to constructor prototype with inner constructor name is found.');
27
+ is('symbols.getSymbol("Article").hasMethod("init")', true, 'The initializer method name of prototype function is correct.');
28
+ is('symbols.getSymbol("Article").hasMember("counter")', true, 'A static property set in the prototype definition is found.');
29
+ is('symbols.getSymbol("Article").hasMember("title")', true, 'An instance property set in the prototype is found.');
30
+ is('symbols.getSymbol("Article#title").isStatic', false, 'An instance property has isStatic set to false.');
31
+ is('symbols.getSymbol("Article.counter").name', "counter", 'A static property set in the initializer has the name set correctly.');
32
+ is('symbols.getSymbol("Article.counter").memberOf', "Article", 'A static property set in the initializer has the memberOf set correctly.');
33
+ is('symbols.getSymbol("Article.counter").isStatic', true, 'A static property set in the initializer has isStatic set to true.');
34
+ }
35
+ ,
36
+ function() {
37
+ symbolize({a:true, _: [SYS.pwd+"test/prototype_oblit.js"]});
38
+
39
+ is('symbols.getSymbol("Article").name', "Article", 'Oblit set to constructor prototype name is found.');
40
+ is('typeof symbols.getSymbol("Article.prototype")', "undefined", 'The prototype oblit is not a symbol.');
41
+ is('symbols.getSymbol("Article#getTitle").name', "getTitle", 'The nonstatic method name of prototype oblit is correct.');
42
+ is('symbols.getSymbol("Article#getTitle").alias', "Article#getTitle", 'The alias of non-static method of prototype oblit is correct.');
43
+ is('symbols.getSymbol("Article#getTitle").isStatic', false, 'The isStatic of a nonstatic method of prototype oblit is correct.');
44
+ is('symbols.getSymbol("Article.getTitle").name', "getTitle", 'The static method name of prototype oblit is correct.');
45
+ is('symbols.getSymbol("Article.getTitle").isStatic', true, 'The isStatic of a static method of prototype oblit is correct.');
46
+ is('symbols.getSymbol("Article#getTitle").isa', "FUNCTION", 'The isa of non-static method of prototype oblit is correct.');
47
+ is('symbols.getSymbol("Article.getTitle").alias', "Article.getTitle", 'The alias of a static method of prototype oblit is correct.');
48
+ is('symbols.getSymbol("Article.getTitle").isa', "FUNCTION", 'The isa of static method of prototype oblit is correct.');
49
+ }
50
+ ,
51
+ function() {
52
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/prototype_oblit_constructor.js"]});
53
+
54
+ is('symbols.getSymbol("Article").name', "Article", 'Oblit set to constructor prototype with inner constructor name is found.');
55
+ is('symbols.getSymbol("Article#init").name', "init", 'The initializer method name of prototype oblit is correct.');
56
+ is('symbols.getSymbol("Article").hasMember("pages")', true, 'Property set by initializer method "this" is on the outer constructor.');
57
+ is('symbols.getSymbol("Article#Title").name', "Title", 'Name of the inner constructor name is found.');
58
+ is('symbols.getSymbol("Article#Title").memberOf', "Article", 'The memberOf of the inner constructor name is found.');
59
+ is('symbols.getSymbol("Article#Title").isa', "CONSTRUCTOR", 'The isa of the inner constructor name is constructor.');
60
+ is('symbols.getSymbol("Article#Title").hasMember("title")', true, 'A property set on the inner constructor "this" is on the inner constructor.');
61
+ }
62
+ ,
63
+ function() {
64
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/inner.js"]});
65
+
66
+ is('symbols.getSymbol("Outer").name', "Outer", 'Outer constructor prototype name is found.');
67
+ is('symbols.getSymbol("Outer").methods.length', 1, 'Inner function doesnt appear as a method of the outer.');
68
+ is('symbols.getSymbol("Outer").hasMethod("open")', true, 'Outer constructors methods arent affected by inner function.');
69
+ is('symbols.getSymbol("Outer-Inner").alias', "Outer-Inner", 'Alias of inner function is found.');
70
+ is('symbols.getSymbol("Outer-Inner").isa', "CONSTRUCTOR", 'isa of inner function constructor is found.');
71
+ is('symbols.getSymbol("Outer-Inner").memberOf', "Outer", 'The memberOf of inner function is found.');
72
+ is('symbols.getSymbol("Outer-Inner").name', "Inner", 'The name of inner function is found.');
73
+ is('symbols.getSymbol("Outer-Inner#name").name', "name", 'A member of the inner function constructor, attached to "this" is found on inner.');
74
+ is('symbols.getSymbol("Outer-Inner#name").memberOf', "Outer-Inner", 'The memberOf of an inner function member is found.');
75
+ }
76
+ ,
77
+ function() {
78
+ symbolize({a:true, _: [SYS.pwd+"test/prototype_nested.js"]});
79
+
80
+ is('symbols.getSymbol("Word").name', "Word", 'Base constructor name is found.');
81
+ is('symbols.getSymbol("Word").hasMethod("reverse")', true, 'Base constructor method is found.');
82
+ is('symbols.getSymbol("Word").methods.length', 1, 'Base constructor has only one method.');
83
+ is('symbols.getSymbol("Word").memberOf', "", 'Base constructor memberOf is empty.');
84
+ is('symbols.getSymbol("Word#reverse").name', "reverse", 'Member of constructor prototype name is found.');
85
+ is('symbols.getSymbol("Word#reverse").memberOf', "Word", 'Member of constructor prototype memberOf is found.');
86
+ is('symbols.getSymbol("Word#reverse.utf8").name', "utf8", 'Member of constructor prototype method name is found.');
87
+ is('symbols.getSymbol("Word#reverse.utf8").memberOf', "Word#reverse", 'Static nested member memberOf is found.');
88
+ }
89
+ ,
90
+ function() {
91
+ symbolize({a:true, _: [SYS.pwd+"test/namespace_nested.js"]});
92
+
93
+ is('symbols.getSymbol("ns1").name', "ns1", 'Base namespace name is found.');
94
+ is('symbols.getSymbol("ns1").memberOf', "", 'Base namespace memberOf is empty (its a constructor).');
95
+ is('symbols.getSymbol("ns1.ns2").name', "ns2", 'Nested namespace name is found.');
96
+ is('symbols.getSymbol("ns1.ns2").alias', "ns1.ns2", 'Nested namespace alias is found.');
97
+ is('symbols.getSymbol("ns1.ns2").memberOf', "ns1", 'Nested namespace memberOf is found.');
98
+ is('symbols.getSymbol("ns1.ns2.Function1").name', "Function1", 'Method of nested namespace name is found.');
99
+ is('symbols.getSymbol("ns1.ns2.Function1").memberOf', "ns1.ns2", 'Constructor of nested namespace memberOf is found.');
100
+ }
101
+ ,
102
+ function() {
103
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/functions_nested.js"]});
104
+
105
+ is('symbols.getSymbol("Zop").name', "Zop", 'Any constructor name is found.');
106
+ is('symbols.getSymbol("Zop").isa', "CONSTRUCTOR", 'It isa constructor.');
107
+ is('symbols.getSymbol("Zop").hasMethod("zap")', true, 'Its method name, set later, is in methods array.');
108
+ is('symbols.getSymbol("Foo").name', "Foo", 'The containing constructor name is found.');
109
+ is('symbols.getSymbol("Foo").hasMethod("methodOne")', true, 'Its method name is found.');
110
+ is('symbols.getSymbol("Foo").hasMethod("methodTwo")', true, 'Its second method name is found.');
111
+ is('symbols.getSymbol("Foo#methodOne").alias', "Foo#methodOne", 'A methods alias is found.');
112
+ is('symbols.getSymbol("Foo#methodOne").isStatic', false, 'A methods is not static.');
113
+ is('symbols.getSymbol("Bar").name', "Bar", 'A global function declared inside another function is found.');
114
+ is('symbols.getSymbol("Bar").isa', "FUNCTION", 'It isa function.');
115
+ is('symbols.getSymbol("Bar").memberOf', "_global_", 'It is global.');
116
+ is('symbols.getSymbol("Foo-inner").name', "inner", 'An inner functions name is found.');
117
+ is('symbols.getSymbol("Foo-inner").memberOf', "Foo", 'It is member of the outer function.');
118
+ is('symbols.getSymbol("Foo-inner").isInner', true, 'It is an inner function.');
119
+ }
120
+ ,
121
+ function() {
122
+ symbolize({a:true, _: [SYS.pwd+"test/memberof_constructor.js"]});
123
+
124
+ is('symbols.getSymbol("Circle#Tangent").name', "Tangent", 'Constructor set on prototype using @member has correct name.');
125
+ is('symbols.getSymbol("Circle#Tangent").memberOf', "Circle", 'Constructor set on prototype using @member has correct memberOf.');
126
+ is('symbols.getSymbol("Circle#Tangent").alias', "Circle#Tangent", 'Constructor set on prototype using @member has correct alias.');
127
+ is('symbols.getSymbol("Circle#Tangent").isa', "CONSTRUCTOR", 'Constructor set on prototype using @member has correct isa.');
128
+ is('symbols.getSymbol("Circle#Tangent").isStatic', false, 'Constructor set on prototype using @member is not static.');
129
+ is('symbols.getSymbol("Circle#Tangent#getDiameter").name', "getDiameter", 'Method set on prototype using @member has correct name.');
130
+ is('symbols.getSymbol("Circle#Tangent#getDiameter").memberOf', "Circle#Tangent", 'Method set on prototype using @member has correct memberOf.');
131
+ is('symbols.getSymbol("Circle#Tangent#getDiameter").alias', "Circle#Tangent#getDiameter", 'Method set on prototype using @member has correct alias.');
132
+ is('symbols.getSymbol("Circle#Tangent#getDiameter").isa', "FUNCTION", 'Method set on prototype using @member has correct isa.');
133
+ is('symbols.getSymbol("Circle#Tangent#getDiameter").isStatic', false, 'Method set on prototype using @member is not static.');
134
+ }
135
+ ,
136
+ function() {
137
+ symbolize({a:true, p: true, _: [SYS.pwd+"test/memberof.js"]});
138
+
139
+ is('symbols.getSymbol("pack.install").alias', "pack.install", 'Using @memberOf sets alias, when parent name is in memberOf tag.');
140
+ is('symbols.getSymbol("pack.install.overwrite").name', "install.overwrite", 'Using @memberOf sets name, even if the name is dotted.');
141
+ is('symbols.getSymbol("pack.install.overwrite").memberOf', "pack", 'Using @memberOf sets memberOf.');
142
+ is('symbols.getSymbol("pack.install.overwrite").isStatic', true, 'Using @memberOf with value not ending in octothorp sets isStatic to true.');
143
+ }
144
+ ,
145
+ function() {
146
+ symbolize({a:true, p: true, _: [SYS.pwd+"test/memberof2.js"]});
147
+
148
+ is('symbols.getSymbol("Foo#bar").alias', "Foo#bar", 'An inner function can be documented as an instance method.');
149
+ is('symbols.getSymbol("Foo.zip").alias', "Foo.zip", 'An inner function can be documented as a static method.');
150
+ is('symbols.getSymbol("Foo.Fiz").alias', "Foo.Fiz", 'An inner function can be documented as a static constructor.');
151
+ is('symbols.getSymbol("Foo.Fiz#fipple").alias', "Foo.Fiz#fipple", 'An inner function can be documented as a static constructor with a method.');
152
+ is('symbols.getSymbol("Foo#blat").alias', "Foo#blat", 'An global function can be documented as an instance method.');
153
+ }
154
+ ,
155
+ function() {
156
+ symbolize({a:true, p: true, _: [SYS.pwd+"test/memberof3.js"]});
157
+
158
+ is('symbols.getSymbol("Foo#bar").alias', "Foo#bar", 'A virtual field can be documented as an instance method.');
159
+ is('symbols.getSymbol("Foo2#bar").alias', "Foo2#bar", 'A virtual field with the same name can be documented as an instance method.');
160
+ }
161
+ ,
162
+ function() {
163
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/borrows.js"]});
164
+
165
+ is('symbols.getSymbol("Layout").name', "Layout", 'Constructor can be found.');
166
+ is('symbols.getSymbol("Layout").hasMethod("init")', true, 'Constructor method name can be found.');
167
+ is('symbols.getSymbol("Layout").hasMember("orientation")', true, 'Constructor property name can be found.');
168
+
169
+ is('symbols.getSymbol("Page").hasMethod("reset")', true, 'Second constructor method name can be found.');
170
+ is('symbols.getSymbol("Page").hasMember("orientation")', true, 'Second constructor borrowed property name can be found in properties.');
171
+ is('symbols.getSymbol("Page#orientation").memberOf', "Page", 'Second constructor borrowed property memberOf can be found.');
172
+ is('symbols.getSymbol("Page-getInnerElements").alias', "Page-getInnerElements", 'Can borrow an inner function and it is still inner.');
173
+ is('symbols.getSymbol("Page.units").alias', "Page.units", 'Can borrow a static function and it is still static.');
174
+
175
+ is('symbols.getSymbol("ThreeColumnPage#init").alias', "ThreeColumnPage#init", 'Third constructor method can be found even though method with same name is borrowed.');
176
+ is('symbols.getSymbol("ThreeColumnPage#reset").alias', "ThreeColumnPage#reset", 'Borrowed method can be found.');
177
+ is('symbols.getSymbol("ThreeColumnPage#orientation").alias', "ThreeColumnPage#orientation", 'Twice borrowed method can be found.');
178
+
179
+ }
180
+ ,
181
+ function() {
182
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/borrows2.js"]});
183
+
184
+ is('symbols.getSymbol("Foo").hasMethod("my_zop")', true, 'Borrowed method can be found.');
185
+ is('symbols.getSymbol("Bar").hasMethod("my_zip")', true, 'Second borrowed method can be found.');
186
+ }
187
+ ,
188
+ function() {
189
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/constructs.js"]});
190
+
191
+ is('symbols.getSymbol("Person").hasMethod("say")', true, 'The constructs tag creates a class that lends can add a method to.');
192
+ }
193
+ ,
194
+ function() {
195
+ symbolize({a: true, _: [SYS.pwd+"test/augments.js", SYS.pwd+"test/augments2.js"]});
196
+
197
+ is('symbols.getSymbol("Page").augments[0]', "Layout", 'An augmented class can be found.');
198
+ is('symbols.getSymbol("Page#reset").alias', "Page#reset", 'Method of augmenter can be found.');
199
+ is('symbols.getSymbol("Page").hasMethod("Layout#init")', true, 'Method from augmented can be found.');
200
+ is('symbols.getSymbol("Page").hasMember("Layout#orientation")', true, 'Property from augmented can be found.');
201
+ is('symbols.getSymbol("Page").methods.length', 3, 'Methods of augmented class are included in methods array.');
202
+
203
+ is('symbols.getSymbol("ThreeColumnPage").augments[0]', "Page", 'The extends tag is a synonym for augments.');
204
+ is('symbols.getSymbol("ThreeColumnPage").hasMethod("ThreeColumnPage#init")', true, 'Local method overrides augmented method of same name.');
205
+ is('symbols.getSymbol("ThreeColumnPage").methods.length', 3, 'Local method count is right.');
206
+
207
+ is('symbols.getSymbol("NewsletterPage").augments[0]', "ThreeColumnPage", 'Can augment across file boundaries.');
208
+ is('symbols.getSymbol("NewsletterPage").augments.length', 2, 'Multiple augments are supported.');
209
+ is('symbols.getSymbol("NewsletterPage").inherits[0].alias', "Junkmail#annoy", 'Inherited method with augments.');
210
+ is('symbols.getSymbol("NewsletterPage").methods.length', 6, 'Methods of augmented class are included in methods array across files.');
211
+ is('symbols.getSymbol("NewsletterPage").properties.length', 1, 'Properties of augmented class are included in properties array across files.');
212
+ }
213
+ ,
214
+ function() {
215
+ symbolize({a:true, _: [SYS.pwd+"test/static_this.js"]});
216
+
217
+ is('symbols.getSymbol("box.holder").name', "holder", 'Static namespace name can be found.');
218
+ is('symbols.getSymbol("box.holder.foo").name', "foo", 'Static namespace method name can be found.');
219
+ is('symbols.getSymbol("box.holder").isStatic', true, 'Static namespace method is static.');
220
+
221
+ is('symbols.getSymbol("box.holder.counter").name', "counter", 'Instance namespace property name set on "this" can be found.');
222
+ is('symbols.getSymbol("box.holder.counter").alias', "box.holder.counter", 'Instance namespace property alias set on "this" can be found.');
223
+ is('symbols.getSymbol("box.holder.counter").memberOf', "box.holder", 'Static namespace property memberOf set on "this" can be found.');
224
+ }
225
+ ,
226
+ function() {
227
+ symbolize({a:true, p: true, _: [SYS.pwd+"test/lend.js"]});
228
+
229
+ is('symbols.getSymbol("Person").name', "Person", 'Class defined in lend comment is found.');
230
+ is('symbols.getSymbol("Person").hasMethod("initialize")', true, 'Lent instance method name can be found.');
231
+ is('symbols.getSymbol("Person").hasMethod("say")', true, 'Second instance method can be found.');
232
+ is('symbols.getSymbol("Person#sing").isStatic', false, 'Instance method is known to be not static.');
233
+
234
+ is('symbols.getSymbol("Person.getCount").name', "getCount", 'Static method name from second lend comment can be found.');
235
+ is('symbols.getSymbol("Person.getCount").isStatic', true, 'Static method from second lend comment is known to be static.');
236
+
237
+ is('LOG.warnings.filter(function($){if($.indexOf("notok") > -1) return $}).length', 1, 'A warning is emitted when lending to an undocumented parent.');
238
+ }
239
+ ,
240
+ function() {
241
+ symbolize({a:true, _: [SYS.pwd+"test/param_inline.js"]});
242
+
243
+ is('symbols.getSymbol("Layout").params[0].type', "int", 'Inline param name is set.');
244
+ is('symbols.getSymbol("Layout").params[0].desc', "The number of columns.", 'Inline param desc is set from comment.');
245
+ is('symbols.getSymbol("Layout#getElement").params[0].name', "id", 'User defined param documentation takes precedence over parser defined.');
246
+ is('symbols.getSymbol("Layout#getElement").params[0].isOptional', true, 'Default for param is to not be optional.');
247
+ is('symbols.getSymbol("Layout#getElement").params[1].isOptional', false, 'Can mark a param as being optional.');
248
+ is('symbols.getSymbol("Layout#getElement").params[1].type', "number|string", 'Type of inline param doc can have multiple values.');
249
+ is('symbols.getSymbol("Layout#Canvas").params[0].type', "", 'Type can be not defined for some params.');
250
+ is('symbols.getSymbol("Layout#Canvas").params[2].type', "int", 'Type can be defined inline for only some params.');
251
+ is('symbols.getSymbol("Layout#rotate").params.length', 0, 'Docomments inside function sig is ignored without a param.');
252
+ is('symbols.getSymbol("Layout#init").params[2].type', "zoppler", 'Doc comment type overrides inline type for param with same name.');
253
+ }
254
+ ,
255
+ function() {
256
+ symbolize({a: true, _: [SYS.pwd+"test/shared.js", SYS.pwd+"test/shared2.js"]});
257
+
258
+ is('symbols.getSymbol("Array#some").name', 'some', 'The name of a symbol in a shared section is found.');
259
+ is('symbols.getSymbol("Array#some").alias', 'Array#some', 'The alias of a symbol in a shared section is found.');
260
+ is('symbols.getSymbol("Array#some").desc', "Extension to builtin array.", 'A description can be shared.');
261
+ is('symbols.getSymbol("Array#filter").desc', "Extension to builtin array.\nChange every element of an array.", 'A shared description is appended.');
262
+ is('symbols.getSymbol("Queue").desc', "A first in, first out data structure.", 'A description is not shared when outside a shared section.');
263
+ is('symbols.getSymbol("Queue.rewind").alias', "Queue.rewind", 'Second shared tag can be started.');
264
+ is('symbols.getSymbol("startOver").alias', "startOver", 'Shared tag doesnt cross over files.');
265
+ }
266
+ ,
267
+ function() {
268
+ symbolize({a: true, _: [SYS.pwd+"test/config.js"]});
269
+ is('symbols.getSymbol("Contact").params[0].name', 'person', 'The name of a param is found.');
270
+ is('symbols.getSymbol("Contact").params[1].name', 'person.name', 'The name of a param set with a dot name is found.');
271
+ is('symbols.getSymbol("Contact").params[2].name', 'person.age', 'The name of a second param set with a dot name is found.');
272
+ is('symbols.getSymbol("Contact").params[4].name', 'connection', 'The name of a param after config is found.');
273
+
274
+ is('symbols.getSymbol("Family").params[0].name', 'persons', 'Another name of a param is found.');
275
+ is('symbols.getSymbol("Family").params[1].name', 'persons.Father', 'The name of a param+config is found.');
276
+ is('symbols.getSymbol("Family").params[2].name', 'persons.Mother', 'The name of a second param+config is found.');
277
+ is('symbols.getSymbol("Family").params[3].name', 'persons.Children', 'The name of a third param+config is found.');
278
+ }
279
+ ,
280
+ function() {
281
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/ignore.js"]});
282
+ is('LOG.warnings.filter(function($){if($.indexOf("undocumented symbol Ignored") > -1) return $}).length', 1, 'A warning is emitted when documenting members of an ignored parent.');
283
+ }
284
+ ,
285
+ function() {
286
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/functions_anon.js"]});
287
+ is('symbols.getSymbol("a.b").alias', 'a.b', 'In anonymous constructor this is found to be the container object.');
288
+ is('symbols.getSymbol("a.f").alias', 'a.f', 'In anonymous constructor this can have a method.');
289
+ is('symbols.getSymbol("a.c").alias', 'a.c', 'In anonymous constructor method this is found to be the container object.');
290
+ is('symbols.getSymbol("g").alias', 'g', 'In anonymous function executed inline this is the global.');
291
+ is('symbols.getSymbol("bar2.p").alias', 'bar2.p', 'In named constructor executed inline this is the container object.');
292
+ is('symbols.getSymbol("module.pub").alias', 'module.pub', 'In parenthesized anonymous function executed inline function scoped variables arent documented.');
293
+ }
294
+ ,
295
+ function() {
296
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/oblit_anon.js"]});
297
+ is('symbols.getSymbol("opt").name', 'opt', 'Anonymous object properties are created.');
298
+ is('symbols.getSymbol("opt.conf.keep").alias', 'opt.conf.keep', 'Anonymous object first property is assigned to $anonymous.');
299
+ is('symbols.getSymbol("opt.conf.base").alias', 'opt.conf.base', 'Anonymous object second property is assigned to $anonymous.');
300
+ }
301
+ ,
302
+ function() {
303
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/params_optional.js"]});
304
+ is('symbols.getSymbol("Document").params.length', 3, 'Correct number of params are found when optional param syntax is used.');
305
+ is('symbols.getSymbol("Document").params[1].name', "id", 'Name of optional param is found.');
306
+ is('symbols.getSymbol("Document").params[1].isOptional', true, 'Optional param is marked isOptional.');
307
+ is('symbols.getSymbol("Document").params[2].name', "title", 'Name of optional param with default value is found.');
308
+ is('symbols.getSymbol("Document").params[2].isOptional', true, 'Optional param with default value is marked isOptional.');
309
+ is('symbols.getSymbol("Document").params[2].defaultValue', " This is untitled.", 'Optional param default value is found.');
310
+ }
311
+ ,
312
+ function() {
313
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/synonyms.js"]});
314
+ is('symbols.getSymbol("myObject.myFunc").type', 'function', 'Type can be set to function.');
315
+ }
316
+ ,
317
+ function() {
318
+ symbolize({a:true, p:true, _: [SYS.pwd+"test/event.js"]});
319
+ is('symbols.getSymbol("Kitchen#event:cakeEaten").isEvent', true, 'Function with event prefix is an event.');
320
+ is('symbols.getSymbol("Kitchen#cakeEaten").isa', "FUNCTION", 'Function with same name as event isa function.');
321
+ }
322
+ ,
323
+ function() {
324
+ symbolize({x:"js", a:true, _: [SYS.pwd+"test/scripts/"]});
325
+ is('JSDOC.JsDoc.srcFiles.length', 1, 'Only js files are scanned when -x=js.');
326
+ }
327
+ ,
328
+ function() {
329
+ symbolize({x:"js", a:true, _: [SYS.pwd+"test/exports.js"]});
330
+ is('symbols.getSymbol("mxn.Map#doThings").name', 'doThings', 'Exports creates a documentation alias that can have methods.');
331
+ }
332
+ ,
333
+ function() {
334
+ symbolize({p:true, a:true, _: [SYS.pwd+"test/module.js"]});
335
+ is('symbols.getSymbol("myProject.myModule.myPublicMethod").name', 'myPublicMethod', 'A function wrapped in parens can be recognized.');
336
+ is('symbols.getSymbol("myProject.myModule-myPrivateMethod").name', 'myPrivateMethod', 'A private method in the scope of a function wrapped in parens can be recognized.');
337
+ is('symbols.getSymbol("myProject.myModule-myPrivateVar").name', 'myPrivateVar', 'A private member in the scope of a function wrapped in parens can be recognized.');
338
+ }
339
+ ];
340
+
341
+ //// run and print results
342
+ print(testrun(testCases));