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,18 +1,16 @@
1
1
  class File
2
2
  RELATIVE_PARENTDIR = '..'
3
+ RELATIVE_SAMEDIR = '.'
3
4
 
4
5
  # Turns a path +to+ into a relative path from starting
5
6
  # point +from+. The argument +from+ is assumed to be
6
7
  # a filename. To treat it as a directory, make sure it
7
- # ends in `File::SEPARATOR` ('/' on UNIX filesystems).
8
+ # ends in +File::SEPARATOR+ ('/' on UNIX filesystems).
8
9
  #
9
10
  # @param [String] from the starting filename
10
11
  # (or directory with +from_isdir+ set to +true+).
11
- #
12
12
  # @param [String] to the final path that should be made relative.
13
- #
14
13
  # @return [String] the relative path from +from+ to +to+.
15
- #
16
14
  def self.relative_path(from, to)
17
15
  from = expand_path(from).split(SEPARATOR)
18
16
  to = expand_path(to).split(SEPARATOR)
@@ -23,4 +21,23 @@ class File
23
21
  fname = from.pop
24
22
  join *(from.map { RELATIVE_PARENTDIR } + to)
25
23
  end
24
+
25
+ # Cleans a path by removing extraneous '..', '.' and '/' characters
26
+ #
27
+ # @example Clean a path
28
+ # File.cleanpath('a/b//./c/../e') # => "a/b/e"
29
+ # @param [String] path the path to clean
30
+ # @return [String] the sanitized path
31
+ def self.cleanpath(path)
32
+ path = path.split(SEPARATOR)
33
+ path = path.inject([]) do |acc, comp|
34
+ next acc if comp == RELATIVE_SAMEDIR
35
+ if comp == RELATIVE_PARENTDIR && acc.size > 0
36
+ acc.pop
37
+ next acc
38
+ end
39
+ acc << comp
40
+ end
41
+ File.join(*path)
42
+ end
26
43
  end
@@ -1,8 +1,18 @@
1
1
  class Module
2
+ # Returns the class name of a full module namespace path
3
+ #
4
+ # @example
5
+ # module A::B::C; class_name end # => "C"
6
+ # @return [String] the last part of a module path
2
7
  def class_name
3
8
  name.split("::").last
4
9
  end
5
-
10
+
11
+ # Returns the module namespace path minus the class/module name
12
+ #
13
+ # @example
14
+ # module A::B::C; namespace end # => "A::B"
15
+ # @return [String] the namespace minus the class/module name
6
16
  def namespace
7
17
  name.split("::")[0..-2].join("::")
8
18
  end
@@ -1,9 +1,20 @@
1
1
  class String
2
+ # Separates capital letters following lower case letters by an underscore
3
+ # and returns the entire string in lower case
4
+ #
5
+ # @example
6
+ # "FooBar".underscore # => "foo_bar"
7
+ # @return [String] the underscored lower case string
2
8
  def underscore
3
- gsub(/([a-z])([A-Z])/, '\1_\2').downcase
9
+ gsub(/([a-z])([A-Z])/, '\1_\2').downcase.gsub('::', '/')
4
10
  end
5
11
 
12
+ # Camel cases any underscored text.
13
+ #
14
+ # @example
15
+ # "foo_bar_baz".camelcase # => "FooBarBaz"
16
+ # @return [String] the camel cased text
6
17
  def camelcase
7
- gsub(/([a-z])_([a-z])/i) { $1 + $2.upcase }.sub(/^(.)/) { $1.upcase }
18
+ gsub(/([a-z])_([a-z])/i) { $1 + $2.upcase }.sub(/^(.)/) { $1.upcase }.gsub('/', '::')
8
19
  end
9
20
  end
@@ -1,8 +1,29 @@
1
+ # A subclass of Hash where all keys are converted into Symbols, and
2
+ # optionally, all String values are converted into Symbols.
1
3
  class SymbolHash < Hash
4
+ # Creates a new SymbolHash object
5
+ #
6
+ # @param [Boolean] symbolize_value converts any String values into Symbols
7
+ # if this is set to +true+.
2
8
  def initialize(symbolize_value = true)
3
9
  @symbolize_value = symbolize_value
4
10
  end
5
-
11
+
12
+ # @overload [](hash)
13
+ # Creates a SymbolHash object from an existing Hash
14
+ #
15
+ # @example
16
+ # SymbolHash['x' => 1, :y => 2] # => #<SymbolHash:0x...>
17
+ # @param [Hash] hash the hash object
18
+ # @return [SymbolHash] a new SymbolHash from a hash object
19
+ #
20
+ # @overload [](*list)
21
+ # Creates a SymbolHash from an even list of keys and values
22
+ #
23
+ # @example
24
+ # SymbolHash[key1, value1, key2, value2, ...]
25
+ # @param [Array] list an even list of key followed by value
26
+ # @return [SymbolHash] a new SymbolHash object
6
27
  def self.[](*hsh)
7
28
  obj = new;
8
29
  if hsh.size == 1 && hsh.first.is_a?(Hash)
@@ -13,13 +34,40 @@ class SymbolHash < Hash
13
34
  obj
14
35
  end
15
36
 
37
+ # Assigns a value to a symbolized key
38
+ # @param [#to_sym] key the key
39
+ # @param [Object] value the value to be assigned. If this is a String and
40
+ # values are set to be symbolized, it will be converted into a Symbol.
16
41
  def []=(key, value)
17
42
  super(key.to_sym, value.instance_of?(String) && @symbolize_value ? value.to_sym : value)
18
43
  end
44
+
45
+ # Accessed a symbolized key
46
+ # @param [#to_sym] key the key to access
47
+ # @return [Object] the value associated with the key
19
48
  def [](key) super(key.to_sym) end
49
+
50
+ # Deleted a key and value associated with it
51
+ # @param [#to_sym] key the key to delete
52
+ # @return [nil]
20
53
  def delete(key) super(key.to_sym) end
54
+
55
+ # Tests if a symbolized key exists
56
+ # @param [#to_sym] key the key to test
57
+ # @return [Boolean] whether the key exists
21
58
  def has_key?(key) super(key.to_sym) end
22
- def update(hsh) hsh.each {|k,v| self[k] = v }; self end
59
+
60
+ # Updates the object with the contents of another Hash object
61
+ # This method modifies the original SymbolHash object
62
+ #
63
+ # @param [Hash] hash the hash object to copy the values from
64
+ # @return [SymbolHash] self
65
+ def update(hash) hash.each {|k,v| self[k] = v }; self end
23
66
  alias_method :merge!, :update
24
- def merge(hsh) dup.merge!(hsh) end
67
+
68
+ # Merges the contents of another hash into a new SymbolHash object
69
+ #
70
+ # @param [Hash] hash the hash of objects to copy
71
+ # @return [SymbolHash] a new SymbolHash containing the merged data
72
+ def merge(hash) dup.merge!(hash) end
25
73
  end
@@ -1,10 +1,43 @@
1
1
  module YARD
2
+ # A documentation string, or "docstring" for short, encapsulates the
3
+ # comments and metadata, or "tags", of an object. Meta-data is expressed
4
+ # in the form +@tag VALUE+, where VALUE can span over multiple lines as
5
+ # long as they are indented. The following +@example+ tag shows how tags
6
+ # can be indented:
7
+ #
8
+ # # @example My example
9
+ # # a = "hello world"
10
+ # # a.reverse
11
+ # # @version 1.0
12
+ #
13
+ # Tags can be nested in a documentation string, though the {Tags::Tag}
14
+ # itself is responsible for parsing the inner tags.
2
15
  class Docstring < String
16
+ # @return [Array<Tags::RefTag>] the list of reference tags
3
17
  attr_reader :ref_tags
4
- attr_accessor :object, :line_range, :all
18
+
19
+ # @return [CodeObjects::Base] the object that owns the docstring.
20
+ attr_accessor :object
21
+
22
+ # @return [Range] line range in the {#object}'s file where the docstring was parsed from
23
+ attr_accessor :line_range
24
+
25
+ # @return [String] the raw documentation (including raw tag text)
26
+ attr_accessor :all
5
27
 
28
+ # Matches a tag at the start of a comment line
6
29
  META_MATCH = /^@([a-z_]+)(?:\s+(.*))?$/i
7
30
 
31
+ # Creates a new docstring with the raw contents attached to an optional
32
+ # object.
33
+ #
34
+ # @example
35
+ # Docstring.new("hello world\n@return Object return", someobj)
36
+ #
37
+ # @param [String] content the raw comments to be parsed into a docstring
38
+ # and associated meta-data.
39
+ # @param [CodeObjects::Base] object an object to associate the docstring
40
+ # with.
8
41
  def initialize(content = '', object = nil)
9
42
  @tag_factory = Tags::Library.new
10
43
  @object = object
@@ -12,6 +45,8 @@ module YARD
12
45
  self.all = content
13
46
  end
14
47
 
48
+ # Replaces the docstring with new raw content. Called by {#all=}.
49
+ # @param [String] content the raw comments to be parsed
15
50
  def replace(content)
16
51
  @tags, @ref_tags = [], []
17
52
  @all = content
@@ -19,25 +54,38 @@ module YARD
19
54
  end
20
55
  alias all= replace
21
56
 
57
+ # @return [Fixnum] the first line of the {#line_range}.
22
58
  def line
23
59
  line_range.first
24
60
  end
25
61
 
26
- ##
27
62
  # Gets the first line of a docstring to the period or the first paragraph.
28
- #
29
63
  # @return [String] The first line or paragraph of the docstring; always ends with a period.
30
64
  def summary
31
65
  return @summary if @summary
32
- summary = split(/\.|\r?\n\r?\n/).first || ''
33
- summary += '.' unless summary.empty?
34
- @summary = summary
66
+ open_parens = ['{', '(', '[']
67
+ close_parens = ['}', ')', ']']
68
+ num_parens = 0
69
+ idx = length.times do |index|
70
+ case self[index, 1]
71
+ when ".", "\r", "\n"
72
+ next_char = self[index + 1, 1].to_s
73
+ if num_parens == 0 && next_char =~ /^\s*$/
74
+ break index - 1
75
+ end
76
+ when "{", "(", "["
77
+ num_parens += 1
78
+ when "}", ")", "]"
79
+ num_parens -= 1
80
+ end
81
+ end
82
+ @summary = self[0..idx]
83
+ @summary += '.' unless @summary.empty?
84
+ @summary
35
85
  end
36
86
 
37
- ##
38
87
  # Adds a tag or reftag object to the tag list
39
- #
40
- # @param [Tags::Tag, Tags::RefTag] *tags list of tag objects to add
88
+ # @param [Tags::Tag, Tags::RefTag] tags list of tag objects to add
41
89
  def add_tag(*tags)
42
90
  tags.each_with_index do |tag, i|
43
91
  case tag
@@ -52,12 +100,11 @@ module YARD
52
100
  end
53
101
  end
54
102
 
55
- ##
56
103
  # Convenience method to return the first tag
57
104
  # object in the list of tag objects of that name
58
105
  #
59
106
  # @example
60
- # doc = YARD::Docstring.new("@return zero when nil")
107
+ # doc = Docstring.new("@return zero when nil")
61
108
  # doc.tag(:return).text # => "zero when nil"
62
109
  #
63
110
  # @param [#to_s] name the tag name to return data for
@@ -66,10 +113,9 @@ module YARD
66
113
  tags.find {|tag| tag.tag_name.to_s == name.to_s }
67
114
  end
68
115
 
69
- ##
70
116
  # Returns a list of tags specified by +name+ or all tags if +name+ is not specified.
71
117
  #
72
- # @param name the tag name to return data for, or nil for all tags
118
+ # @param [#to_s] name the tag name to return data for, or nil for all tags
73
119
  # @return [Array<Tags::Tag>] the list of tags by the specified tag name
74
120
  def tags(name = nil)
75
121
  list = @tags + convert_ref_tags
@@ -86,7 +132,6 @@ module YARD
86
132
  tags.any? {|tag| tag.tag_name.to_s == name.to_s }
87
133
  end
88
134
 
89
- ##
90
135
  # Returns true if the docstring has no content
91
136
  #
92
137
  # @return [Boolean] whether or not the docstring has content
@@ -96,20 +141,25 @@ module YARD
96
141
 
97
142
  private
98
143
 
144
+ # Maps valid reference tags
145
+ #
146
+ # @return [Array<Tags::RefTag>] the list of valid reference tags
99
147
  def convert_ref_tags
100
148
  list = @ref_tags.reject {|t| CodeObjects::Proxy === t.owner }
101
149
  list.map {|t| t.tags }.flatten
102
150
  end
103
151
 
104
- ##
105
- # Creates a {RefTag}
152
+ # Creates a {Tags::RefTag}
106
153
  def create_ref_tag(tag_name, name, object)
107
154
  @ref_tags << Tags::RefTagList.new(tag_name, object, name)
108
155
  end
109
156
 
110
- ##
111
- # Creates a tag from the TagFactory
157
+ # Creates a tag from the {Tags::DefaultFactory tag factory}.
112
158
  #
159
+ # @param [String] tag_name the tag name
160
+ # @param [String] tag_buf the text attached to the tag with newlines removed.
161
+ # @param [String] raw_buf the raw buffer of text without removed newlines.
162
+ # @return [Tags::Tag, Tags::RefTag] a tag
113
163
  def create_tag(tag_name, tag_buf, raw_buf)
114
164
  if tag_buf =~ /\A\s*(?:(\S+)\s+)?\(\s*see\s+(\S+)\s*\)\s*\Z/
115
165
  return create_ref_tag(tag_name, $1, $2)
@@ -129,7 +179,6 @@ module YARD
129
179
  log.warn "Invalid tag format for @#{tag_name}" + (object ? " in file `#{object.file}` near line #{object.line}" : "")
130
180
  end
131
181
 
132
- ##
133
182
  # Parses out comments split by newlines into a new code object
134
183
  #
135
184
  # @param [String] comments
@@ -1,7 +1,6 @@
1
1
  # Global methods
2
2
 
3
- # Shortcut for creating a YARD::CodeObjects::Proxy
4
- # via a path
3
+ # Shortcut for creating a YARD::CodeObjects::Proxy via a path
5
4
  #
6
5
  # @see YARD::CodeObjects::Proxy
7
6
  # @see YARD::Registry#resolve
@@ -10,6 +9,10 @@ def P(namespace, name = nil)
10
9
  YARD::Registry.resolve(namespace, name, false, true)
11
10
  end
12
11
 
12
+ # The global {YARD::Logger} instance
13
+ #
14
+ # @return [YARD::Logger] the global {YARD::Logger} instance
15
+ # @see YARD::Logger
13
16
  def log
14
17
  YARD::Logger.instance
15
18
  end
@@ -1,7 +1,13 @@
1
1
  module YARD
2
2
  module Handlers
3
+ # Raised during processing phase when a handler needs to perform
4
+ # an operation on an object's namespace but the namespace could
5
+ # not be resolved.
3
6
  class NamespaceMissingError < Parser::UndocumentableError
7
+ # The object the error occured on
8
+ # @return [CodeObjects::Base] a code object
4
9
  attr_accessor :object
10
+
5
11
  def initialize(object) @object = object end
6
12
  end
7
13
 
@@ -125,6 +131,9 @@ module YARD
125
131
  # even if statements. For this reason, the block parsing method must be
126
132
  # invoked explicitly out of efficiency sake.
127
133
  #
134
+ # @abstract Subclass this class to provide a handler for YARD to use
135
+ # during the processing phase.
136
+ #
128
137
  # @see CodeObjects::Base
129
138
  # @see CodeObjects::NamespaceObject
130
139
  # @see handles
@@ -132,7 +141,6 @@ module YARD
132
141
  # @see #owner
133
142
  # @see #register
134
143
  # @see #parse_block
135
- #
136
144
  class Base
137
145
  # For accessing convenience, eg. "MethodObject"
138
146
  # instead of the full qualified namespace
@@ -141,10 +149,14 @@ module YARD
141
149
  include Parser
142
150
 
143
151
  class << self
152
+ # Clear all registered subclasses. Testing purposes only
153
+ # @return [nil]
144
154
  def clear_subclasses
145
155
  @@subclasses = []
146
156
  end
147
157
 
158
+ # Returns all registered handler subclasses.
159
+ # @return [Array<Base>] a list of handlers
148
160
  def subclasses
149
161
  @@subclasses ||= []
150
162
  end
@@ -335,8 +347,6 @@ module YARD
335
347
  else
336
348
  raise NamespaceMissingError, object
337
349
  end
338
- else
339
- log.debug "Object #{object} successfully resolved. Adding children."
340
350
  end
341
351
  object
342
352
  end
@@ -1,9 +1,52 @@
1
1
  module YARD
2
2
  module Handlers
3
+ # Iterates over all statements in a file and delegates them to the
4
+ # {Handlers::Base} objects that are registered to handle the statement.
5
+ #
6
+ # This class is passed to each handler and keeps overall processing state.
7
+ # For example, if the {#visibility} is set in a handler, all following
8
+ # statements will have access to this state. This allows "public",
9
+ # "protected" and "private" statements to be handled in classes and modules.
10
+ # In addition, the {#namespace} can be set during parsing to control
11
+ # where objects are being created from.
12
+ #
13
+ # @see Handlers::Base
3
14
  class Processor
4
- attr_accessor :file, :namespace, :visibility
5
- attr_accessor :scope, :owner, :load_order_errors, :parser_type
15
+ # @return [String] the filename
16
+ attr_accessor :file
17
+
18
+ # @return [CodeObjects::NamespaceObject] the current namespace
19
+ attr_accessor :namespace
20
+
21
+ # @return [Symbol] the current visibility
22
+ attr_accessor :visibility
23
+
24
+ # @return [Symbol] the current scope
25
+ attr_accessor :scope
26
+
27
+ # @return [CodeObjects::Base, nil] unlike the namespace, the owner
28
+ # is a non-namespace object that should be stored between statements.
29
+ # For instance, when parsing a method body, the {CodeObjects::MethodObject}
30
+ # is set as the owner, in case any extra method information is processed.
31
+ attr_accessor :owner
32
+
33
+ # @return [Boolean] whether or not {Parser::LoadOrderError} is raised
34
+ attr_accessor :load_order_errors
35
+
36
+ # @return [Symbol] the parser type (:ruby, :ruby18 or :c)
37
+ attr_accessor :parser_type
6
38
 
39
+ # Creates a new Processor for a +file+.
40
+ #
41
+ # @param [String] file the name of the file that is being processed.
42
+ # uses '(stdin)' if file is nil.
43
+ # @param [Boolean] load_order_error whether or not to raise {Parser::LoadOrderError}
44
+ # when a file has unresolved references that need to be parsed first.
45
+ # If these errors are raised, the processor will attempt to load all
46
+ # other files before continuing to parse the file.
47
+ # @param [Symbol] parser_type the parser type (:ruby, :ruby18, :c) from
48
+ # the parser. Used to select the handler (since handlers are specific
49
+ # to a parser type).
7
50
  def initialize(file = nil, load_order_errors = false, parser_type = Parser::SourceParser.parser_type)
8
51
  @file = file || "(stdin)"
9
52
  @namespace = YARD::Registry.root
@@ -16,6 +59,11 @@ module YARD
16
59
  load_handlers
17
60
  end
18
61
 
62
+ # Processes a list of statements by finding handlers to process each
63
+ # one.
64
+ #
65
+ # @param [Array] statements a list of statements
66
+ # @return [nil]
19
67
  def process(statements)
20
68
  statements.each_with_index do |stmt, index|
21
69
  find_handlers(stmt).each do |handler|
@@ -41,6 +89,10 @@ module YARD
41
89
  end
42
90
  end
43
91
 
92
+ # Searches for all handlers in {Base.subclasses} that match the +statement+
93
+ #
94
+ # @param statement the statement object to match.
95
+ # @return [Array<Base>] a list of handlers to process the statement with.
44
96
  def find_handlers(statement)
45
97
  Base.subclasses.find_all do |handler|
46
98
  handler_base_class > handler &&
@@ -51,10 +103,16 @@ module YARD
51
103
 
52
104
  private
53
105
 
106
+ # Returns the handler base class
107
+ # @return [Base] the base class
54
108
  def handler_base_class
55
109
  handler_base_namespace.const_get(:Base)
56
110
  end
57
111
 
112
+ # The module holding the handlers to be loaded
113
+ #
114
+ # @return [Module] the module containing the handlers depending on
115
+ # {#parser_type}.
58
116
  def handler_base_namespace
59
117
  case parser_type
60
118
  when :ruby; Ruby
@@ -62,6 +120,10 @@ module YARD
62
120
  end
63
121
  end
64
122
 
123
+ # Loads handlers from {#handler_base_namespace}. This ensures that
124
+ # Ruby1.9 handlers are never loaded into 1.8; also lowers the amount
125
+ # of modules that are loaded
126
+ # @return [nil]
65
127
  def load_handlers
66
128
  return if @handlers_loaded[parser_type]
67
129
  handler_base_namespace.constants.each {|c| handler_base_namespace.const_get(c) }