yard 0.2.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of yard might be problematic. Click here for more details.

Files changed (365) hide show
  1. data/.yardopts +12 -10
  2. data/ChangeLog +5686 -0
  3. data/{README.markdown → README.md} +65 -11
  4. data/Rakefile +25 -13
  5. data/benchmarks/concat_vs_join.rb +12 -0
  6. data/benchmarks/erb_vs_erubis.rb +14 -14
  7. data/benchmarks/marshal_vs_dbm.rb +1 -1
  8. data/benchmarks/pathname_vs_string.rb +50 -0
  9. data/benchmarks/template_erb.rb +22 -0
  10. data/benchmarks/template_format.rb +6 -0
  11. data/benchmarks/template_profile.rb +17 -0
  12. data/bin/yri +16 -7
  13. data/docs/{CODE_OBJECTS.markdown → CodeObjects.md} +0 -0
  14. data/docs/{GETTING_STARTED.markdown → GettingStarted.md} +49 -11
  15. data/docs/{GLOSSARY.markdown → Glossary.md} +0 -0
  16. data/docs/{HANDLERS.markdown → Handlers.md} +5 -5
  17. data/docs/{OVERVIEW.markdown → Overview.md} +9 -13
  18. data/docs/{PARSER.markdown → Parser.md} +1 -1
  19. data/docs/{TAGS.markdown → Tags.md} +1 -1
  20. data/docs/Templates.md +286 -0
  21. data/docs/{WHATSNEW.markdown → WhatsNew.md} +82 -2
  22. data/lib/rubygems_plugin.rb +17 -20
  23. data/lib/yard.rb +47 -1
  24. data/lib/yard/autoload.rb +38 -47
  25. data/lib/yard/cli/yard_graph.rb +36 -13
  26. data/lib/yard/cli/yardoc.rb +74 -12
  27. data/lib/yard/code_objects/base.rb +182 -14
  28. data/lib/yard/code_objects/class_object.rb +39 -2
  29. data/lib/yard/code_objects/class_variable_object.rb +4 -0
  30. data/lib/yard/code_objects/constant_object.rb +8 -0
  31. data/lib/yard/code_objects/extended_method_object.rb +14 -0
  32. data/lib/yard/code_objects/method_object.rb +60 -2
  33. data/lib/yard/code_objects/module_object.rb +6 -0
  34. data/lib/yard/code_objects/namespace_object.rb +99 -2
  35. data/lib/yard/code_objects/proxy.rb +53 -6
  36. data/lib/yard/code_objects/root_object.rb +2 -0
  37. data/lib/yard/core_ext/array.rb +61 -0
  38. data/lib/yard/core_ext/file.rb +21 -4
  39. data/lib/yard/core_ext/module.rb +11 -1
  40. data/lib/yard/core_ext/string.rb +13 -2
  41. data/lib/yard/core_ext/symbol_hash.rb +51 -3
  42. data/lib/yard/docstring.rb +68 -19
  43. data/lib/yard/globals.rb +5 -2
  44. data/lib/yard/handlers/base.rb +13 -3
  45. data/lib/yard/handlers/processor.rb +64 -2
  46. data/lib/yard/handlers/ruby/class_handler.rb +1 -1
  47. data/lib/yard/handlers/ruby/class_variable_handler.rb +5 -1
  48. data/lib/yard/handlers/ruby/constant_handler.rb +38 -4
  49. data/lib/yard/handlers/ruby/exception_handler.rb +1 -0
  50. data/lib/yard/handlers/ruby/legacy/base.rb +2 -2
  51. data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +6 -3
  52. data/lib/yard/handlers/ruby/legacy/constant_handler.rb +21 -2
  53. data/lib/yard/handlers/ruby/legacy/method_handler.rb +10 -0
  54. data/lib/yard/handlers/ruby/legacy/yield_handler.rb +2 -1
  55. data/lib/yard/handlers/ruby/method_handler.rb +10 -0
  56. data/lib/yard/handlers/ruby/yield_handler.rb +2 -1
  57. data/lib/yard/logging.rb +17 -0
  58. data/lib/yard/parser/ruby/ast_node.rb +101 -0
  59. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +2 -2
  60. data/lib/yard/parser/ruby/legacy/statement_list.rb +10 -9
  61. data/lib/yard/parser/ruby/ruby_parser.rb +32 -3
  62. data/lib/yard/parser/source_parser.rb +82 -5
  63. data/lib/yard/rake/yardoc_task.rb +38 -3
  64. data/lib/yard/registry.rb +112 -2
  65. data/lib/yard/serializers/base.rb +48 -1
  66. data/lib/yard/serializers/file_system_serializer.rb +23 -2
  67. data/lib/yard/serializers/process_serializer.rb +10 -0
  68. data/lib/yard/serializers/stdout_serializer.rb +11 -0
  69. data/lib/yard/tags/library.rb +4 -1
  70. data/lib/yard/tags/overload_tag.rb +3 -12
  71. data/lib/yard/templates/engine.rb +162 -0
  72. data/lib/yard/{generators → templates}/helpers/base_helper.rb +14 -13
  73. data/lib/yard/{generators → templates}/helpers/filter_helper.rb +1 -1
  74. data/lib/yard/templates/helpers/html_helper.rb +287 -0
  75. data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +29 -0
  76. data/lib/yard/templates/helpers/html_syntax_highlight_helper18.rb +27 -0
  77. data/lib/yard/{generators → templates}/helpers/markup_helper.rb +15 -11
  78. data/lib/yard/{generators → templates}/helpers/method_helper.rb +8 -1
  79. data/lib/yard/templates/helpers/module_helper.rb +15 -0
  80. data/lib/yard/templates/helpers/text_helper.rb +60 -0
  81. data/lib/yard/templates/helpers/uml_helper.rb +33 -0
  82. data/lib/yard/templates/template.rb +355 -0
  83. data/lib/yard/verifier.rb +110 -0
  84. data/spec/cli/yardoc_spec.rb +23 -1
  85. data/spec/code_objects/base_spec.rb +8 -0
  86. data/spec/code_objects/class_object_spec.rb +166 -156
  87. data/spec/code_objects/method_object_spec.rb +2 -2
  88. data/spec/code_objects/module_object_spec.rb +112 -110
  89. data/spec/code_objects/proxy_spec.rb +9 -0
  90. data/spec/core_ext/array_spec.rb +33 -0
  91. data/spec/core_ext/file_spec.rb +40 -12
  92. data/spec/core_ext/module_spec.rb +15 -0
  93. data/spec/core_ext/string_spec.rb +10 -2
  94. data/spec/docstring_spec.rb +157 -135
  95. data/spec/handlers/class_handler_spec.rb +3 -0
  96. data/spec/handlers/class_variable_handler_spec.rb +3 -1
  97. data/spec/handlers/constant_handler_spec.rb +38 -0
  98. data/spec/handlers/examples/class_handler_001.rb.txt +14 -1
  99. data/spec/handlers/examples/class_variable_handler_001.rb.txt +1 -0
  100. data/spec/handlers/examples/constant_handler_001.rb.txt +10 -1
  101. data/spec/handlers/examples/exception_handler_001.rb.txt +5 -0
  102. data/spec/handlers/examples/method_handler_001.rb.txt +15 -0
  103. data/spec/handlers/examples/mixin_handler_001.rb.txt +13 -0
  104. data/spec/handlers/exception_handler_spec.rb +4 -0
  105. data/spec/handlers/method_handler_spec.rb +22 -0
  106. data/spec/handlers/mixin_handler_spec.rb +5 -3
  107. data/spec/handlers/yield_handler_spec.rb +1 -1
  108. data/spec/parser/ruby/ast_node_spec.rb +16 -0
  109. data/spec/parser/ruby/legacy/statement_list_spec.rb +36 -0
  110. data/spec/parser/ruby/ruby_parser_spec.rb +80 -0
  111. data/spec/parser/source_parser_spec.rb +48 -2
  112. data/spec/rake/yardoc_task_spec.rb +62 -25
  113. data/spec/serializers/file_system_serializer_spec.rb +1 -1
  114. data/spec/templates/class_spec.rb +34 -0
  115. data/spec/templates/engine_spec.rb +121 -0
  116. data/spec/templates/examples/class001.html +271 -0
  117. data/spec/templates/examples/class001.txt +31 -0
  118. data/spec/templates/examples/method001.html +96 -0
  119. data/spec/templates/examples/method001.txt +28 -0
  120. data/spec/templates/examples/method002.html +81 -0
  121. data/spec/templates/examples/method002.txt +20 -0
  122. data/spec/templates/examples/method003.html +137 -0
  123. data/spec/templates/examples/method003.txt +45 -0
  124. data/spec/templates/examples/module001.dot +31 -0
  125. data/spec/templates/examples/module001.html +294 -0
  126. data/spec/templates/examples/module001.txt +33 -0
  127. data/spec/templates/examples/tag001.txt +82 -0
  128. data/spec/templates/helpers/base_helper_spec.rb +129 -0
  129. data/spec/{generators → templates}/helpers/html_helper_spec.rb +73 -16
  130. data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +39 -0
  131. data/spec/{generators → templates}/helpers/markup_helper_spec.rb +6 -7
  132. data/spec/templates/method_spec.rb +75 -0
  133. data/spec/templates/module_spec.rb +50 -0
  134. data/spec/templates/spec_helper.rb +33 -0
  135. data/spec/templates/tag_spec.rb +39 -0
  136. data/spec/templates/template_spec.rb +398 -0
  137. data/spec/verifier_spec.rb +51 -0
  138. data/spec/yard_spec.rb +46 -0
  139. data/templates/default/class/dot/setup.rb +6 -0
  140. data/templates/default/class/dot/superklass.erb +3 -0
  141. data/templates/default/class/html/constructor_details.erb +8 -0
  142. data/templates/default/class/html/setup.rb +1 -0
  143. data/templates/default/class/html/subclasses.erb +4 -0
  144. data/templates/default/class/setup.rb +29 -0
  145. data/templates/default/class/text/setup.rb +11 -0
  146. data/templates/default/class/text/subclasses.erb +5 -0
  147. data/templates/default/docstring/html/abstract.erb +4 -0
  148. data/templates/default/docstring/html/deprecated.erb +1 -0
  149. data/templates/default/docstring/html/index.erb +5 -0
  150. data/templates/default/docstring/html/note.erb +6 -0
  151. data/templates/default/docstring/html/text.erb +1 -0
  152. data/templates/default/docstring/html/todo.erb +6 -0
  153. data/templates/default/docstring/setup.rb +39 -0
  154. data/templates/default/docstring/text/abstract.erb +2 -0
  155. data/templates/default/docstring/text/deprecated.erb +2 -0
  156. data/templates/default/docstring/text/index.erb +2 -0
  157. data/templates/default/docstring/text/note.erb +4 -0
  158. data/templates/default/docstring/text/text.erb +1 -0
  159. data/templates/default/docstring/text/todo.erb +4 -0
  160. data/templates/default/fulldoc/html/css/common.css +1 -0
  161. data/templates/default/fulldoc/html/css/full_list.css +23 -0
  162. data/templates/default/fulldoc/html/css/style.css +261 -0
  163. data/templates/default/fulldoc/html/full_list.erb +36 -0
  164. data/templates/default/fulldoc/html/js/app.js +91 -0
  165. data/templates/default/fulldoc/html/js/full_list.js +39 -0
  166. data/templates/default/fulldoc/html/js/jquery.js +19 -0
  167. data/templates/default/fulldoc/html/setup.rb +86 -0
  168. data/templates/default/{uml → layout}/dot/header.erb +2 -2
  169. data/templates/default/layout/dot/setup.rb +14 -0
  170. data/templates/default/layout/html/breadcrumb.erb +11 -0
  171. data/templates/default/layout/html/footer.erb +5 -0
  172. data/templates/default/layout/html/headers.erb +13 -0
  173. data/templates/default/layout/html/index.erb +49 -0
  174. data/templates/default/layout/html/layout.erb +20 -0
  175. data/templates/default/layout/html/search.erb +5 -0
  176. data/templates/default/layout/html/setup.rb +58 -0
  177. data/templates/default/method/html/header.erb +14 -3
  178. data/templates/default/method/setup.rb +3 -0
  179. data/templates/default/method/text/header.erb +1 -1
  180. data/templates/default/method_details/html/header.erb +3 -0
  181. data/templates/default/method_details/html/method_signature.erb +17 -0
  182. data/templates/default/method_details/html/source.erb +10 -0
  183. data/templates/default/method_details/setup.rb +8 -0
  184. data/templates/default/method_details/text/header.erb +10 -0
  185. data/templates/default/method_details/text/method_signature.erb +12 -0
  186. data/templates/default/method_details/text/setup.rb +10 -0
  187. data/templates/default/module/dot/child.erb +1 -0
  188. data/templates/default/module/dot/dependencies.erb +3 -0
  189. data/templates/default/{uml/dot/subgraph.erb → module/dot/header.erb} +3 -3
  190. data/templates/default/{uml → module}/dot/info.erb +4 -4
  191. data/templates/default/module/dot/setup.rb +14 -0
  192. data/templates/default/module/html/attribute_details.erb +11 -0
  193. data/templates/default/module/html/attribute_summary.erb +8 -0
  194. data/templates/default/module/html/box_info.erb +32 -0
  195. data/templates/default/module/html/children.erb +8 -0
  196. data/templates/default/module/html/constant_summary.erb +13 -0
  197. data/templates/default/module/html/defines.erb +3 -0
  198. data/templates/default/module/html/header.erb +4 -4
  199. data/templates/default/module/html/inherited_constants.erb +8 -0
  200. data/templates/default/module/html/inherited_methods.erb +9 -0
  201. data/templates/default/module/html/item_summary.erb +20 -0
  202. data/templates/default/module/html/method_details_list.erb +8 -0
  203. data/templates/default/module/html/method_summary.erb +8 -0
  204. data/templates/default/module/html/methodmissing.erb +12 -0
  205. data/templates/default/module/html/pre_docstring.erb +1 -0
  206. data/templates/default/module/setup.rb +83 -0
  207. data/templates/default/module/text/children.erb +10 -0
  208. data/templates/default/module/text/class_meths_list.erb +8 -0
  209. data/templates/default/module/text/extends.erb +8 -0
  210. data/templates/default/module/text/header.erb +7 -0
  211. data/templates/default/module/text/includes.erb +8 -0
  212. data/templates/default/module/text/instance_meths_list.erb +8 -0
  213. data/templates/default/module/text/setup.rb +12 -0
  214. data/templates/default/root/dot/child.erb +3 -0
  215. data/templates/default/root/dot/setup.rb +5 -0
  216. data/templates/default/tags/html/example.erb +5 -16
  217. data/templates/default/tags/html/index.erb +3 -0
  218. data/templates/default/tags/html/option.erb +17 -20
  219. data/templates/default/tags/html/overload.erb +13 -0
  220. data/templates/default/tags/html/see.erb +5 -10
  221. data/templates/default/tags/html/tag.erb +20 -0
  222. data/templates/default/tags/setup.rb +50 -0
  223. data/templates/default/tags/text/example.erb +8 -10
  224. data/templates/default/tags/text/index.erb +1 -0
  225. data/templates/default/tags/text/option.erb +18 -3
  226. data/templates/default/tags/text/overload.erb +19 -0
  227. data/templates/default/tags/text/see.erb +8 -2
  228. data/templates/default/tags/text/tag.erb +13 -0
  229. metadata +142 -158
  230. data/bin/view_generator +0 -17
  231. data/docs/FAQ.markdown +0 -34
  232. data/docs/GENERATORS.markdown +0 -211
  233. data/lib/yard/generators/attributes_generator.rb +0 -22
  234. data/lib/yard/generators/base.rb +0 -305
  235. data/lib/yard/generators/class_generator.rb +0 -27
  236. data/lib/yard/generators/constants_generator.rb +0 -74
  237. data/lib/yard/generators/constructor_generator.rb +0 -25
  238. data/lib/yard/generators/deprecated_generator.rb +0 -15
  239. data/lib/yard/generators/docstring_generator.rb +0 -15
  240. data/lib/yard/generators/full_doc_generator.rb +0 -127
  241. data/lib/yard/generators/helpers/html_helper.rb +0 -196
  242. data/lib/yard/generators/helpers/html_syntax_highlight_helper.rb +0 -49
  243. data/lib/yard/generators/helpers/uml_helper.rb +0 -16
  244. data/lib/yard/generators/inheritance_generator.rb +0 -16
  245. data/lib/yard/generators/method_details_generator.rb +0 -18
  246. data/lib/yard/generators/method_generator.rb +0 -43
  247. data/lib/yard/generators/method_listing_generator.rb +0 -105
  248. data/lib/yard/generators/method_missing_generator.rb +0 -25
  249. data/lib/yard/generators/method_signature_generator.rb +0 -19
  250. data/lib/yard/generators/method_summary_generator.rb +0 -21
  251. data/lib/yard/generators/mixins_generator.rb +0 -21
  252. data/lib/yard/generators/module_generator.rb +0 -23
  253. data/lib/yard/generators/overloads_generator.rb +0 -20
  254. data/lib/yard/generators/quick_doc_generator.rb +0 -25
  255. data/lib/yard/generators/root_generator.rb +0 -32
  256. data/lib/yard/generators/source_generator.rb +0 -11
  257. data/lib/yard/generators/tags_generator.rb +0 -99
  258. data/lib/yard/generators/uml_generator.rb +0 -102
  259. data/lib/yard/generators/visibility_group_generator.rb +0 -26
  260. data/spec/generators/base_spec.rb +0 -64
  261. data/spec/generators/full_doc_generator_spec.rb +0 -29
  262. data/spec/generators/helpers/base_helper_spec.rb +0 -15
  263. data/spec/generators/quick_doc_generator_spec.rb +0 -13
  264. data/templates/default/attributes/html/header.erb +0 -47
  265. data/templates/default/attributes/text/header.erb +0 -10
  266. data/templates/default/class/html/header.erb +0 -4
  267. data/templates/default/constants/html/constants.erb +0 -9
  268. data/templates/default/constants/html/header.erb +0 -3
  269. data/templates/default/constants/html/included.erb +0 -9
  270. data/templates/default/constants/html/inherited.erb +0 -9
  271. data/templates/default/constructor/html/header.erb +0 -10
  272. data/templates/default/deprecated/html/main.erb +0 -6
  273. data/templates/default/deprecated/text/main.erb +0 -3
  274. data/templates/default/docstring/html/main.erb +0 -3
  275. data/templates/default/docstring/text/main.erb +0 -3
  276. data/templates/default/fulldoc/html/all_files.erb +0 -19
  277. data/templates/default/fulldoc/html/all_methods.erb +0 -26
  278. data/templates/default/fulldoc/html/all_namespaces.erb +0 -22
  279. data/templates/default/fulldoc/html/app.js +0 -18
  280. data/templates/default/fulldoc/html/custom.css +0 -1
  281. data/templates/default/fulldoc/html/file.erb +0 -16
  282. data/templates/default/fulldoc/html/footer.erb +0 -5
  283. data/templates/default/fulldoc/html/header.erb +0 -16
  284. data/templates/default/fulldoc/html/html_head.erb +0 -4
  285. data/templates/default/fulldoc/html/index.erb +0 -19
  286. data/templates/default/fulldoc/html/jquery.js +0 -11
  287. data/templates/default/fulldoc/html/style.css +0 -81
  288. data/templates/default/fulldoc/html/syntax_highlight.css +0 -24
  289. data/templates/default/inheritance/html/header.erb +0 -8
  290. data/templates/default/inheritance/text/header.erb +0 -3
  291. data/templates/default/method/html/aliases.erb +0 -6
  292. data/templates/default/method/html/title.erb +0 -3
  293. data/templates/default/method/text/title.erb +0 -1
  294. data/templates/default/methoddetails/html/header.erb +0 -8
  295. data/templates/default/methoddetails/html/method_header.erb +0 -3
  296. data/templates/default/methodmissing/html/header.erb +0 -12
  297. data/templates/default/methodsignature/html/main.erb +0 -10
  298. data/templates/default/methodsignature/text/main.erb +0 -8
  299. data/templates/default/methodsummary/html/header.erb +0 -5
  300. data/templates/default/methodsummary/html/included.erb +0 -9
  301. data/templates/default/methodsummary/html/inherited.erb +0 -9
  302. data/templates/default/methodsummary/html/summary.erb +0 -29
  303. data/templates/default/methodsummary/text/header.erb +0 -5
  304. data/templates/default/methodsummary/text/included.erb +0 -0
  305. data/templates/default/methodsummary/text/inherited.erb +0 -0
  306. data/templates/default/methodsummary/text/summary.erb +0 -6
  307. data/templates/default/mixins/html/header.erb +0 -4
  308. data/templates/default/overloads/html/header.erb +0 -8
  309. data/templates/default/overloads/text/header.erb +0 -8
  310. data/templates/default/quickdoc/html/header.erb +0 -15
  311. data/templates/default/quickdoc/text/header.erb +0 -12
  312. data/templates/default/root/html/header.erb +0 -4
  313. data/templates/default/source/html/main.erb +0 -15
  314. data/templates/default/source/text/main.erb +0 -4
  315. data/templates/default/tags/html/header.erb +0 -4
  316. data/templates/default/tags/html/param.erb +0 -21
  317. data/templates/default/tags/html/tags.erb +0 -23
  318. data/templates/default/tags/html/todo.erb +0 -8
  319. data/templates/default/tags/text/header.erb +0 -3
  320. data/templates/default/tags/text/param.erb +0 -9
  321. data/templates/default/tags/text/tags.erb +0 -7
  322. data/templates/default/uml/dot/child.erb +0 -1
  323. data/templates/default/uml/dot/dependencies.erb +0 -10
  324. data/templates/default/uml/dot/superclasses.erb +0 -9
  325. data/templates/default/uml/dot/unknown.erb +0 -3
  326. data/templates/default/uml/dot/unknown_child.erb +0 -1
  327. data/templates/default/visibilitygroup/html/header.erb +0 -6
  328. data/templates/javadoc/attributes/html/header.erb +0 -16
  329. data/templates/javadoc/class/html/header.erb +0 -4
  330. data/templates/javadoc/constants/html/constants.erb +0 -9
  331. data/templates/javadoc/constants/html/header.erb +0 -3
  332. data/templates/javadoc/constants/html/included.erb +0 -12
  333. data/templates/javadoc/constants/html/inherited.erb +0 -12
  334. data/templates/javadoc/constructor/html/header.erb +0 -10
  335. data/templates/javadoc/deprecated/html/main.erb +0 -0
  336. data/templates/javadoc/docstring/html/main.erb +0 -6
  337. data/templates/javadoc/fulldoc/html/all_methods.erb +0 -25
  338. data/templates/javadoc/fulldoc/html/all_namespaces.erb +0 -19
  339. data/templates/javadoc/fulldoc/html/app.js +0 -18
  340. data/templates/javadoc/fulldoc/html/header.erb +0 -15
  341. data/templates/javadoc/fulldoc/html/html_head.erb +0 -3
  342. data/templates/javadoc/fulldoc/html/index.erb +0 -18
  343. data/templates/javadoc/fulldoc/html/jquery.js +0 -11
  344. data/templates/javadoc/fulldoc/html/readme.erb +0 -15
  345. data/templates/javadoc/fulldoc/html/style.css +0 -22
  346. data/templates/javadoc/fulldoc/html/syntax_highlight.css +0 -21
  347. data/templates/javadoc/inheritance/html/header.erb +0 -6
  348. data/templates/javadoc/method/html/aliases.erb +0 -6
  349. data/templates/javadoc/method/html/header.erb +0 -4
  350. data/templates/javadoc/method/html/title.erb +0 -4
  351. data/templates/javadoc/methoddetails/html/header.erb +0 -8
  352. data/templates/javadoc/methoddetails/html/method_header.erb +0 -0
  353. data/templates/javadoc/methodmissing/html/header.erb +0 -12
  354. data/templates/javadoc/methodsignature/html/main.erb +0 -8
  355. data/templates/javadoc/methodsummary/html/header.erb +0 -5
  356. data/templates/javadoc/methodsummary/html/included.erb +0 -12
  357. data/templates/javadoc/methodsummary/html/inherited.erb +0 -12
  358. data/templates/javadoc/methodsummary/html/summary.erb +0 -25
  359. data/templates/javadoc/mixins/html/header.erb +0 -5
  360. data/templates/javadoc/module/html/header.erb +0 -4
  361. data/templates/javadoc/source/html/main.erb +0 -15
  362. data/templates/javadoc/tags/html/header.erb +0 -5
  363. data/templates/javadoc/tags/html/see.erb +0 -8
  364. data/templates/javadoc/tags/html/tags.erb +0 -19
  365. data/templates/javadoc/visibilitygroup/html/header.erb +0 -5
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../lib/yard'
3
-
4
- log.level = Logger::DEBUG
5
- YARD::Registry.load
6
- gclass = eval("YARD::Generators::#{ARGV[0]}")
7
- sclass = ARGV[1] == "nil" ? nil : eval("YARD::Serializers::#{ARGV[1]}")
8
- obj = ARGV[2] == "all" ? YARD::Registry.all(:module, :class) : P(ARGV[2])
9
- format = ARGV[3].to_sym
10
-
11
- if sclass
12
- sclass = sclass.new
13
- else
14
- sclass = YARD::Serializers::StdoutSerializer.new(80)
15
- end
16
- verifier = lambda {|gen, obj| return false if gen.respond_to?(:visibility) && [:protected, :private].include?(gen.visibility) }
17
- gclass.new(:format => format, :template => :default, :serializer => sclass, :verifier => verifier).generate(obj)
@@ -1,34 +0,0 @@
1
- FAQ
2
- ===
3
-
4
- (1) So, show me some cool stuff. What can YARD do?
5
- --------------------------------------------------
6
-
7
- - [Visualize with GraphViz][graphviz] Visualize your classes and methods with GraphViz
8
- - [Inline RSpecs][inline-rspecs] In your rspec files, call the following to refer
9
- back to and call the inline rspecs: `described_in_docs "String", "camelcase"`
10
- - [Inline doc testing][inline-doctest] Use the 'docspec' command line tool to
11
- run the above tests. This is similar to [Ruby DocTest][rubydoctest]'s inline
12
- irb testing.
13
-
14
- (2) Why did you pick the @-symbol tags for documentation?
15
- ---------------------------------------------------------
16
- Java, C++, Python and many other languages have standard documentation tools
17
- that use the @tag "standard". This has been extended to the Ruby language,
18
- and YARD takes advantage of this common style.
19
-
20
- (3) Can I tweak it to use some other documentation standard?
21
- ------------------------------------------------------------
22
- Yes. YARD is flexible enough to have other documentation syntaxes put into use. [TODO: Add information about customization here.]
23
-
24
- (4) Why don't you use ParseTree, or sydparse? Why did you write your own parser?
25
- ---------------------------------------------------------------------------------
26
- As of Ruby 1.9, YARD uses Ripper parser which is packaged with the standard library
27
- and maintained as such. The legacy parser is only being maintained for bug fixes,
28
- but was written because no existing parser properly supported putting comments
29
- into the parse tree and did not robustly support edge case scenarios.
30
-
31
- [graphviz]:http://gnuu.org/2008/02/29/generating-class-diagrams-with-yard-and-graphviz/
32
- [inline-rspecs]:http://github.com/lsegal/yard/tree/5b07d706eee6bc0d7f13d9ec1e6e0ab914d3679c/lib/yard/core_ext/string.rb
33
- [inline-doctest]:http://github.com/lsegal/yard/tree/master/lib/yard/handlers/base.rb#L350
34
- [rubydoctest]:http://github.com/tablatom/rubydoctest
@@ -1,211 +0,0 @@
1
- Generators Architecture
2
- =======================
3
-
4
- Note: This document describes the architecture of the current generators
5
- implementation which is likely to undergo large changes in the 0.2.4
6
- release. Keep this in mind if you plan on extending or implementing
7
- custom generators.
8
-
9
- Generators are the main component in the output generation process of YARD,
10
- which is invoked when conventional HTML/text output needs to be generated
11
- for a set of code objects.
12
-
13
- Design Goals
14
- ------------
15
-
16
- The general design attempts to be as abstracted from actual content and templates
17
- as possible. Unlike RDoc which uses one file to describe the entire template,
18
- YARD splits up the generation of code objects into small components, allowing
19
- template modification for smaller subsets of a full template without having to
20
- duplicate the entire template itself. This is necessary because of YARD's support
21
- for plugins. YARD is designed for extensibility by external plugins, and because
22
- of this, no one plugin can be responsible for the entire template because no
23
- one plugin knows about the other plugins being used. For instance, if an RSpec
24
- plugin was added to support and document specifications in class templates,
25
- this information would need to be transparently added to the template to work
26
- in conjunction with any other plugin that performed similar template modifications.
27
- The design goals can be summarized as follows:
28
-
29
- 1. Output should be able to be generated for any arbitrary format with little
30
- modification to YARD's source code. The addition of extra templates should
31
- be sufficient.
32
- 2. The output generated for an object should independently generated data
33
- from arbitrary sources. These independent components are called "sections".
34
- 3. Sections should be able to be inserted into any object without affecting
35
- any existing sections in the document. This allows for easy modification
36
- of templates by plugins.
37
-
38
- Generators
39
- ----------
40
-
41
- Generator classes are the objects used to orchestrate the design goals listed
42
- above. Specifically, they organize the sections and render the template contents
43
- depending on the format. The main method used to initiate output is the
44
- {YARD::Generators::Base#generate #generate} method which takes a list of
45
- objects to generate output for. A good example of this is the FullDocGenerator,
46
- which generates conventional HTML documentation:
47
-
48
- # all_objects is an array of module and class objects
49
- Generators::FullDocGenerator.new(options).generate(all_objects)
50
-
51
- Generator Options
52
- -----------------
53
-
54
- A generator keeps state when it is generating output. This state is kept in
55
- an options hash which is initially passed to it during instantiation. Some
56
- default options set the template style (`:template`), the output format (`:format`),
57
- and the serializer to use (`:serializer`). For example, initializing the
58
- {YARD::Generators::QuickDocGenerator} to output as text instead of HTML can be
59
- done as follows:
60
-
61
- YARD::Generators::QuickDocGenerator.new(:format => :text).generate(objects)
62
-
63
- Serializer
64
- ----------
65
-
66
- This class abstracts the logic involved in deciding how to serialize data to
67
- the expected endpoint. For instance, there is both a {YARD::Serializers::StdoutSerializer StdoutSerializer}
68
- and {YARD::Serializers::FileSystemSerializer FileSystemSerializer} class for
69
- outputting to console or to a file respectively. When endpoints with locations
70
- are used (like files or URLs), the serializer implements the {YARD::Serializers::Base#serialized_path #serialized_path}
71
- method. This allows the translation from a code object to its path at the endpoint,
72
- which enables inter-document linking.
73
-
74
- Generated objects are automatically serialized using the object if present,
75
- otherwise the generated object is returned as a string to its parent. Nested
76
- generator objects automatically set the serializer to nil so that they return
77
- as a String to their parent.
78
-
79
- Templates
80
- ---------
81
-
82
- Templates for a generator are by default found inside the one of the template
83
- root paths (there can be multiple template paths). A standard template
84
- directory looks like the following tree:
85
-
86
- (Assuming templates/ is a template root path)
87
- templates/
88
- |-- default
89
- | |-- attributes
90
- | | |-- html
91
- | | | `-- header.erb
92
- | | `-- text
93
- | | `-- header.erb
94
- | |-- class
95
- | | `-- html
96
- | | `-- header.erb
97
- | |-- constants
98
- | | `-- html
99
- | | |-- constants.erb
100
- | | |-- header.erb
101
- | | |-- included.erb
102
- | | `-- inherited.erb
103
- ...
104
-
105
- The path `default` refers to the template style and the directories at the next
106
- level (such as `attributes`) refer to templates for a generator. The next directory
107
- refers to the output format being used defined by the `:format` generator option.
108
- As we saw in the above example, the format option can be set to `:text`, which
109
- would use the `text/` directory instead of `html/`. Finally, the individual .erb
110
- files are the sections that make up the generator.
111
-
112
- Sections
113
- --------
114
-
115
- As mentioned above, sections are smaller components that correlate to template
116
- fragments. Practically speaking, a section can either be a template fragment
117
- (a conventional .erb file or other supported templating language), a method
118
- (which returns a String) or another Generator object (which in turn has its own
119
- list of sections).
120
-
121
- Creating a Generator
122
- --------------------
123
-
124
- To create a generator, subclass {YARD::Generators::Base} and implement the
125
- `#sections_for(object)` method. This method should return a list of sections where
126
- a Symbol refers to a method or template name and a class refers to a generator.
127
-
128
- def sections_for(object)
129
- case object
130
- when MethodObject
131
- [:main, [G(AnotherGenerator)], :footer]
132
- else
133
- []
134
- end
135
- end
136
-
137
- A few points about the above example:
138
-
139
- * The method can return different lists depending on the object.
140
- * The list of objects is not flat, we will see how nested lists can be used
141
- in a future example.
142
- * The convenience method `G()` instantiates a generator out of the class using
143
- the existing options.
144
-
145
- If a section is a Symbol, the generator first checks if a method is defined
146
- with that name, otherwise it checks in the template directories. If a method
147
- by the symbol name is defined, you need to manually call {YARD::Generators::Base#render #render}
148
- to return the contents of the template.
149
-
150
- Nested Sections
151
- ---------------
152
-
153
- Sections often require the ability to encapsulate a set of sub-sections in markup
154
- (HTML, for instance). Rather than use heavier Generator subclass objects, a more
155
- lightweight solution is to nest a set of sub-sections as a list that follows
156
- a section, for example:
157
-
158
- def sections_for(object)
159
- [:header, [:section_a, :section_b]]
160
- end
161
-
162
- The above example nests `section_a` and `section_b` within the `header` section.
163
- Practically speaking, these sections can be placed in the result by `yield`ing
164
- to them. A sample header.erb template might contain:
165
-
166
- <h2>Header</h2>
167
- <div id="contents">
168
- <%= yield %>
169
- </div>
170
-
171
- This template code would place the output of `section_a` and `section_b` within
172
- the above div element. Using yield, we can also change the object that is being
173
- generated. For example, we may want to yield the first method of the class.
174
- We can do this like so:
175
-
176
- <h2>First method</h2>
177
- <%= yield(current_object.meths.first) %>
178
-
179
- This would run the nested sections for the method object instead of the class.
180
-
181
- Before Filters
182
- --------------
183
-
184
- Generators can run before filters using the {YARD::Generators::Base.before_section before_section} method
185
- for all or a specific section to test if the section should be generated or
186
- skipped. For instance, we can do the following to generate the section :foo only
187
- for MethodObjects:
188
-
189
- class MyGenerator < YARD::Generators::Base
190
- before_section :foo, :is_method?
191
-
192
- def sections_for(object)
193
- [:foo, :bar, :baz]
194
- end
195
-
196
- private
197
-
198
- def is_method?(object)
199
- object.is_a?(MethodObject)
200
- end
201
- end
202
-
203
- Without the argument `:foo`, the before filter would be applied to all sections.
204
- Note that we must return `false` to skip a section. A return type of nil is not
205
- enough to skip the section.
206
-
207
- There is also a {YARD::Generators::Base.before_list before_list} method to run
208
- a filter before the entire generator is run. This is useful for doing necessary
209
- filesystem setup or for generating assets (stylesheets) before generating output
210
- for the objects. Note that in this case you will need to serialize your data directly
211
- using the serializer object (described above).
@@ -1,22 +0,0 @@
1
- module YARD
2
- module Generators
3
- class AttributesGenerator < Base
4
- include Helpers::MethodHelper
5
-
6
- before_generate :has_attributes?
7
- before_list :includes
8
-
9
- def sections_for(object) [:header] end
10
-
11
- protected
12
-
13
- def includes
14
- extend Helpers::UMLHelper if format == :text
15
- end
16
-
17
- def has_attributes?
18
- current_object.class_attributes.size + current_object.instance_attributes.size > 0
19
- end
20
- end
21
- end
22
- end
@@ -1,305 +0,0 @@
1
- require 'erb'
2
-
3
- module YARD
4
- module Generators
5
- class Base
6
- include Helpers::BaseHelper
7
- include Helpers::FilterHelper
8
-
9
- class << self
10
- def template_paths
11
- @@template_paths ||= [TEMPLATE_ROOT]
12
- end
13
-
14
- ##
15
- # Convenience method to registering a template path.
16
- # Equivalent to calling:
17
- # GeneratorName.template_paths.unshift(path)
18
- #
19
- # @param [String] path
20
- # the pathname to look for the template
21
- #
22
- # @see template_paths
23
- def register_template_path(path)
24
- template_paths.unshift(path)
25
- end
26
-
27
- # Calls the +Proc+ object or method name before generating all or a specific
28
- # section. The callback should return +false+ if the section is to be
29
- # skipped.
30
- #
31
- # @overload before_section(method_name)
32
- # @param [Symbol] method_name the name of the method to call before
33
- # running the generator.
34
- #
35
- # @overload before_section(proc)
36
- # @param [Proc] proc should return +false+ if section should be skipped.
37
- #
38
- # @overload before_section(section, condition)
39
- # Only calls the +Proc+ or method if it matches the passed +section+
40
- #
41
- # @param [Object] section one of the section items in {#sections_for}
42
- # @param [Symbol, Proc] condition see the first two overloads
43
- def before_section(*args)
44
- if args.size == 1
45
- before_section_filters.push [nil, args.first]
46
- elsif args.size == 2
47
- before_section_filters.push(args)
48
- else
49
- raise ArgumentError, "before_section takes a generator followed by a Proc/lambda or Symbol referencing the method name"
50
- end
51
- end
52
-
53
- def before_section_filters
54
- @before_section_filters ||= []
55
- end
56
-
57
- def before_generate(meth)
58
- before_generate_filters.push(meth)
59
- end
60
-
61
- def before_generate_filters
62
- @before_generate_filters ||= []
63
- end
64
-
65
- def before_list(meth)
66
- before_list_filters.push(meth)
67
- end
68
-
69
- def before_list_filters
70
- @before_list_filters ||= []
71
- end
72
- end
73
-
74
- # Creates a generator by adding extra options
75
- # to the options hash.
76
- #
77
- # @example [Creates a new MethodSummaryGenerator for public class methods]
78
- # G(MethodSummaryGenerator, :scope => :class, :visibility => :public)
79
- #
80
- # @param [Class] generator
81
- # the generator class to use.
82
- #
83
- # @option opts :ignore_serializer [Boolean] (true) whether or not the serializer is ignored.
84
- #
85
- def G(generator, opts = {})
86
- opts = SymbolHash[:ignore_serializer => true].update(opts)
87
- generator.new(options, opts)
88
- end
89
-
90
- attr_reader :format, :template, :verifier
91
- attr_reader :serializer, :ignore_serializer
92
- attr_reader :options
93
- attr_reader :current_object
94
-
95
- def initialize(opts = {}, extra_opts = {})
96
- opts = SymbolHash[
97
- :format => :html,
98
- :template => :default,
99
- :markup => :rdoc,
100
- :serializer => nil,
101
- :verifier => nil
102
- ].update(opts).update(extra_opts)
103
-
104
- @options = opts
105
- @format = options[:format]
106
- @template = options[:template]
107
- @serializer = options[:serializer]
108
- @ignore_serializer = options[:ignore_serializer]
109
- @verifier = options[:verifier]
110
-
111
- extend Helpers::HtmlHelper if format == :html
112
- end
113
-
114
- def generator_name
115
- self.class.to_s.split("::").last.gsub(/Generator$/, '').downcase
116
- end
117
-
118
- def generate(*list, &block)
119
- output = ""
120
-
121
- list = list.flatten
122
- @current_object = Registry.root
123
- return output if FalseClass === run_before_list(list)
124
-
125
- serializer.before_serialize if serializer && !ignore_serializer
126
-
127
- list.each do |object|
128
- next unless object && !object.is_a?(CodeObjects::Proxy)
129
-
130
- objout = ""
131
- @current_object = object
132
-
133
- next if call_verifier(object).is_a?(FalseClass)
134
- next if run_before_generate(object).is_a?(FalseClass)
135
-
136
- objout << render_sections(object, &block)
137
-
138
- if serializer && !ignore_serializer && !objout.empty?
139
- serializer.serialize(object, objout)
140
- end
141
- output << objout
142
- end
143
-
144
- if serializer && !ignore_serializer
145
- serializer.after_serialize(output)
146
- end
147
- output
148
- end
149
-
150
- protected
151
-
152
- def call_verifier(object)
153
- if verifier.is_a?(Symbol)
154
- send(verifier, object)
155
- elsif verifier.respond_to?(:call)
156
- verifier.call(self, object)
157
- end
158
- end
159
-
160
- def run_before_list(list)
161
- self.class.before_list_filters.each do |meth|
162
- meth = method(meth) if meth.is_a?(Symbol)
163
- result = meth.call *(meth.arity == 0 ? [] : [list])
164
- return result if result.is_a?(FalseClass)
165
- end
166
- end
167
-
168
- def run_before_generate(object)
169
- self.class.before_generate_filters.each do |meth|
170
- meth = method(meth) if meth.is_a?(Symbol)
171
- result = meth.call *(meth.arity == 0 ? [] : [object])
172
- return result if result.is_a?(FalseClass)
173
- end
174
- end
175
-
176
- def run_before_sections(section, object)
177
- result = before_section(section, object)
178
- return result if result.is_a?(FalseClass)
179
-
180
- self.class.before_section_filters.each do |info|
181
- result, sec, meth = nil, *info
182
- if sec.nil? || sec == section
183
- meth = method(meth) if meth.is_a?(Symbol)
184
- args = [section, object]
185
- if meth.arity == 1
186
- args = [object]
187
- elsif meth.arity == 0
188
- args = []
189
- end
190
-
191
- result = meth.call(*args)
192
- log.debug("Calling before section filter for %s%s with `%s`, result = %s" % [
193
- self.class.class_name, section.inspect, object,
194
- result.is_a?(FalseClass) ? 'fail' : 'pass'
195
- ])
196
- end
197
-
198
- return result if result.is_a?(FalseClass)
199
- end
200
- end
201
-
202
- def sections_for(object); [] end
203
-
204
- def before_section(section, object); end
205
-
206
- def render_sections(object, sections = nil)
207
- sections ||= sections_for(object) || []
208
-
209
- data = ""
210
- sections.each_with_index do |section, index|
211
- next if section.is_a?(Array)
212
-
213
- data << if sections[index+1].is_a?(Array)
214
- render_section(section, object) do |obj|
215
- tmp, @current_object = @current_object, obj
216
- out = render_sections(obj, sections[index+1])
217
- @current_object = tmp
218
- out
219
- end
220
- else
221
- render_section(section, object)
222
- end
223
- end
224
- data
225
- end
226
-
227
- def render_section(section, object, &block)
228
- begin
229
- if section.is_a?(Class) && section <= Generators::Base
230
- opts = options.dup
231
- opts.update(:ignore_serializer => true)
232
- sobj = section.new(opts)
233
- sobj.generate(object, &block)
234
- elsif section.is_a?(Generators::Base)
235
- section.generate(object, &block)
236
- elsif section.is_a?(Symbol) || section.is_a?(String)
237
- return "" if run_before_sections(section, object).is_a?(FalseClass)
238
-
239
- if section.is_a?(Symbol)
240
- if respond_to?(section)
241
- if method(section).arity != 1
242
- send(section, &block)
243
- else
244
- send(section, object, &block)
245
- end || ""
246
- else # treat it as a String
247
- render(object, section, &block)
248
- end
249
- else
250
- render(object, section, &block)
251
- end
252
- else
253
- type = section.is_a?(String) || section.is_a?(Symbol) ? 'section' : 'generator'
254
- log.warn "Ignoring invalid #{type} '#{section}' in #{self.class}"
255
- ""
256
- end
257
- end
258
- end
259
-
260
- def render(object, file = nil, locals = {}, &block)
261
- if object.is_a?(Symbol)
262
- object, file, locals = current_object, object, (file||{})
263
- end
264
-
265
- path = template_path(file.to_s + '.erb', generator_name)
266
- filename = find_template(path)
267
- if filename
268
- begin
269
- render_method(object, filename, locals, &block)
270
- rescue => e
271
- log.error "#{e.class.class_name}: #{e.message}"
272
- log.error "in generator #{self.class}: #{filename}"
273
- log.error e.backtrace[0..10].join("\n")
274
- exit
275
- end
276
- else
277
- log.warn "Cannot find template `#{path}`"
278
- ""
279
- end
280
- end
281
-
282
- def render_method(object, filename, locals = {}, &block)
283
- l = locals.map {|k,v| "#{k} = locals[#{k.inspect}]" }.join(";")
284
- src = erb("<% #{l} %>" + File.read(filename)).src
285
- instance_eval(src, filename, 1)
286
- end
287
-
288
- def erb(str)
289
- ERB.new(str, nil, '<>')
290
- end
291
-
292
- def template_path(file, generator = generator_name)
293
- File.join(template.to_s, generator, format.to_s, file.to_s)
294
- end
295
-
296
- def find_template(path)
297
- self.class.template_paths.each do |basepath|
298
- f = File.join(basepath, path)
299
- return f if File.file?(f)
300
- end
301
- nil
302
- end
303
- end
304
- end
305
- end