yard 0.9.18 → 0.9.19

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 (567) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +26 -26
  3. data/CHANGELOG.md +742 -728
  4. data/LEGAL +66 -66
  5. data/LICENSE +22 -22
  6. data/README.md +328 -328
  7. data/Rakefile +42 -53
  8. data/benchmarks/builtins_vs_eval.rb +24 -24
  9. data/benchmarks/concat_vs_join.rb +13 -13
  10. data/benchmarks/erb_vs_erubis.rb +54 -54
  11. data/benchmarks/format_args.rb +47 -47
  12. data/benchmarks/generation.rb +38 -38
  13. data/benchmarks/marshal_vs_dbm.rb +64 -64
  14. data/benchmarks/parsing.rb +46 -46
  15. data/benchmarks/pathname_vs_string.rb +50 -50
  16. data/benchmarks/rdoc_vs_yardoc.rb +11 -11
  17. data/benchmarks/registry_store_types.rb +49 -49
  18. data/benchmarks/ri_vs_yri.rb +19 -19
  19. data/benchmarks/ripper_parser.rb +13 -13
  20. data/benchmarks/splat_vs_flatten.rb +13 -13
  21. data/benchmarks/template_erb.rb +23 -23
  22. data/benchmarks/template_format.rb +7 -7
  23. data/benchmarks/template_profile.rb +18 -18
  24. data/benchmarks/yri_cache.rb +20 -20
  25. data/bin/yard +13 -13
  26. data/bin/yardoc +13 -13
  27. data/bin/yri +13 -13
  28. data/docs/CodeObjects.md +115 -115
  29. data/docs/GettingStarted.md +679 -679
  30. data/docs/Handlers.md +152 -152
  31. data/docs/Overview.md +61 -61
  32. data/docs/Parser.md +191 -191
  33. data/docs/Tags.md +283 -283
  34. data/docs/TagsArch.md +123 -123
  35. data/docs/Templates.md +496 -496
  36. data/docs/WhatsNew.md +1245 -1245
  37. data/docs/templates/default/fulldoc/html/full_list_tag.erb +8 -8
  38. data/docs/templates/default/fulldoc/html/setup.rb +6 -6
  39. data/docs/templates/default/layout/html/setup.rb +9 -9
  40. data/docs/templates/default/layout/html/tag_list.erb +11 -11
  41. data/docs/templates/default/yard_tags/html/list.erb +18 -18
  42. data/docs/templates/default/yard_tags/html/setup.rb +26 -26
  43. data/docs/templates/plugin.rb +70 -70
  44. data/lib/rubygems_plugin.rb +9 -9
  45. data/lib/yard.rb +69 -69
  46. data/lib/yard/autoload.rb +308 -303
  47. data/lib/yard/cli/command.rb +85 -85
  48. data/lib/yard/cli/command_parser.rb +93 -93
  49. data/lib/yard/cli/config.rb +198 -198
  50. data/lib/yard/cli/diff.rb +270 -270
  51. data/lib/yard/cli/display.rb +69 -69
  52. data/lib/yard/cli/gems.rb +84 -84
  53. data/lib/yard/cli/graph.rb +125 -125
  54. data/lib/yard/cli/help.rb +20 -20
  55. data/lib/yard/cli/i18n.rb +70 -70
  56. data/lib/yard/cli/list.rb +23 -23
  57. data/lib/yard/cli/markup_types.rb +32 -32
  58. data/lib/yard/cli/server.rb +257 -257
  59. data/lib/yard/cli/stats.rb +231 -231
  60. data/lib/yard/cli/yardoc.rb +789 -788
  61. data/lib/yard/cli/yardopts_command.rb +110 -110
  62. data/lib/yard/cli/yri.rb +215 -215
  63. data/lib/yard/code_objects/base.rb +615 -615
  64. data/lib/yard/code_objects/class_object.rb +146 -146
  65. data/lib/yard/code_objects/class_variable_object.rb +11 -11
  66. data/lib/yard/code_objects/constant_object.rb +16 -16
  67. data/lib/yard/code_objects/extended_method_object.rb +24 -24
  68. data/lib/yard/code_objects/extra_file_object.rb +134 -131
  69. data/lib/yard/code_objects/macro_object.rb +172 -172
  70. data/lib/yard/code_objects/method_object.rb +196 -196
  71. data/lib/yard/code_objects/module_object.rb +21 -21
  72. data/lib/yard/code_objects/namespace_mapper.rb +114 -114
  73. data/lib/yard/code_objects/namespace_object.rb +200 -200
  74. data/lib/yard/code_objects/proxy.rb +240 -240
  75. data/lib/yard/code_objects/root_object.rb +19 -19
  76. data/lib/yard/config.rb +270 -270
  77. data/lib/yard/core_ext/array.rb +16 -16
  78. data/lib/yard/core_ext/file.rb +69 -69
  79. data/lib/yard/core_ext/hash.rb +16 -16
  80. data/lib/yard/core_ext/insertion.rb +63 -63
  81. data/lib/yard/core_ext/module.rb +11 -20
  82. data/lib/yard/core_ext/string.rb +68 -68
  83. data/lib/yard/core_ext/symbol_hash.rb +75 -75
  84. data/lib/yard/docstring.rb +386 -386
  85. data/lib/yard/docstring_parser.rb +345 -345
  86. data/lib/yard/gem_index.rb +29 -29
  87. data/lib/yard/globals.rb +22 -22
  88. data/lib/yard/handlers/base.rb +595 -595
  89. data/lib/yard/handlers/c/alias_handler.rb +16 -16
  90. data/lib/yard/handlers/c/attribute_handler.rb +13 -13
  91. data/lib/yard/handlers/c/base.rb +129 -129
  92. data/lib/yard/handlers/c/class_handler.rb +27 -27
  93. data/lib/yard/handlers/c/constant_handler.rb +13 -13
  94. data/lib/yard/handlers/c/handler_methods.rb +212 -211
  95. data/lib/yard/handlers/c/init_handler.rb +20 -20
  96. data/lib/yard/handlers/c/method_handler.rb +45 -45
  97. data/lib/yard/handlers/c/mixin_handler.rb +21 -21
  98. data/lib/yard/handlers/c/module_handler.rb +17 -17
  99. data/lib/yard/handlers/c/override_comment_handler.rb +31 -31
  100. data/lib/yard/handlers/c/path_handler.rb +11 -11
  101. data/lib/yard/handlers/c/struct_handler.rb +13 -13
  102. data/lib/yard/handlers/c/symbol_handler.rb +8 -8
  103. data/lib/yard/handlers/common/method_handler.rb +19 -0
  104. data/lib/yard/handlers/processor.rb +200 -200
  105. data/lib/yard/handlers/ruby/alias_handler.rb +44 -44
  106. data/lib/yard/handlers/ruby/attribute_handler.rb +87 -87
  107. data/lib/yard/handlers/ruby/base.rb +165 -165
  108. data/lib/yard/handlers/ruby/class_condition_handler.rb +92 -92
  109. data/lib/yard/handlers/ruby/class_handler.rb +119 -119
  110. data/lib/yard/handlers/ruby/class_variable_handler.rb +17 -17
  111. data/lib/yard/handlers/ruby/comment_handler.rb +10 -10
  112. data/lib/yard/handlers/ruby/constant_handler.rb +59 -59
  113. data/lib/yard/handlers/ruby/decorator_handler_methods.rb +123 -123
  114. data/lib/yard/handlers/ruby/dsl_handler.rb +15 -15
  115. data/lib/yard/handlers/ruby/dsl_handler_methods.rb +96 -96
  116. data/lib/yard/handlers/ruby/exception_handler.rb +27 -27
  117. data/lib/yard/handlers/ruby/extend_handler.rb +22 -22
  118. data/lib/yard/handlers/ruby/legacy/alias_handler.rb +37 -37
  119. data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +65 -65
  120. data/lib/yard/handlers/ruby/legacy/base.rb +245 -245
  121. data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +83 -83
  122. data/lib/yard/handlers/ruby/legacy/class_handler.rb +113 -113
  123. data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +15 -15
  124. data/lib/yard/handlers/ruby/legacy/comment_handler.rb +10 -10
  125. data/lib/yard/handlers/ruby/legacy/constant_handler.rb +29 -29
  126. data/lib/yard/handlers/ruby/legacy/dsl_handler.rb +17 -17
  127. data/lib/yard/handlers/ruby/legacy/exception_handler.rb +13 -13
  128. data/lib/yard/handlers/ruby/legacy/extend_handler.rb +21 -21
  129. data/lib/yard/handlers/ruby/legacy/method_handler.rb +90 -90
  130. data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +39 -39
  131. data/lib/yard/handlers/ruby/legacy/module_function_handler.rb +19 -19
  132. data/lib/yard/handlers/ruby/legacy/module_handler.rb +12 -12
  133. data/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +22 -22
  134. data/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +22 -22
  135. data/lib/yard/handlers/ruby/legacy/visibility_handler.rb +17 -17
  136. data/lib/yard/handlers/ruby/legacy/yield_handler.rb +29 -29
  137. data/lib/yard/handlers/ruby/method_condition_handler.rb +9 -9
  138. data/lib/yard/handlers/ruby/method_handler.rb +114 -118
  139. data/lib/yard/handlers/ruby/mixin_handler.rb +37 -37
  140. data/lib/yard/handlers/ruby/module_function_handler.rb +27 -27
  141. data/lib/yard/handlers/ruby/module_handler.rb +12 -12
  142. data/lib/yard/handlers/ruby/private_class_method_handler.rb +14 -14
  143. data/lib/yard/handlers/ruby/private_constant_handler.rb +43 -43
  144. data/lib/yard/handlers/ruby/public_class_method_handler.rb +14 -14
  145. data/lib/yard/handlers/ruby/struct_handler_methods.rb +143 -143
  146. data/lib/yard/handlers/ruby/visibility_handler.rb +22 -22
  147. data/lib/yard/handlers/ruby/yield_handler.rb +31 -31
  148. data/lib/yard/i18n/locale.rb +67 -67
  149. data/lib/yard/i18n/message.rb +57 -57
  150. data/lib/yard/i18n/messages.rb +56 -56
  151. data/lib/yard/i18n/po_parser.rb +61 -61
  152. data/lib/yard/i18n/pot_generator.rb +290 -290
  153. data/lib/yard/i18n/text.rb +173 -173
  154. data/lib/yard/logging.rb +205 -205
  155. data/lib/yard/options.rb +217 -217
  156. data/lib/yard/parser/base.rb +57 -57
  157. data/lib/yard/parser/c/c_parser.rb +235 -235
  158. data/lib/yard/parser/c/comment_parser.rb +134 -134
  159. data/lib/yard/parser/c/statement.rb +64 -64
  160. data/lib/yard/parser/ruby/ast_node.rb +540 -540
  161. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +1354 -1354
  162. data/lib/yard/parser/ruby/legacy/ruby_parser.rb +32 -32
  163. data/lib/yard/parser/ruby/legacy/statement.rb +66 -66
  164. data/lib/yard/parser/ruby/legacy/statement_list.rb +394 -394
  165. data/lib/yard/parser/ruby/legacy/token_list.rb +74 -74
  166. data/lib/yard/parser/ruby/ruby_parser.rb +687 -687
  167. data/lib/yard/parser/ruby/token_resolver.rb +156 -156
  168. data/lib/yard/parser/source_parser.rb +526 -526
  169. data/lib/yard/rake/yardoc_task.rb +81 -81
  170. data/lib/yard/registry.rb +439 -439
  171. data/lib/yard/registry_resolver.rb +189 -189
  172. data/lib/yard/registry_store.rb +337 -337
  173. data/lib/yard/rubygems/backports.rb +10 -10
  174. data/lib/yard/rubygems/backports/LICENSE.txt +57 -57
  175. data/lib/yard/rubygems/backports/MIT.txt +20 -20
  176. data/lib/yard/rubygems/backports/gem.rb +10 -10
  177. data/lib/yard/rubygems/backports/source_index.rb +365 -365
  178. data/lib/yard/rubygems/doc_manager.rb +90 -90
  179. data/lib/yard/rubygems/hook.rb +197 -197
  180. data/lib/yard/rubygems/specification.rb +50 -50
  181. data/lib/yard/serializers/base.rb +83 -83
  182. data/lib/yard/serializers/file_system_serializer.rb +123 -123
  183. data/lib/yard/serializers/process_serializer.rb +24 -24
  184. data/lib/yard/serializers/stdout_serializer.rb +34 -34
  185. data/lib/yard/serializers/yardoc_serializer.rb +152 -152
  186. data/lib/yard/server.rb +13 -13
  187. data/lib/yard/server/adapter.rb +100 -100
  188. data/lib/yard/server/commands/base.rb +209 -209
  189. data/lib/yard/server/commands/display_file_command.rb +29 -29
  190. data/lib/yard/server/commands/display_object_command.rb +65 -65
  191. data/lib/yard/server/commands/frames_command.rb +16 -16
  192. data/lib/yard/server/commands/library_command.rb +187 -187
  193. data/lib/yard/server/commands/library_index_command.rb +28 -28
  194. data/lib/yard/server/commands/list_command.rb +25 -25
  195. data/lib/yard/server/commands/root_request_command.rb +15 -15
  196. data/lib/yard/server/commands/search_command.rb +79 -79
  197. data/lib/yard/server/commands/static_file_command.rb +23 -23
  198. data/lib/yard/server/commands/static_file_helpers.rb +62 -62
  199. data/lib/yard/server/doc_server_helper.rb +91 -91
  200. data/lib/yard/server/doc_server_serializer.rb +39 -39
  201. data/lib/yard/server/library_version.rb +277 -277
  202. data/lib/yard/server/rack_adapter.rb +89 -89
  203. data/lib/yard/server/router.rb +187 -187
  204. data/lib/yard/server/static_caching.rb +46 -46
  205. data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +127 -127
  206. data/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +11 -11
  207. data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +37 -37
  208. data/lib/yard/server/templates/default/layout/html/script_setup.erb +7 -7
  209. data/lib/yard/server/templates/default/layout/html/setup.rb +8 -8
  210. data/lib/yard/server/templates/default/method_details/html/permalink.erb +4 -4
  211. data/lib/yard/server/templates/default/method_details/html/setup.rb +5 -5
  212. data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +8 -8
  213. data/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +14 -14
  214. data/lib/yard/server/templates/doc_server/library_list/html/listing.erb +13 -13
  215. data/lib/yard/server/templates/doc_server/library_list/html/setup.rb +6 -6
  216. data/lib/yard/server/templates/doc_server/library_list/html/title.erb +2 -2
  217. data/lib/yard/server/templates/doc_server/processing/html/processing.erb +52 -52
  218. data/lib/yard/server/templates/doc_server/processing/html/setup.rb +4 -4
  219. data/lib/yard/server/templates/doc_server/search/html/search.erb +18 -18
  220. data/lib/yard/server/templates/doc_server/search/html/setup.rb +9 -9
  221. data/lib/yard/server/webrick_adapter.rb +45 -45
  222. data/lib/yard/tags/default_factory.rb +191 -191
  223. data/lib/yard/tags/default_tag.rb +13 -13
  224. data/lib/yard/tags/directives.rb +616 -616
  225. data/lib/yard/tags/library.rb +633 -633
  226. data/lib/yard/tags/option_tag.rb +13 -13
  227. data/lib/yard/tags/overload_tag.rb +71 -71
  228. data/lib/yard/tags/ref_tag.rb +8 -8
  229. data/lib/yard/tags/ref_tag_list.rb +28 -28
  230. data/lib/yard/tags/tag.rb +71 -71
  231. data/lib/yard/tags/tag_format_error.rb +7 -7
  232. data/lib/yard/tags/types_explainer.rb +162 -162
  233. data/lib/yard/templates/engine.rb +186 -186
  234. data/lib/yard/templates/erb_cache.rb +23 -23
  235. data/lib/yard/templates/helpers/base_helper.rb +215 -215
  236. data/lib/yard/templates/helpers/filter_helper.rb +27 -27
  237. data/lib/yard/templates/helpers/html_helper.rb +646 -646
  238. data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +78 -78
  239. data/lib/yard/templates/helpers/markup/rdoc_markdown.rb +23 -23
  240. data/lib/yard/templates/helpers/markup/rdoc_markup.rb +109 -109
  241. data/lib/yard/templates/helpers/markup_helper.rb +172 -172
  242. data/lib/yard/templates/helpers/method_helper.rb +75 -75
  243. data/lib/yard/templates/helpers/module_helper.rb +21 -21
  244. data/lib/yard/templates/helpers/text_helper.rb +112 -112
  245. data/lib/yard/templates/helpers/uml_helper.rb +47 -47
  246. data/lib/yard/templates/section.rb +105 -105
  247. data/lib/yard/templates/template.rb +418 -418
  248. data/lib/yard/templates/template_options.rb +92 -92
  249. data/lib/yard/verifier.rb +151 -151
  250. data/lib/yard/version.rb +6 -6
  251. data/spec/cli/command_parser_spec.rb +43 -43
  252. data/spec/cli/command_spec.rb +36 -36
  253. data/spec/cli/config_spec.rb +148 -148
  254. data/spec/cli/diff_spec.rb +254 -254
  255. data/spec/cli/display_spec.rb +30 -30
  256. data/spec/cli/gems_spec.rb +81 -81
  257. data/spec/cli/graph_spec.rb +18 -18
  258. data/spec/cli/help_spec.rb +22 -22
  259. data/spec/cli/i18n_spec.rb +107 -107
  260. data/spec/cli/list_spec.rb +8 -8
  261. data/spec/cli/markup_types_spec.rb +22 -22
  262. data/spec/cli/server_spec.rb +324 -324
  263. data/spec/cli/stats_spec.rb +96 -96
  264. data/spec/cli/yard_on_yard_spec.rb +38 -38
  265. data/spec/cli/yardoc_spec.rb +896 -862
  266. data/spec/cli/yri_spec.rb +101 -101
  267. data/spec/code_objects/base_spec.rb +470 -470
  268. data/spec/code_objects/class_object_spec.rb +226 -226
  269. data/spec/code_objects/code_object_list_spec.rb +36 -36
  270. data/spec/code_objects/constants_spec.rb +116 -116
  271. data/spec/code_objects/extra_file_object_spec.rb +160 -160
  272. data/spec/code_objects/macro_object_spec.rb +150 -150
  273. data/spec/code_objects/method_object_spec.rb +184 -184
  274. data/spec/code_objects/module_object_spec.rb +142 -142
  275. data/spec/code_objects/namespace_object_spec.rb +171 -171
  276. data/spec/code_objects/proxy_spec.rb +141 -141
  277. data/spec/code_objects/spec_helper.rb +3 -3
  278. data/spec/config_spec.rb +171 -171
  279. data/spec/core_ext/array_spec.rb +13 -13
  280. data/spec/core_ext/file_spec.rb +72 -72
  281. data/spec/core_ext/hash_spec.rb +14 -14
  282. data/spec/core_ext/insertion_spec.rb +37 -37
  283. data/spec/core_ext/module_spec.rb +9 -15
  284. data/spec/core_ext/string_spec.rb +42 -42
  285. data/spec/core_ext/symbol_hash_spec.rb +89 -89
  286. data/spec/docstring_parser_spec.rb +280 -280
  287. data/spec/docstring_spec.rb +373 -373
  288. data/spec/examples.txt +1883 -1875
  289. data/spec/handlers/alias_handler_spec.rb +82 -82
  290. data/spec/handlers/attribute_handler_spec.rb +96 -96
  291. data/spec/handlers/base_spec.rb +216 -216
  292. data/spec/handlers/c/alias_handler_spec.rb +34 -34
  293. data/spec/handlers/c/attribute_handler_spec.rb +41 -41
  294. data/spec/handlers/c/class_handler_spec.rb +78 -78
  295. data/spec/handlers/c/constant_handler_spec.rb +71 -71
  296. data/spec/handlers/c/init_handler_spec.rb +48 -48
  297. data/spec/handlers/c/method_handler_spec.rb +327 -325
  298. data/spec/handlers/c/mixin_handler_spec.rb +44 -44
  299. data/spec/handlers/c/module_handler_spec.rb +71 -71
  300. data/spec/handlers/c/override_comment_handler_spec.rb +47 -47
  301. data/spec/handlers/c/path_handler_spec.rb +36 -36
  302. data/spec/handlers/c/spec_helper.rb +23 -23
  303. data/spec/handlers/c/struct_handler_spec.rb +16 -16
  304. data/spec/handlers/class_condition_handler_spec.rb +87 -87
  305. data/spec/handlers/class_handler_spec.rb +247 -247
  306. data/spec/handlers/class_method_handler_shared_examples.rb +133 -133
  307. data/spec/handlers/class_variable_handler_spec.rb +12 -12
  308. data/spec/handlers/constant_handler_spec.rb +112 -112
  309. data/spec/handlers/decorator_handler_methods_spec.rb +393 -393
  310. data/spec/handlers/dsl_handler_spec.rb +219 -219
  311. data/spec/handlers/examples/alias_handler_001.rb.txt +45 -45
  312. data/spec/handlers/examples/attribute_handler_001.rb.txt +31 -31
  313. data/spec/handlers/examples/class_condition_handler_001.rb.txt +68 -68
  314. data/spec/handlers/examples/class_handler_001.rb.txt +120 -120
  315. data/spec/handlers/examples/class_variable_handler_001.rb.txt +9 -9
  316. data/spec/handlers/examples/constant_handler_001.rb.txt +35 -35
  317. data/spec/handlers/examples/dsl_handler_001.rb.txt +154 -154
  318. data/spec/handlers/examples/exception_handler_001.rb.txt +58 -58
  319. data/spec/handlers/examples/extend_handler_001.rb.txt +15 -15
  320. data/spec/handlers/examples/method_condition_handler_001.rb.txt +9 -9
  321. data/spec/handlers/examples/method_handler_001.rb.txt +128 -128
  322. data/spec/handlers/examples/mixin_handler_001.rb.txt +37 -37
  323. data/spec/handlers/examples/module_handler_001.rb.txt +29 -29
  324. data/spec/handlers/examples/private_constant_handler_001.rb.txt +8 -8
  325. data/spec/handlers/examples/process_handler_001.rb.txt +11 -11
  326. data/spec/handlers/examples/visibility_handler_001.rb.txt +35 -35
  327. data/spec/handlers/examples/yield_handler_001.rb.txt +54 -54
  328. data/spec/handlers/exception_handler_spec.rb +49 -49
  329. data/spec/handlers/extend_handler_spec.rb +24 -24
  330. data/spec/handlers/legacy_base_spec.rb +128 -128
  331. data/spec/handlers/method_condition_handler_spec.rb +15 -15
  332. data/spec/handlers/method_handler_spec.rb +190 -190
  333. data/spec/handlers/mixin_handler_spec.rb +56 -56
  334. data/spec/handlers/module_function_handler_spec.rb +106 -106
  335. data/spec/handlers/module_handler_spec.rb +35 -35
  336. data/spec/handlers/private_class_method_handler_spec.rb +11 -11
  337. data/spec/handlers/private_constant_handler_spec.rb +25 -25
  338. data/spec/handlers/processor_spec.rb +35 -35
  339. data/spec/handlers/public_class_method_handler_spec.rb +11 -11
  340. data/spec/handlers/ruby/base_spec.rb +95 -95
  341. data/spec/handlers/ruby/legacy/base_spec.rb +84 -84
  342. data/spec/handlers/spec_helper.rb +33 -33
  343. data/spec/handlers/visibility_handler_spec.rb +44 -44
  344. data/spec/handlers/yield_handler_spec.rb +52 -52
  345. data/spec/i18n/locale_spec.rb +81 -81
  346. data/spec/i18n/message_spec.rb +52 -52
  347. data/spec/i18n/messages_spec.rb +67 -67
  348. data/spec/i18n/pot_generator_spec.rb +295 -295
  349. data/spec/i18n/text_spec.rb +184 -184
  350. data/spec/logging_spec.rb +44 -44
  351. data/spec/options_spec.rb +171 -171
  352. data/spec/parser/base_spec.rb +24 -24
  353. data/spec/parser/c_parser_spec.rb +236 -236
  354. data/spec/parser/examples/array.c.txt +6267 -6267
  355. data/spec/parser/examples/example1.rb.txt +7 -7
  356. data/spec/parser/examples/extrafile.c.txt +8 -8
  357. data/spec/parser/examples/file.c.txt +28 -28
  358. data/spec/parser/examples/multifile.c.txt +22 -22
  359. data/spec/parser/examples/namespace.cpp.txt +68 -68
  360. data/spec/parser/examples/override.c.txt +424 -424
  361. data/spec/parser/examples/parse_in_order_001.rb.txt +2 -2
  362. data/spec/parser/examples/parse_in_order_002.rb.txt +1 -1
  363. data/spec/parser/examples/tag_handler_001.rb.txt +7 -7
  364. data/spec/parser/ruby/ast_node_spec.rb +33 -33
  365. data/spec/parser/ruby/legacy/statement_list_spec.rb +299 -299
  366. data/spec/parser/ruby/legacy/token_list_spec.rb +79 -79
  367. data/spec/parser/ruby/ruby_parser_spec.rb +508 -508
  368. data/spec/parser/ruby/token_resolver_spec.rb +165 -165
  369. data/spec/parser/source_parser_spec.rb +727 -727
  370. data/spec/parser/tag_parsing_spec.rb +17 -17
  371. data/spec/rake/yardoc_task_spec.rb +118 -118
  372. data/spec/registry_spec.rb +463 -463
  373. data/spec/registry_store_spec.rb +316 -316
  374. data/spec/rubygems/doc_manager_spec.rb +112 -112
  375. data/spec/serializers/data/serialized_yardoc/checksums +1 -1
  376. data/spec/serializers/file_system_serializer_spec.rb +145 -145
  377. data/spec/serializers/spec_helper.rb +2 -2
  378. data/spec/serializers/yardoc_serializer_spec.rb +78 -78
  379. data/spec/server/adapter_spec.rb +39 -39
  380. data/spec/server/commands/base_spec.rb +91 -91
  381. data/spec/server/commands/library_command_spec.rb +39 -39
  382. data/spec/server/doc_server_helper_spec.rb +72 -72
  383. data/spec/server/doc_server_serializer_spec.rb +60 -60
  384. data/spec/server/rack_adapter_spec.rb +21 -21
  385. data/spec/server/router_spec.rb +123 -123
  386. data/spec/server/spec_helper.rb +22 -22
  387. data/spec/server/static_caching_spec.rb +47 -47
  388. data/spec/server/webrick_servlet_spec.rb +20 -20
  389. data/spec/server_spec.rb +19 -19
  390. data/spec/spec_helper.rb +212 -212
  391. data/spec/tags/default_factory_spec.rb +168 -168
  392. data/spec/tags/default_tag_spec.rb +11 -11
  393. data/spec/tags/directives_spec.rb +463 -463
  394. data/spec/tags/library_spec.rb +48 -48
  395. data/spec/tags/overload_tag_spec.rb +53 -53
  396. data/spec/tags/ref_tag_list_spec.rb +53 -53
  397. data/spec/tags/types_explainer_spec.rb +203 -203
  398. data/spec/templates/class_spec.rb +45 -45
  399. data/spec/templates/constant_spec.rb +41 -41
  400. data/spec/templates/engine_spec.rb +131 -131
  401. data/spec/templates/examples/class001.html +308 -308
  402. data/spec/templates/examples/class001.txt +36 -36
  403. data/spec/templates/examples/class002.html +39 -39
  404. data/spec/templates/examples/constant001.txt +24 -24
  405. data/spec/templates/examples/constant002.txt +6 -6
  406. data/spec/templates/examples/constant003.txt +10 -10
  407. data/spec/templates/examples/method001.html +137 -137
  408. data/spec/templates/examples/method001.txt +35 -35
  409. data/spec/templates/examples/method002.html +91 -91
  410. data/spec/templates/examples/method002.txt +20 -20
  411. data/spec/templates/examples/method003.html +165 -165
  412. data/spec/templates/examples/method003.txt +45 -45
  413. data/spec/templates/examples/method004.html +48 -48
  414. data/spec/templates/examples/method004.txt +10 -10
  415. data/spec/templates/examples/method005.html +105 -105
  416. data/spec/templates/examples/method005.txt +33 -33
  417. data/spec/templates/examples/method006.html +107 -107
  418. data/spec/templates/examples/method006.txt +20 -20
  419. data/spec/templates/examples/module001.dot +33 -33
  420. data/spec/templates/examples/module001.html +833 -833
  421. data/spec/templates/examples/module001.txt +33 -33
  422. data/spec/templates/examples/module002.html +341 -341
  423. data/spec/templates/examples/module003.html +202 -202
  424. data/spec/templates/examples/module004.html +394 -394
  425. data/spec/templates/examples/module005.html +81 -81
  426. data/spec/templates/examples/tag001.txt +82 -82
  427. data/spec/templates/helpers/base_helper_spec.rb +171 -171
  428. data/spec/templates/helpers/html_helper_spec.rb +687 -668
  429. data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +65 -65
  430. data/spec/templates/helpers/markup/rdoc_markup_spec.rb +84 -84
  431. data/spec/templates/helpers/markup_helper_spec.rb +136 -136
  432. data/spec/templates/helpers/method_helper_spec.rb +107 -107
  433. data/spec/templates/helpers/module_helper_spec.rb +35 -35
  434. data/spec/templates/helpers/shared_signature_examples.rb +126 -126
  435. data/spec/templates/helpers/text_helper_spec.rb +65 -65
  436. data/spec/templates/method_spec.rb +118 -118
  437. data/spec/templates/module_spec.rb +203 -203
  438. data/spec/templates/onefile_spec.rb +66 -66
  439. data/spec/templates/section_spec.rb +144 -144
  440. data/spec/templates/spec_helper.rb +76 -76
  441. data/spec/templates/tag_spec.rb +52 -52
  442. data/spec/templates/template_spec.rb +410 -410
  443. data/spec/verifier_spec.rb +106 -106
  444. data/templates/default/class/dot/setup.rb +7 -7
  445. data/templates/default/class/dot/superklass.erb +2 -2
  446. data/templates/default/class/html/constructor_details.erb +8 -8
  447. data/templates/default/class/html/setup.rb +2 -2
  448. data/templates/default/class/html/subclasses.erb +4 -4
  449. data/templates/default/class/setup.rb +36 -36
  450. data/templates/default/class/text/setup.rb +12 -12
  451. data/templates/default/class/text/subclasses.erb +5 -5
  452. data/templates/default/constant/text/header.erb +11 -11
  453. data/templates/default/constant/text/setup.rb +4 -4
  454. data/templates/default/docstring/html/abstract.erb +4 -4
  455. data/templates/default/docstring/html/deprecated.erb +1 -1
  456. data/templates/default/docstring/html/index.erb +5 -5
  457. data/templates/default/docstring/html/note.erb +6 -6
  458. data/templates/default/docstring/html/private.erb +4 -4
  459. data/templates/default/docstring/html/text.erb +1 -1
  460. data/templates/default/docstring/html/todo.erb +6 -6
  461. data/templates/default/docstring/setup.rb +52 -52
  462. data/templates/default/docstring/text/abstract.erb +2 -2
  463. data/templates/default/docstring/text/deprecated.erb +2 -2
  464. data/templates/default/docstring/text/index.erb +2 -2
  465. data/templates/default/docstring/text/note.erb +3 -3
  466. data/templates/default/docstring/text/private.erb +2 -2
  467. data/templates/default/docstring/text/text.erb +1 -1
  468. data/templates/default/docstring/text/todo.erb +3 -3
  469. data/templates/default/fulldoc/html/css/full_list.css +58 -58
  470. data/templates/default/fulldoc/html/css/style.css +496 -496
  471. data/templates/default/fulldoc/html/frames.erb +17 -17
  472. data/templates/default/fulldoc/html/full_list.erb +37 -37
  473. data/templates/default/fulldoc/html/full_list_class.erb +2 -2
  474. data/templates/default/fulldoc/html/full_list_file.erb +7 -7
  475. data/templates/default/fulldoc/html/full_list_method.erb +10 -10
  476. data/templates/default/fulldoc/html/js/app.js +303 -292
  477. data/templates/default/fulldoc/html/js/full_list.js +216 -216
  478. data/templates/default/fulldoc/html/js/jquery.js +3 -3
  479. data/templates/default/fulldoc/html/setup.rb +241 -241
  480. data/templates/default/layout/dot/header.erb +5 -5
  481. data/templates/default/layout/dot/setup.rb +15 -15
  482. data/templates/default/layout/html/breadcrumb.erb +11 -11
  483. data/templates/default/layout/html/files.erb +11 -11
  484. data/templates/default/layout/html/footer.erb +5 -5
  485. data/templates/default/layout/html/headers.erb +15 -15
  486. data/templates/default/layout/html/index.erb +2 -2
  487. data/templates/default/layout/html/layout.erb +23 -23
  488. data/templates/default/layout/html/listing.erb +4 -4
  489. data/templates/default/layout/html/objects.erb +32 -32
  490. data/templates/default/layout/html/script_setup.erb +4 -4
  491. data/templates/default/layout/html/search.erb +12 -12
  492. data/templates/default/layout/html/setup.rb +89 -89
  493. data/templates/default/method/html/header.erb +16 -16
  494. data/templates/default/method/setup.rb +4 -4
  495. data/templates/default/method_details/html/header.erb +2 -2
  496. data/templates/default/method_details/html/method_signature.erb +24 -24
  497. data/templates/default/method_details/html/source.erb +9 -9
  498. data/templates/default/method_details/setup.rb +11 -11
  499. data/templates/default/method_details/text/header.erb +10 -10
  500. data/templates/default/method_details/text/method_signature.erb +12 -12
  501. data/templates/default/method_details/text/setup.rb +11 -11
  502. data/templates/default/module/dot/child.erb +1 -1
  503. data/templates/default/module/dot/dependencies.erb +2 -2
  504. data/templates/default/module/dot/header.erb +6 -6
  505. data/templates/default/module/dot/info.erb +13 -13
  506. data/templates/default/module/dot/setup.rb +15 -15
  507. data/templates/default/module/html/attribute_details.erb +10 -10
  508. data/templates/default/module/html/attribute_summary.erb +8 -8
  509. data/templates/default/module/html/box_info.erb +43 -43
  510. data/templates/default/module/html/children.erb +8 -8
  511. data/templates/default/module/html/constant_summary.erb +17 -17
  512. data/templates/default/module/html/defines.erb +2 -2
  513. data/templates/default/module/html/header.erb +5 -5
  514. data/templates/default/module/html/inherited_attributes.erb +14 -14
  515. data/templates/default/module/html/inherited_constants.erb +8 -8
  516. data/templates/default/module/html/inherited_methods.erb +18 -18
  517. data/templates/default/module/html/item_summary.erb +40 -40
  518. data/templates/default/module/html/method_details_list.erb +9 -9
  519. data/templates/default/module/html/method_summary.erb +13 -13
  520. data/templates/default/module/html/methodmissing.erb +12 -12
  521. data/templates/default/module/setup.rb +167 -167
  522. data/templates/default/module/text/children.erb +9 -9
  523. data/templates/default/module/text/class_meths_list.erb +7 -7
  524. data/templates/default/module/text/extends.erb +7 -7
  525. data/templates/default/module/text/header.erb +7 -7
  526. data/templates/default/module/text/includes.erb +7 -7
  527. data/templates/default/module/text/instance_meths_list.erb +7 -7
  528. data/templates/default/module/text/setup.rb +13 -13
  529. data/templates/default/onefile/html/files.erb +4 -4
  530. data/templates/default/onefile/html/headers.erb +6 -6
  531. data/templates/default/onefile/html/layout.erb +17 -17
  532. data/templates/default/onefile/html/readme.erb +2 -2
  533. data/templates/default/onefile/html/setup.rb +62 -62
  534. data/templates/default/root/dot/child.erb +2 -2
  535. data/templates/default/root/dot/setup.rb +6 -6
  536. data/templates/default/root/html/setup.rb +2 -2
  537. data/templates/default/tags/html/example.erb +10 -10
  538. data/templates/default/tags/html/index.erb +2 -2
  539. data/templates/default/tags/html/option.erb +24 -24
  540. data/templates/default/tags/html/overload.erb +13 -13
  541. data/templates/default/tags/html/see.erb +7 -7
  542. data/templates/default/tags/html/tag.erb +20 -20
  543. data/templates/default/tags/setup.rb +57 -57
  544. data/templates/default/tags/text/example.erb +12 -12
  545. data/templates/default/tags/text/index.erb +1 -1
  546. data/templates/default/tags/text/option.erb +20 -20
  547. data/templates/default/tags/text/overload.erb +19 -19
  548. data/templates/default/tags/text/see.erb +11 -11
  549. data/templates/default/tags/text/tag.erb +13 -13
  550. data/templates/guide/class/html/setup.rb +2 -2
  551. data/templates/guide/docstring/html/setup.rb +2 -2
  552. data/templates/guide/fulldoc/html/css/style.css +108 -108
  553. data/templates/guide/fulldoc/html/js/app.js +33 -33
  554. data/templates/guide/fulldoc/html/setup.rb +74 -74
  555. data/templates/guide/layout/html/layout.erb +81 -81
  556. data/templates/guide/layout/html/setup.rb +25 -25
  557. data/templates/guide/method/html/header.erb +17 -17
  558. data/templates/guide/method/html/setup.rb +22 -22
  559. data/templates/guide/module/html/header.erb +6 -6
  560. data/templates/guide/module/html/method_list.erb +4 -4
  561. data/templates/guide/module/html/setup.rb +27 -27
  562. data/templates/guide/onefile/html/files.erb +4 -4
  563. data/templates/guide/onefile/html/setup.rb +6 -6
  564. data/templates/guide/onefile/html/toc.erb +3 -3
  565. data/templates/guide/tags/html/setup.rb +9 -9
  566. data/yard.gemspec +43 -43
  567. metadata +4 -3
@@ -1,1245 +1,1245 @@
1
- # @title What's New?
2
-
3
- # What's New in 0.8.x?
4
-
5
- 1. **Directives (new behavioural tag syntax)** (0.8.0)
6
- 2. **Added `--embed-mixin(s)` to embed mixins into class docs** (0.8.0)
7
- 3. **Internationalization (I18n) support for translating docs** (0.8.0)
8
- 4. **New C parser / handlers architecture** (0.8.0)
9
- 5. **YARD will now warn if `@param` name not in method params** (0.8.0)
10
- 6. **Added support for `module_function` calls in Ruby code** (0.8.0)
11
- 7. **Greatly improved tag documentation using custom template** (0.8.0)
12
- 8. **Tags can now contain '.' for namespacing** (0.8.0)
13
- 9. **Added "frames" links for non-framed pages for better nav** (0.8.0)
14
- 10. **Added Gemfile support to YARD server for local gem sets** (0.8.0)
15
- 11. **Server now displays README on index route like static docs** (0.8.0)
16
- 12. **Added line numbers to `yard stats --list-undoc --compact`** (0.8.0)
17
- 13. **Single object db now default (multi-object db unsupported)** (0.8.0)
18
- 14. **Added `--api` tag to generate documentation for API sets** (0.8.1)
19
- 15. **Added `--non-transitive-tag` to disable transitive tag** (0.8.3)
20
- 16. **Added `-B/--bind` to bind to a port in yard server** (0.8.4)
21
- 17. **Added `asciidoc` markup type support** (0.8.6)
22
- 18. **Added `yard markups` command to list available markup types** (0.8.6)
23
- 19. **Added `yard display` command to display formatted objects** (0.8.6)
24
- 20. **Added `--layout` to `yard display` command** (0.8.6.1)
25
- 21. **Added `stats_options` for the rake task** (0.8.7.6)
26
-
27
- ## Directives (new behavioural tag syntax) (0.8.0)
28
-
29
- <p class="note">
30
- The tags {tag:!macro}, {tag:!method}, {tag:!attribute}, {tag:!group},
31
- {tag:!endgroup}, {tag:!scope} and {tag:!visibility} have been changed
32
- from meta-data tags to directives. This means they should now be called
33
- with the "@!" prefix instead of "@". Note however that for <strong>
34
- backward compatibility</strong>, the old "@macro", "@method", etc.,
35
- syntax for all of these tags will still work and is supported.
36
- </p>
37
-
38
- <p class="note">
39
- Some <strong>backwards incompatible</strong> changes were made to {tag:!macro} syntax.
40
- Please read this section carefully if you are using this tag.
41
- </p>
42
-
43
- YARD 0.8.0 adds a new tag syntax called "directives" using the `@!`
44
- prefix. These directive tags can be used to modify parser state while
45
- processing objects, or even create new objects on the fly. A plugin
46
- API is available similar to tags, and directives should be registered
47
- in the {YARD::Tags::Library} class using {YARD::Tags::Library.define_directive}.
48
-
49
- To use a directive, simply call it the same way as any tag. Tag syntax
50
- is documented in {file:docs/Tags.md}.
51
-
52
- ### Notable features of directives
53
-
54
- #### Directives do not need to be attached to object docstrings
55
-
56
- Unlike meta-data tags which apply to created objects, directives
57
- do not need to be attached to an object in order to be used. This
58
- means you can have free-standing comments with directives, such as:
59
-
60
- # @macro mymacro
61
- # A new macro, not attached to any docstring
62
-
63
- # ...other Ruby code here...
64
-
65
- # Using the macro:
66
- # @macro mymacro
67
- def mymethod; end
68
-
69
- You can do the same to define methods and attributes, as discussed
70
- below.
71
-
72
- #### `@!method` and `@!attribute` directives improved
73
-
74
- The method and attribute directives can now be used to create multiple
75
- objects in a single docstring. Previously a `@method` or `@attribute`
76
- tag would only create one method per docstring. In 0.8.0, you could
77
- attach multiple methods to the same block of Ruby source, such as:
78
-
79
- # @!method foo(a, b, c)
80
- # @!method bar(x, y, z)
81
- # Docstring for code
82
- some_ruby_source
83
-
84
- The above creates #foo and #bar and the source listing for both will
85
- be `some_ruby_source` with "Docstring for code" as the docstring.
86
-
87
- The attribute directive can take advantage of this functionality as well.
88
- Note that these directives also do not need to be attached to a line of
89
- code to be recognized; they can be in free-standing comments if the
90
- methods are defined dynamically and not associated with any code.
91
-
92
- #### New `@!parse` directive to parse Ruby code
93
-
94
- A new {tag:!parse} directive was added that allows a developer to have
95
- YARD parse code that might not necessarily be parseable in its original
96
- form. This is useful when using `instance_eval` and other dynamic
97
- meta-programming techniques to define methods or perform functionality.
98
- For instance, a common case of the "self.included" callback in module
99
- to extend a module on a class might be in the form:
100
-
101
- def self.included(mod)
102
- mod.extend(self)
103
- end
104
-
105
- Unfortunately, this does not get picked up by YARD, but on the original
106
- class, we can add:
107
-
108
- class MyClass
109
- # @!parse extend TheDynamicModule
110
- include TheDynamicModule
111
- end
112
-
113
- YARD will then parse the code `extend TheDynamicModule` as if
114
- it were in the source file.
115
-
116
- You can also use this technique to register regular methods as
117
- attributes, if you did not define them with `attr_*` methods:
118
-
119
- def foo; @foo end
120
- def foo=(v) @foo = v end
121
-
122
- # Register them as methods:
123
- # @!parse attr_accessor :foo
124
-
125
- ### Backward incompatible changes to `@!macro` directive
126
-
127
- Unfortunately, in order to create the new directives architecture,
128
- some previously supported syntax in `@macro` tags are no longer supported.
129
- Specifically, macros can no longer expand text on an entire docstring.
130
- Instead, macros only expand the data that is indented inside of the tag
131
- text.
132
-
133
- This syntax is **no longer supported**:
134
-
135
- # @macro mymacro
136
- # Expanding text $1 $2 $3
137
- property :a, :b, :c
138
-
139
- In 0.7.0 to 0.7.5, the above would have created a method with the docstring
140
- "Expanding text a b c". This will not work in 0.8.0. Instead, you must
141
- indent all the macro expansion data so that it is part of the `@macro`
142
- tag as follows:
143
-
144
- # @!macro mymacro
145
- # Expanding text $1 $2 $3
146
- property :a, :b, :c
147
-
148
- Note that we also use the recommended `@!macro` syntax, though `@macro`
149
- is still supported.
150
-
151
- ## Added `--embed-mixin(s)` to embed mixins into class docs (0.8.0)
152
-
153
- Methods from mixins can now be embedded directly into the documentation
154
- output for a class by using `--embed-mixin ModuleName`, or `--embed-mixins`
155
- for all mixins. This enables a documentation writer to refactor methods
156
- into modules without worrying about them showing up in separate files
157
- in generated documentation. When mixin methods are embedded, they
158
- show up in both the original module page and the pages of the classes
159
- they are mixed into. A note is added to the method signature telling the
160
- user where the method comes from.
161
-
162
- The `--embed-mixin` command-line option can also take wildcard values
163
- in order to match specific namespaces. For instance, you can embed
164
- only mixins inside of a "Foo::Bar" namespace by doing:
165
-
166
- !!!sh
167
- $ yard doc --embed-mixin "Foo::Bar::*"
168
-
169
- ## Internationalization (I18n) support for translating docs
170
-
171
- YARD now ships with the beginnings of internationalization support
172
- for translating documentation into multiple languages. The
173
- `yard i18n` command now allows you to generate ".pot" and ultimately
174
- ".po" files for translation with [gettext](http://www.gnu.org/software/gettext).
175
-
176
- Note that this tool is a small step in the larger transition for
177
- proper I18n support in YARD. We still have to add proper gettext
178
- support to our templates for proper generation in multiple languages,
179
- but this tool allows you to get started in translating your
180
- documents. Improved I18n support will come throughout the 0.8.x series.
181
-
182
- ## New C parser / handlers architecture (0.8.0)
183
-
184
- The C parser was completely rewritten to take advantage of YARD's
185
- parser and handler architecture. This means more YARD will be more robust
186
- when parsing failures occur, tags and directives will now work consistently
187
- across Ruby and CRuby files ({tag:!group} will now work, for instance),
188
- and developers can now write custom handlers that target CRuby source files.
189
-
190
- ## YARD will now warn if `@param` name not in method params (0.8.0)
191
-
192
- YARD will now give you a warning if you use a `@param` tag in your
193
- source but give an invalid parameter name. This should catch a lot of
194
- common documentation errors and help keep your documentation consistent.
195
-
196
- ## Added support for `module_function` calls in Ruby code (0.8.0)
197
-
198
- The `module_function` command in Ruby is now supported in Ruby files.
199
- It defines two separate methods, one class and one instance method,
200
- both having the exact same docstring, and marks the instance method
201
- as private.
202
-
203
- ## Greatly improved tag documentation using custom template (0.8.0)
204
-
205
- We have completely revamped the {docs/Tags.md} to include documentation
206
- for each meta-data tag and directive with at least one useful example
207
- for each one. This was done using template customization and extension
208
- available within YARD.
209
-
210
- ## Tags can now contain '.' for namespacing (0.8.0)
211
-
212
- Prior to 0.8.0, tags could only contain alphanumeric characters and
213
- underscore. YARD now allows the '.' character in tag names, and it
214
- is now recommended for namespacing project-specific custom tags.
215
- YARD has its own set of custom tags that are namespaced in this
216
- way (using the "yard.tagname" namespace). The namespace recommendation
217
- is to use "projectname.tagname", or "projectname.component.tagname".
218
-
219
- ## Added "frames" links for non-framed pages for better nav (0.8.0)
220
-
221
- Frames navigation has always had a "(no frames)" link to get rid
222
- of the frameset. YARD 0.8.0 introduces a "(frames)" link on non-framed
223
- pages to reverse this, allowing you to navigate between framed and
224
- frameless pages seamlessly.
225
-
226
- ## Added Gemfile support to YARD server for local gem sets (0.8.0)
227
-
228
- The `yard server` command now supports `--gemfile` to serve gems
229
- from a Gemfile.lock, instead of all system-wide gems.
230
-
231
- ## Server now displays README on index route like static docs (0.8.0)
232
-
233
- The `yard server` command will now behave like static docs regarding
234
- the index action for a project, listing the README file if present
235
- before displaying the alphabetic index. Note that the route for
236
- the alphabetic index page has now moved to the explicit '/index' action.
237
-
238
- ## Added line numbers to `yard stats --list-undoc --compact` (0.8.0)
239
-
240
- Line numbers are now listed in the compact listing of undocumented objects
241
- so that they can be more easily located in the files.
242
-
243
- ## Single object db now default (multi-object db unsupported) (0.8.0)
244
-
245
- YARD previously would split the .yardoc db into multiple marshal files
246
- for load-time performance reasons if it grew past a specific number of
247
- objects. This check is now disabled, and YARD will never automatically
248
- switch to a multi-object DB. YARD will now always use the single object
249
- db unless explicitly set with `--no-single-db`. If YARD is taking a
250
- long time to load your .yardoc database, you can try using this
251
- option to split your database into multiple files, but note that this
252
- can cause problems with certain codebases (specifically, if you
253
- have class methods using the same name as a module/class).
254
-
255
- ## Added `--api` tag to generate documentation for API sets (0.8.1)
256
-
257
- You can now use `yardoc --api APINAME` to generate documentation only
258
- for objects with the `@api APINAME` tag (or any parent namespace objects,
259
- since this tag is transitive). Multiple `--api` switches may be used to
260
- generate documentation for multiple APIs together. The following generates
261
- documentation for both the "public" and "developer" APIs, also including
262
- any objects with undefined API (via `--no-api`):
263
-
264
- $ yard doc --api public --api developer --no-api
265
-
266
- Note that if you use `--api`, you must ensure that you also add `@api`
267
- tags to your namespace objects (modules and classes), not just your methods.
268
- If you do not want to do this, you can also include all objects with *no*
269
- `@api` tag by using `--no-api` as shown above.
270
-
271
- Remember that applying an `@api` tag to a class or module will apply it
272
- to all children that do not have this tag already defined, so you can
273
- declare an entire class public by applying it to the class itself. Note
274
- also that these tags can be overridden by child elements if the tag is
275
- re-applied to the individual object.
276
-
277
- This feature is a simplified version of the more powerful `--query`
278
- switch. The query to display the same API documentation as the
279
- above example would be:
280
-
281
- $ yard doc --query '!@api || @api.text =~ /^(public|private)$/'
282
-
283
- But note that `--query` does not work when YARD is in "safe mode"
284
- due to security concerns, whereas `--api` works in either mode.
285
- This enables `--api` to function on remote documentation sites like
286
- [rubydoc.info](http://rubydoc.info).
287
-
288
- ## Added `--non-transitive-tag` to disable transitive tag (0.8.3)
289
-
290
- You can now use `--non-transitive-tag` to disable transitivity on
291
- tags that are defined as transitive by default. For instance, in
292
- some cases you might not want the @api tag to apply to all methods
293
- when you define it on a class. Only the class itself has a specific
294
- @api tag. To do this, you can mark @api as non-transitive with:
295
-
296
- $ yard doc --non-transitive-tag api --api some_api
297
-
298
- Which will avoid classifying treating @api as a transitive tag
299
- when parsing modules and classes.
300
-
301
- ## Added `-B/--bind` to bind to a port in yard server (0.8.4)
302
-
303
- You can now bind the `yard server` command to a given local port
304
- with `yard server -B PORT` or `yard server --bind PORT`.
305
-
306
- ## Added `asciidoc` markup type support (0.8.6)
307
-
308
- Support for the AsciiDoc markup type is now introduced using the `asciidoc`
309
- markup type (`yard doc -m asciidoc`). Requires the
310
- [asciidoctor](http://rubygems.org/gems/asciidoctor) RubyGem library to be
311
- installed before running YARD.
312
-
313
- ## Added `yard markups` command to list available markup types (0.8.6)
314
-
315
- You can now list all available markup types and their respective providers by
316
- typing `yard markups`. This list also includes the file extensions used to
317
- auto-identify markup types for extra files and READMEs. To use a markup in
318
- the list, call `yard doc` with `-m MARKUP_TYPE`. To select a specific markup
319
- provider library, pass the `-M PROVIDER_NAME` option.
320
-
321
- ## Added `yard display` command to display formatted objects (0.8.6)
322
-
323
- <p class="note">This feature requires the .yardoc registry to have already been
324
- generated. To generate the registry, run <code>yard doc -n</code>.
325
- </p>
326
-
327
- You can now display a single object (or a list of objects) in the YARD registry
328
- using the `yard display OBJECT ...` command. For example, to display the
329
- `YARD::CodeObjects` module as text (the way it is displayed in `yri`), type:
330
-
331
- $ yard display YARD::CodeObjects
332
-
333
- You can also format individual objects as HTML. For example, you can format
334
- the above object as HTML and pipe the contents into a file readable by a
335
- web browser:
336
-
337
- $ yard display -f html YARD::CodeObjects > codeobjects.html
338
-
339
- Custom templating options from `yard doc` can also be used, see
340
- `yard display --help` for more options.
341
-
342
- ## Added `--layout` to `yard display` command (0.8.6.1)
343
-
344
- The `yard display` command now accepts `--layout` to wrap content in a layout
345
- template. Currently the `layout` and `onefile` layout templates are supported,
346
- though any template can be used. If no parameter is specified, the layout will
347
- default to the `layout` template. Example usage:
348
-
349
- $ yard display --layout onefile -f html YARD::CodeObjects > codeobjects.html
350
-
351
- The above generates a `codeobjects.html` file that is self-contained with
352
- CSS stylesheets and JavaScript code. This is similar to calling
353
- `yard doc --one-file` with only the YARD::CodeObjects object in the registry.
354
-
355
- Note that even though this uses the onefile template, the README file will not
356
- be auto-included the way it is with the `yard doc` command. To include the
357
- README text at the top of the onefile template, pass the --readme switch:
358
-
359
- $ yard display --layout onefile -f html --readme README.md OBJECT > out.html
360
-
361
- # What's New in 0.7.x?
362
-
363
- 1. **Macro support and detection of DSL methods** (0.7.0)
364
- 2. **Inherited attributes now show in HTML output** (0.7.0)
365
- 3. **The 'app' directory is now parsed by default** (0.7.0)
366
- 4. **Added support for metadata (@title, @markup) in extra files/readmes** (0.7.0)
367
- 5. **Added `yard list` command (alias for `yardoc --list`)** (0.7.0)
368
- 6. **Added Git support in `yard diff`** (0.7.0)
369
- 7. **Added `{include:file:FILENAME}` syntax** (0.7.0)
370
- 8. **Added `{render:OBJECT}` syntax to embed object docs in extra files** (0.7.0)
371
- 9. **Added improved templates API for custom CSS/JS/menus** (0.7.0)
372
- 10. **Added Ruby markup type (`-m ruby`)** (0.7.0)
373
- 11. **Added state tracking variables to Parser/Handler architecture** (0.7.0)
374
- 12. **Added before/after callbacks to SourceParser** (0.7.0)
375
- 13. **Can now use `--yardopts FILE` to specify a custom yardopts file** (0.7.0)
376
- 14. **Added new `-t guide` template for guide based docs** (0.7.0)
377
- 15. **Github Flavoured Markdown now works out-of-box** (0.7.4)
378
- 16. **Added `-m textile_strict` and `-m pre` markup types** (0.7.4)
379
- 17. **Reorganized markup types 'text' and 'none'** (0.7.4)
380
- 18. **Add support for `rb_define_alias`** (0.7.4)
381
-
382
- ## Macro support and detection of DSL methods (0.7.0)
383
-
384
- YARD will now automatically detect class level method calls, similar to the
385
- way it knows what an `attr_accessor` is. By simply adding documentation to
386
- your class level declarations, YARD can automatically detect them as methods
387
- or attributes in your class. Consider DataMapper's "property" declaration:
388
-
389
- class Post
390
- # @attribute
391
- # @return [String] the title of the post
392
- property :title, String
393
- end
394
-
395
- The above declaration would be created as the `Post#title`. The optional
396
- `@attribute` tag tells YARD that the property is an "attribute", and not just
397
- a regular method.
398
-
399
- In addition to basic DSL method detection, YARD also supports macros to create
400
- docstrings that can be copies to other objects; these macros can also be
401
- "attached" to class level methods to create implicit documentation for macros.
402
-
403
- Macros and DSL method detection are discussed in much more detail in the
404
- {file:docs/GettingStarted.md}, so you should read about them there if you're
405
- interested in this feature.
406
-
407
- ## Inherited attributes now show in HTML output (0.7.0)
408
-
409
- Inherited attributes will now show up in HTML documentation using the default
410
- template in the same manner that inherited methods do.
411
-
412
- ## The 'app' directory is now parsed by default (0.7.0)
413
-
414
- YARD tries to follow the "It Just Works" attitude in writing developer tools,
415
- and therefore has added `app/**/*.rb` to the default list of globs that it
416
- searches for code in. You no longer need to create a `.yardopts` just to
417
- list your app directory when documenting your code on rubydoc.info.
418
- We should have done this a while ago! And don't worry, YARD still checks
419
- lib and ext by default, too.
420
-
421
- ## Added support for metadata (@title, @markup) in extra files/readmes (0.7.0)
422
-
423
- Extra files (READMEs, ChangeLogs, LICENSE files, and other guides) now support
424
- metadata tags, just like docstrings in code comments. By adding @tag values
425
- to the top of a file (no whitespace preceding it) inside of a `# comment` line,
426
- YARD will detect and parse these tags and store it for later usage.
427
-
428
- Tags can contain arbitrary data as well as arbitrary tag names, however the
429
- tag names @title and @markup are reserved to specify the document title and
430
- markup format respectively. The title will be used in the file list menu,
431
- index page, as well as any linking of the file via the `{file:Filename}`
432
- syntax. An example of a document with metadata would be:
433
-
434
- # @title The Best Project Ever!
435
- # @markup rdoc
436
- # @author Foo Bar (custom tag, does not display in templates)
437
-
438
- = This Project Rules
439
-
440
- == Contents
441
-
442
- ...
443
-
444
- Note that previous versions of YARD recommended specifying the markup of an
445
- extra file with the `#!markup` shebang, but the `@markup` metadata tag is now
446
- the "best practice" for specifying the markup format of an extra file.
447
-
448
- ## Added `yard list` command (alias for `yardoc --list`) (0.7.0)
449
-
450
- The `yardoc --list` command is used to list objects that are parsed from
451
- a codebase. This can be used to grep methods/classes in a codebase from the
452
- command line. `yard list` now calls `yardoc --list` as a convenience command.
453
-
454
- Note that the `yardoc --list` command may eventually be replaced by a more
455
- feature-filled `yard list` command, so `yard list` should be used instead of
456
- `yardoc --list` when possible.
457
-
458
- ## Added Git support in `yard diff` (0.7.0)
459
-
460
- The `yard diff` command can now perform object diffing on git repositories.
461
- Provide the `--git` switch to `yard diff` with 2 commit/branches like so:
462
-
463
- $ yard diff --git HEAD~5 HEAD
464
- Added objects:
465
-
466
- YARD::Parser::SourceParser#contents
467
- YARD::Parser::SourceParser#globals
468
- ...
469
-
470
- ## Added `{include:file:FILENAME}` syntax (0.7.0)
471
-
472
- You can now use the `{include:file:FILENAME}` syntax to embed the contents
473
- of an extra file marked up in its markup format. This syntax supports embedding
474
- Ruby source files and performing syntax highlighting on the code.
475
-
476
- ## Added `{render:OBJECT}` syntax to embed object docs in extra files (0.7.0)
477
-
478
- You can now use the `{render:Object}` syntax to embed the documentation
479
- rendering of an entire object (method, class, module) inside of an extra file.
480
- This is useful when writing non-API based guides that might require listing
481
- a few helper methods or classes. The {file:docs/GettingStarted.md} discussed
482
- this syntax in more detail (with example usage).
483
-
484
- ## Added improved templates API for custom CSS/JS/menus (0.7.0)
485
-
486
- Plugin & template developers can now more easily insert custom stylesheet
487
- or JavaScript files in their customized templates, thanks to an abstraction
488
- of the template API. This is documented in the {docs/Templates.md} document.
489
- In addition to custom CSS/JS, developers can also create custom menu tabs
490
- in both the framed and non framed version of the default theme.
491
-
492
- ## Added Ruby markup type (`-m ruby`) (0.7.0)
493
-
494
- The Ruby markup type (`-m ruby`) will now use syntax highlighting for all
495
- formatting. This is probably not useful as a global switch, but can be used
496
- on individual extra files using the metadata markup specification discussed
497
- above.
498
-
499
- ## Added state tracking variables to Parser/Handler architecture (0.7.0)
500
-
501
- The parser and handler architecture now contain state variables
502
- {YARD::Handlers::Base#extra_state} and {YARD::Handlers::Processor#globals}
503
- to share data across handlers and the entire processing phase. `#extra_state`
504
- provided a place to store per-file data, while `#globals` gives the developer
505
- access to inter-file state when parsing multiple files at once.
506
-
507
- ## Added before/after callbacks to SourceParser (0.7.0)
508
-
509
- The {YARD::Parser::SourceParser} class can now register callbacks to execute
510
- code before and after parsing of file globs, as well as before and after
511
- parsing of individual files. This allows plugin developers to perform
512
- setup/teardown (and set global state or update the {YARD::Registry}).
513
-
514
- See the documentation for the following methods:
515
-
516
- * {YARD::Parser::SourceParser.before_parse_list}
517
- * {YARD::Parser::SourceParser.after_parse_list}
518
- * {YARD::Parser::SourceParser.before_parse_file}
519
- * {YARD::Parser::SourceParser.after_parse_file}
520
-
521
- ## Can now use `--yardopts FILE` to specify a custom yardopts file (0.7.0)
522
-
523
- The `yardoc` command now supports `--yardopts FILE` to specify custom .yardopts
524
- options files. This is useful if you have multiple documentation sets, such
525
- as a guide documentation set and an API documentation set.
526
-
527
- ## Added new `-t guide` template for guide based docs (0.7.0)
528
-
529
- You can now write guide style documentation using a new 'guide' template that
530
- only generates documentation for extra files. You would use it in the form:
531
-
532
- yardoc -t guide - README GettingStarted FAQ TroubleShooting LICENSE
533
-
534
- This creates the sections for the readme, a getting started, frequently asked
535
- questions, trouble shooting and license page.
536
-
537
- If you need to refer to class / method documentation, you can embed API documentation
538
- using the `{render:Object}` tag discussed above.
539
-
540
- ## Github Flavoured Markdown now works out-of-box (0.7.4)
541
-
542
- Due to the growing popularity of Github-Flavoured-Markdown (GFM), YARD now uses
543
- the Redcarpet library as the default Markdown formatting library with GFM fenced
544
- code blocks enabled. This means that you can use fenced code blocks inside of
545
- Markdown files with redcarpet installed without any extra code. Previously, users
546
- who wanted GFM in their Markdown would have to specify `-m markdown -M redcarpet`,
547
- but this is now the default behaviour for YARD.
548
-
549
- Note that you can still specify language types in code blocks without GFM in YARD
550
- by using the "!!!lang" prefix syntax. For example (plain means no markup):
551
-
552
- !!!plain
553
- !!!plain
554
- Some code
555
- block here.
556
-
557
- The GFM version would be:
558
-
559
- !!!plain
560
- ```plain
561
- Some code
562
- block here.
563
- ```
564
-
565
- ## Added `-m textile_strict` and `-m pre` markup types (0.7.4)
566
-
567
- A new "textile_strict" markup type was added which behaves exactly like "textile"
568
- except it enables hard breaks, so newlines behave as line breaks in the HTML
569
- (using `<br>` tags). This option is added for users who want the classic textile
570
- behaviour.
571
-
572
- ## Reorganized markup types 'text' and 'none' (0.7.4)
573
-
574
- Due to the new pre markup type, the behaviour for text and none were slightly
575
- reorganized to be more intuitive. The following behaviours now represent these
576
- markup types:
577
-
578
- * pre: Used to wrap text inside `<pre>` tags
579
- * text: No formatting except for hard breaks (`<br>`) on newlines
580
- * none: No formatting at all.
581
-
582
- In all cases, HTML is escaped from input. If you want no HTML escaping, use the
583
- html markup type.
584
-
585
- ## Add support for `rb_define_alias` (0.7.4)
586
-
587
- CRuby code can now make use of the `rb_define_alias` function. Documentation
588
- for aliases is not supported, however.
589
-
590
- # What's New in 0.6.x?
591
-
592
- 1. **Local documentation server for RubyGems or projects (`yard server`)** (0.6.0)
593
- 2. **Groups support for method listing** (0.6.0)
594
- 3. **Single file template (`--one-file`) support** (0.6.0)
595
- 4. **`yard` CLI executable with pluggable commands** (0.6.0)
596
- 5. **`yard diff` command to object-diff two versions of a project** (0.6.0)
597
- 6. **Added `--asset` option to `yardoc`** (0.6.0)
598
- 7. **New template API** (0.6.0)
599
- 8. **HTML template now adds inline Table of Contents for extra files pages** (0.6.0)
600
- 9. **Removed `--incremental` in favour of `--use-cache`** (0.6.0)
601
- 10. **Ad-hoc tag registration via `yardoc` CLI (`--tag`, etc.)** (0.6.0)
602
- 11. **Added `--transitive-tags` to register transitive tags** (0.6.0)
603
- 12. **`yardoc` now displays RDoc-like statistics (`--no-stats` to hide)** (0.6.0)
604
- 13. **`yri` now works on constants** (0.6.0)
605
- 14. **Plugins are no longer auto-loaded (added `--plugin` switch)** (0.6.2)
606
- 15. **Added `YARD::Config` API and `~/.yard/config` configuration file** (0.6.2)
607
- 16. **Added `yard config` command to view/edit configuration** (0.6.2)
608
- 17. **Added `yard server -t` template path switch** (0.6.2)
609
- 18. **Added `YARD::Server.register_static_path` for static server assets** (0.6.2)
610
- 19. **YARD::Registry is now thread local** (0.6.5)
611
- 20. **Support for ripper gem in Ruby 1.8.7** (0.6.5)
612
-
613
- ## Local documentation server for RubyGems or projects (`yard server`) (0.6.0)
614
-
615
- The new `yard server` command spawns a documentation server that can serve
616
- either documentation for a local project or installed RubyGems. The server
617
- will host (by default) on http://localhost:8808.
618
-
619
- To serve documentation for the active project (in the current directory):
620
-
621
- $ yard server
622
-
623
- The server can also run in "incremental" mode for local projects. In this
624
- situation, any modified sources will immediately be updated at each request,
625
- ensuring that the server always serve the code exactly as it is on disk.
626
- Documenting your code in this fashion essentially gives you an efficient a
627
- live preview without running a separate command everytime you make a change.
628
- To serve documentation for the active project in incremental mode:
629
-
630
- $ yard server --reload
631
-
632
- <span class="note">Note that in incremental mode, objects or method groupings
633
- cannot be removed. If you have removed objects or modified groupings, you
634
- will need to flush the cache by deleting `.yardoc` and (optionally)
635
- restarting the server.</span>
636
-
637
- The documentation server can also serve documentation for all installed gems
638
- on your system, similar to `gem server`, but using YARD's functionality and
639
- templates. To serve documentation for installed gems:
640
-
641
- $ yard server --gems
642
-
643
- <span class="note">Documentation for the gem need not be previously generated
644
- at install-time. If documentation for the gem has not been generated, YARD
645
- will do this for you on-the-fly. It is therefore possible to speed up your
646
- gem installs by using `gem install GEMNAME --no-rdoc` without repercussion.
647
- You can also add this switch to your `~/.gemrc` file so that you don't need
648
- to re-type it each time. See [this link](http://stackoverflow.com/questions/1789376/how-do-i-make-no-ri-no-rdoc-the-default-for-gem-install)
649
- for exact instructions.</span>
650
-
651
- ## Groups support for method listing (0.6.0)
652
-
653
- You can now organize methods in a class/module into logical separated groups.
654
- These groups apply lexically and are listed in the order they are defined.
655
- For instance, to define a group:
656
-
657
- # @group Rendering an Object
658
-
659
- # Documentation here
660
- def foo; end
661
-
662
- # Extra documentation...
663
- def bar; end
664
-
665
- # @group Another Group
666
-
667
- def aaa; end
668
-
669
- <span class="note">Note that these `@group` and `@endgroup` declarations are
670
- not "tags" and should always be separated with at least 1 line of whitespace
671
- from any other documentation or code.</span>
672
-
673
- In the above example, "Rendering an Object" will be listed with "foo" and
674
- "bar" above "Another Group", even though "aaa" comes before the two other
675
- methods, alphabetically. To end a group, use `@endgroup`. It is not necessary
676
- to end a group to start a new one, only if there is an object following the
677
- group that should not belong in any group.
678
-
679
- # @group Group 1
680
-
681
- def foo; end
682
-
683
- # @endgroup
684
-
685
- # This method should not be listed in any group
686
- def bar; end
687
-
688
- ## Single file template (`--one-file`) support (0.6.0)
689
-
690
- `yardoc` now has the `--one-file` option to generate a single-file template
691
- for small scripts and libraries. In this case, any comments at the top of
692
- the script file will be recognized as a README.
693
-
694
- ## `yard` CLI executable with pluggable commands (0.6.0)
695
-
696
- <span class="note">The `yardoc` and `yri` commands are not deprecated and can
697
- continue to be used. They are shortcuts for `yard doc` and `yard ri`
698
- respectively. However, `yard-graph` has been removed.</span>
699
-
700
- YARD now has a `yard` executable which combines all pre-existing and new
701
- commands into a single pluggable command that is both easier to remember and
702
- access. To get a list of commands, type `yard --help`.
703
-
704
- If you are a plugin developer, you can create your own `yard` command by first
705
- subclassing the {YARD::CLI::Command} class and then registering this class
706
- with the {YARD::CLI::CommandParser.commands} list. For instance:
707
-
708
- YARD::CLI::CommandParser.commands[:my_command] = MyCommandClass
709
-
710
- The above line will enable the user to execute `yard my_command [options]`.
711
-
712
- ## `yard diff` command to object-diff two versions of a project (0.6.0)
713
-
714
- One of the built-in commands that comes with the new `yard` executable is the
715
- ability to do object-oriented diffing across multiple versions of the same
716
- project, either by 2 versions of a gem, or 2 working copies. Just like
717
- regular diffing tells you which lines have been added/removed in a file,
718
- object diffing allows you to see what classes/methods/modules have been
719
- added/removed between versions of a codebase.
720
-
721
- For an overview of how to use `yard diff`, see [YARD Object Oriented Diffing](http://gnuu.org/2010/06/26/yard-object-oriented-diffing/).
722
-
723
- ## `yard stats` to display statistics and undocumented objects (0.6.0)
724
-
725
- YARD now outputs the following statistics when `yard stats` is run:
726
-
727
- Files: 125
728
- Modules: 35 ( 4 undocumented)
729
- Classes: 139 ( 29 undocumented)
730
- Constants: 53 ( 20 undocumented)
731
- Methods: 602 ( 70 undocumented)
732
- 85.16% documented
733
-
734
- Note that these statistics are based on what you have set to show in your
735
- documentation. If you use `@private` tags and/or do not display
736
- private/protected methods in your documentation, these will not show up as
737
- undocumented. Therefore this metric is contextual.
738
-
739
- You can also specifically list all undocumented objects (and their file
740
- locations) with the `--list-undoc` option.
741
-
742
- ## Added `--asset` option to `yardoc` (0.6.0)
743
-
744
- The `yardoc` command can now take the `--asset` option to copy over
745
- files/directories (recursively) to the output path after generating
746
- documentation. The format of the argument is "from:to" where from is the
747
- source path and to is the destination. For instance, YARD uses the following
748
- syntax in the `.yardopts` file to copy over image assets from the
749
- 'docs/images' directory into the 'images' directory after generating HTML:
750
-
751
- --asset docs/images:images
752
-
753
- ## New template API (0.6.0)
754
-
755
- The new template API allows for easier insertion of sections within an
756
- inherited template. You should no longer need to insert by index, an
757
- error-prone process that could break when a template is updated. Instead of:
758
-
759
- sections.last.place(:my_section).before(:another_section)
760
-
761
- use:
762
-
763
- sections.place(:my_section).before_any(:another_section)
764
-
765
- You can see more in the {file:docs/Templates.md#Inserting_and_Traversing_Sections}
766
- document.
767
-
768
- ## HTML template now adds inline Table of Contents for extra files pages (0.6.0)
769
-
770
- A table of contents is now generated dynamically using JavaScript for extra
771
- file pages (such as README's, or this document). It is generated based off the
772
- headers (h1,h2,... tags) used in the document, and can be floated to the
773
- right or listed inline on the page.
774
-
775
- ## Ad-hoc tag registration via `yardoc` CLI (`--tag`, etc.) (0.6.0)
776
-
777
- Simple meta-data tags can now be added at the command-line and registered to
778
- display in templates in a number of pre-defined ways. For instance, to create
779
- a freeform text tag, use the following:
780
-
781
- --tag my_tag_name:"My Tag Title"
782
-
783
- You can also create a "typed" tag (similar to `@return`), a typed named tag
784
- (similar to `@param`) as well as various combinations. The full list of
785
- options are listed in `yardoc --help` under the "Tag Options" section.
786
-
787
- If you wish to create a tag to store data but do not wish to show this data
788
- in the templates, use the `--hide-tag` option to hide it from generated output:
789
-
790
- --hide-tag my_tag_name
791
-
792
- ## Added `--transitive-tags` to register transitive tags (0.6.0)
793
-
794
- Transitive tags are tags that apply to all descendants of a namespace (class
795
- or module) when documented on that namespace. For instance, the `@since` tag
796
- is a transitive tag. Applying `@since` to a class will automatically apply
797
- `@since` to all methods in the class. Creating a `@since` tag directly on a
798
- method will override the inherited value.
799
-
800
- You can specify transitive tags on the command-line by using this option. Note
801
- that the tags must already exist (built-in or created with the `--tag` option)
802
- to be specified as transitive. If you wish to do this programmatically, see
803
- the {YARD::Tags::Library.transitive_tags} attribute.
804
-
805
- ## `yardoc` now displays RDoc-like statistics (`--no-stats` to hide) (0.6.0)
806
-
807
- As seen in the `yard stats` feature overview, `yardoc` displays RDoc-like
808
- statistics when it is run. The output is equivalent to typing `yard stats`.
809
- To hide this output when yardoc is run, use `--no-stats`.
810
-
811
- ## `yri` now works on constants (0.6.0)
812
-
813
- Templates have now been added for text view of constants, which displays any
814
- documentation and the constant value.
815
-
816
- ## Plugins are no longer auto-loaded (added `--plugin` switch) (0.6.2)
817
-
818
- This is a backwards-incompatible change that disables plugins from automatically
819
- loading when YARD starts up. From now on, you should manually declare which
820
- plugins your project is using by adding `--plugin PLUGINNAME` to a `.yardopts`
821
- file in the root of your project. You can also re-enable autoloaded plugins
822
- by setting `load_plugins` to true in your configuration file (`yard config load_plugins true`,
823
- see next item). You can also set `autoload_plugins` to a list of plugins
824
- to be automatically loaded on start.
825
-
826
- If you are a YARD plugin author, please make sure to inform your users of these
827
- changes.
828
-
829
- Note that `--plugin` switches passed on the commandline (not via `.yardopts`)
830
- are parsed before commands are loaded, and therefore can add in new CLI commands.
831
-
832
- ## Added `YARD::Config` API and `~/.yard/config` configuration file (0.6.2)
833
-
834
- There is a new global configuration API that can be accessed programmatically
835
- and set via the `~/.yard/config` file. The file is encoded as a YAML file,
836
- and looks like:
837
-
838
- :load_plugins: false
839
- :ignored_plugins:
840
- - my_plugin
841
- - my_other_plugin
842
- :autoload_plugins:
843
- - my_autoload_plugin
844
- :safe_mode: false
845
-
846
- You can also set configuration options via the command-line (see next item).
847
-
848
- ## Added `yard config` command to view/edit configuration (0.6.2)
849
-
850
- A new `yard config` command was created to view or edit the configuration
851
- file via the commandline.
852
-
853
- * To view the current configuration use `yard config --list`.
854
- * To view a specific item use `yard config ITEMNAME`
855
- * To modify an item value use `yard config ITEMNAME VALUE`
856
-
857
- ## Added `yard server -t` template path switch (0.6.2)
858
-
859
- The `yard server` command now accepts `-t` or `--template-path` to register
860
- a new template path for template customization.
861
-
862
- ## Added `YARD::Server.register_static_path` for static server assets (0.6.2)
863
-
864
- The server now supports a command to register static asset paths. If you are
865
- extending the YARD::Server modules, make sure to register your asset paths
866
- through this method.
867
-
868
- ## YARD::Registry is now thread local (0.6.5)
869
-
870
- Creating a new thread will now implicitly load a new Registry that can be used
871
- to parse and process new code objects independently of the other threads. Note
872
- that this means you can no longer use the Registry across threads; you must
873
- either access the threadlocal object directly, or synchronize threads to do
874
- the processing in the initial registry's thread.
875
-
876
- ## Support for ripper gem in Ruby 1.8.7 (0.6.5)
877
-
878
- YARD now supports the Ruby 1.8.7 port of the `ripper` gem to improve parsing
879
- of source, both in terms of performance and functionality. When the `ripper`
880
- gem is available, YARD will use the "new-style" handlers. You can take advantage
881
- of this functionality by performing a `gem install ripper`.
882
-
883
-
884
- What's New in 0.5.x?
885
- ====================
886
-
887
- 1. **Support for documenting native Ruby C code** (0.5.0)
888
- 2. **Incremental parsing and output generation with `yardoc -c`** (0.5.0, 0.5.3)
889
- 2. **Improved `yri` support to perform lookups on installed Gems** (0.5.0)
890
- 3. **Added `yardoc --default-return` and `yardoc --hide-void-return`** (0.5.0)
891
- 4. **Multiple syntax highlighting language support** (0.5.0)
892
- 5. **New .yardoc format** (0.5.0)
893
- 6. **Support for yard-doc-* gem packages as hosted .yardoc dbs** (0.5.1)
894
- 7. **Support for extra search paths in `yri`** (0.5.1)
895
- 8. **Generating HTML docs now adds frames view** (0.5.3)
896
- 9. **Tree view for class list** (0.5.3)
897
- 10. **Ability to specify markup format of extra files** (0.5.3)
898
- 11. **Keyboard shortcuts for default HTML template** (0.5.4)
899
-
900
- Support for documenting native Ruby C code (0.5.0)
901
- --------------------------------------------------
902
-
903
- It is now possible to document native Ruby extensions with YARD with a new
904
- C parser mostly borrowed from RDoc. This enables the ability to document
905
- Ruby's core and stdlibs which will be hosted on http://yardoc.org/docs. In
906
- addition, the .yardoc dump for the Ruby-core classes will become available
907
- as an installable gem for yri support (see #3).
908
-
909
- Incremental parsing and output generation with `yardoc -c` (0.5.0, 0.5.3)
910
- -------------------------------------------------------------------------
911
-
912
- <p class="note">Note: in 0.5.3 and above you must use <tt>--incremental</tt>
913
- to incrementally generate HTML, otherwise only parsing will be done
914
- incrementally but HTML will be generated with all objects. <tt>--incremental</tt>
915
- implies <tt>-c</tt>, so no need to specify them both.</p>
916
-
917
- YARD now compares file checksums before parsing when using `yardoc -c`
918
- (aka `yardoc --use-cache`) to do incremental parsing of only the files that
919
- have changed. HTML (or other output format) generation will also only be
920
- done on the objects that were parsed from changed files (\*). This makes doing
921
- a documentation development cycle much faster for quick HTML previews. Just
922
- remember that when using incremental output generation, the index will not
923
- be rebuilt and inter-file links might not hook up right, so it is best to
924
- perform a full rebuild at the end of such previews.
925
-
926
- (\*) Only for versions prior to 0.5.3. For 0.5.3+, use `--incremental` for
927
- incremental HTML output.
928
-
929
- Improved `yri` support to perform lookups on installed Gems (0.5.0)
930
- -------------------------------------------------------------------
931
-
932
- The `yri` executable can now perform lookups on gems that have been parsed
933
- by yard. Therefore, to use this command you must first parse all gems with
934
- YARD. To parse all gems, use the following command:
935
-
936
- $ sudo yardoc --build-gems
937
-
938
- The above command builds a .yardoc file for all installed gems in the
939
- respective gem directory. If you do not have write access to the gem path,
940
- YARD will write the yardoc file to `~/.yard/gem_index/NAME-VERSION.yardoc`.
941
-
942
- Note: you can also use `--re-build-gems` to force re-parsing of all gems.
943
-
944
- You can now do lookups with yri:
945
-
946
- $ yri JSON
947
-
948
- All lookups are cached to `~/.yard/yri_cache` for quicker lookups the second
949
- time onward.
950
-
951
- Added `yardoc --default-return` and `yardoc --hide-void-return` (0.5.0)
952
- -----------------------------------------------------------------------
953
-
954
- YARD defaults to displaying (Object) as the default return type of any
955
- method that has not declared a @return tag. To customize the default
956
- return type, you can specify:
957
-
958
- $ yardoc --default-return 'MyDefaultType'
959
-
960
- You can also use the empty string to list no return type.
961
-
962
- In addition, you can use --hide-void-return to ignore any method that
963
- defines itself as a void type by: `@return [void]`
964
-
965
- Multiple syntax highlighting language support (0.5.0)
966
- -----------------------------------------------------
967
-
968
- YARD now supports the ability to specify a language type for code blocks in
969
- docstrings. Although no actual highlighting support is added for any language
970
- but Ruby, you can add your own support by writing your own helper method:
971
-
972
- # Where LANGNAME is the language:
973
- def html_syntax_highlight_LANGNAME(source)
974
- # return highlighted HTML
975
- end
976
-
977
- To use this language in code blocks, prefix the block with `!!!LANGNAME`:
978
-
979
- !!!plain
980
- !!!python
981
- def python_code(self):
982
- return self
983
-
984
- By the same token. you can now use `!!!plain` to ignore highlighting for
985
- a specific code block.
986
-
987
- New .yardoc format (0.5.0)
988
- --------------------------
989
-
990
- To make the above yri support possible, the .yardoc format was redesigned
991
- to be a directory instead of a file. YARD can still load old .yardoc files,
992
- but they will be automatically upgraded if re-saved. The new .yardoc format
993
- does have a larger memory footprint, but this will hopefully be optimized
994
- downward.
995
-
996
- Support for yard-doc-* gem packages as hosted .yardoc dbs (0.5.1)
997
- -----------------------------------------------------------------
998
-
999
- You can now install special YARD plugin gems titled yard-doc-NAME to get
1000
- packaged a .yardoc database. This will enable yri lookups or building docs
1001
- for the gem without the code.
1002
-
1003
- One main use for this is the `yard-doc-core` package, which enabled yri
1004
- support for Ruby core classes (stdlib coming soon as `yard-doc-stdlib`).
1005
- To install it, simply:
1006
-
1007
- $ sudo gem install yard-doc-core
1008
- # now you can use:
1009
- $ yri String
1010
-
1011
- This will by default install the 1.9.1 core library. To install a library
1012
- for a specific version of Ruby, use the `--version` switch on gem:
1013
-
1014
- $ sudo gem install --version '= 1.8.6' yard-doc-core
1015
-
1016
- Support for extra search paths in `yri` (0.5.1)
1017
- -----------------------------------------------
1018
-
1019
- You can now add custom paths to non-gem .yardoc files
1020
- by adding them as newline separated paths in `~/.yard/yri_search_paths`.
1021
-
1022
- Generating HTML docs now adds frames view (0.5.3)
1023
- -------------------------------------------------
1024
-
1025
- `yardoc` will now create a `frames.html` file when generating HTML documents
1026
- which allows the user to view documentation inside frames, for those users who
1027
- still find frames beneficial.
1028
-
1029
- Tree view for class list (0.5.3)
1030
- --------------------------------
1031
-
1032
- The class list now displays as an expandable tree view to better organized an
1033
- otherwise cluttered namespace. If you properly namespace your less important
1034
- classes (like Rails timezone classes), they will not take up space in the
1035
- class list unless the user looks for them.
1036
-
1037
- Ability to specify markup format of extra files (0.5.3)
1038
- -------------------------------------------------------
1039
-
1040
- You can now specify the markup format of an extra file (like README) at the
1041
- top of the file with a shebang-like line:
1042
-
1043
- #!textile
1044
- contents here
1045
-
1046
- The above file contents will be rendered with a textile markup engine
1047
- (eg. RedCloth).
1048
-
1049
- Keyboard shortcuts for default HTML template (0.5.4)
1050
- ----------------------------------------------------
1051
-
1052
- You can now access the "Class List", "Method List" and "File List" with the
1053
- 'c', 'm' and 'f' keyboard shortcuts in the default HTML template, allowing
1054
- for keyboard-only navigation around YARD documentation.
1055
-
1056
- API for registering custom parsers (0.5.6)
1057
- ------------------------------------------
1058
-
1059
- You can now register parsers for custom source languages by calling the
1060
- following method:
1061
-
1062
- SourceParser.register_parser_type(:java, MyJavaParser, 'java')
1063
-
1064
- The parser class MyJavaParser should be a subclass of {YARD::Parser::Base},
1065
- and the last argument is a set of extensions (string, array or regexp). You
1066
- can read more about registering parsers at the {YARD::Parser::SourceParser}
1067
- class documentation.
1068
-
1069
-
1070
- What's New in 0.4.x?
1071
- ====================
1072
-
1073
- 1. **New templating engine and templates**
1074
- 2. **yardoc `--query` argument**
1075
- 3. **Greatly expanded API documentation**
1076
- 4. **New plugin support**
1077
- 5. **New tags (@abstract, @private)**
1078
- 6. **Default rake task is now `rake yard`**
1079
-
1080
- New templating engine and templates
1081
- -----------------------------------
1082
-
1083
- The templates were redesigned, most notably removing the ugly frameset, adding
1084
- search to the class/method lists, simplifying the layout and making things
1085
- generally prettier. You should also notice that more tags are now visible in
1086
- the templates such as @todo, the new @abstract and @note tags and some others
1087
- that existed but were previously omitted from the generated documentation.
1088
-
1089
- There is also a new templating engine (based on the tadpole templating library)
1090
- to allow for much more user customization. You can read about it in
1091
- {file:docs/Templates.md}.
1092
-
1093
- yardoc `--query` argument
1094
- -------------------------
1095
-
1096
- The yardoc command-line tool now supports queries to select which classes,
1097
- modules or methods to include in documentation based on their data or meta-data.
1098
- For instance, you can now generate documentation for your "public" API only by
1099
- adding "@api public" to each of your public API methods/classes and using
1100
- the following argument:
1101
-
1102
- --query '@api.text == "public"'
1103
-
1104
- More information on queries is in the {file:README.md}.
1105
-
1106
- Greatly expanded API documentation
1107
- ----------------------------------
1108
-
1109
- Last release focused on many how-to and architecture documents to explain
1110
- the design of YARD, but many of the actual API classes/methods were still
1111
- left undocumented. This release marks a focus on getting YARD's own documentation
1112
- up to par so that it can serve as an official reference on the recommended
1113
- conventions to use when documenting code.
1114
-
1115
- New plugin support
1116
- ------------------
1117
-
1118
- YARD now supports loading of plugins via RubyGems. Any gem named `yard-*` or
1119
- `yard_*` will now be loaded when YARD starts up. Note that the '-' separator
1120
- is the recommended naming scheme.
1121
-
1122
- To ignore plugins, add the gem names to `~/.yard/ignored_plugins` on separate
1123
- lines (or separated by whitespace).
1124
-
1125
- New tags (@abstract, @private)
1126
- ------------------------------
1127
-
1128
- Two new tags were added to the list of builtin meta-tags in YARD. `@abstract`
1129
- marks a class/module/method as abstract while `@private` marks an object
1130
- as "private". The latter tag is used in situations where an object is public
1131
- due to Ruby's own visibility limitations (constants, classes and modules
1132
- can never be private) but not actually part of your public API. You should
1133
- use this tag sparingly, as it is not meant to be an equivalent to RDoc's
1134
- `:nodoc:` tag. Remember, YARD recommends documenting private objects too.
1135
- This tag exists so that you can create a query (`--query !@private`) to
1136
- ignore all of these private objects in your documentation. You can also
1137
- use the new `--no-private` switch, which is a shortcut to the aforementioned
1138
- query. You can read more about the new tags in the {file:docs/GettingStarted.md}
1139
- guide.
1140
-
1141
- Default rake task is now `rake yard`
1142
- ------------------------------------
1143
-
1144
- Not a big change, but anyone using the default "rake yardoc" task should
1145
- update their scripts:
1146
-
1147
- [http://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0](http://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0)
1148
-
1149
-
1150
- What's New in 0.2.3.x?
1151
- ======================
1152
-
1153
- 1. **Full Ruby 1.9 support**
1154
- 2. **New parser code and handler API for 1.9**
1155
- 3. **A new `@overload` tag**
1156
- 4. **Better documentation**
1157
- 5. **Template changes and bug fixes**
1158
-
1159
- Full Ruby 1.9 support
1160
- ---------------------
1161
-
1162
- YARD's development actually focuses primarily on 1.9 from the get-go, so it is
1163
- not an afterthought. All features are first implemented for compatibility with
1164
- 1.9, but of course all functionality is also tested in 1.8.x. YARD 0.2.2 was
1165
- mostly compatible with 1.9, but the new release improves and extends in certain
1166
- areas where compatibility was lacking. The new release should be fully functional
1167
- in Ruby 1.9.
1168
-
1169
- New parser code and handler API for 1.9
1170
- ---------------------------------------
1171
-
1172
- Using Ruby 1.9 also gives YARD the advantage of using the new `ripper` library
1173
- which was added to stdlib. The ripper parser is Ruby's official answer to
1174
- projects like ParseTree and ruby2ruby. Ripper allows access to the AST as it
1175
- is parsed by the Ruby compiler. This has some large benefits over alternative
1176
- projects:
1177
-
1178
- 1. It is officially supported and maintained by the Ruby core team.
1179
- 2. The AST is generated directly from the exact same code that drives the
1180
- compiler, meaning anything that compiles is guaranteed to generate the
1181
- equivalent AST.
1182
- 3. It needs no hacks, gems or extra libs and works out of the box in 1.9.
1183
- 4. It's *fast*.
1184
-
1185
- Having the AST means that developers looking to extend YARD have much better
1186
- access to the parsed code than in previous versions. The only caveat is that
1187
- this library is not back-compatible to 1.8.x. Because of this, there are
1188
- subtle changes to the handler extension API that developers use to extend YARD.
1189
- Namely, there is now a standard API for 1.9 and a "legacy" API that can run in
1190
- both 1.8.x and 1.9 if needed. A developer can still use the legacy API to write
1191
- handlers that are compatible for both 1.8.x and 1.9 in one shot, or decide to
1192
- implement the handler using both APIs. Realize that the benefit of using the new
1193
- API means 1.9 users will get a 2.5x parsing speed increase over running the legacy
1194
- handlers (this is *in addition to* the ~1.8x speed increase of using YARV over MRI).
1195
-
1196
- A new `@overload` tag
1197
- ---------------------
1198
-
1199
- The new `@overload` tag enables users to document methods that take multiple
1200
- parameters depending on context. This is basically equivalent to RDoc's call-seq,
1201
- but with a name that is more akin to the OOP concept of method overloading
1202
- that is actually being employed. Here's an example:
1203
-
1204
- # @overload def to_html(html, autolink = true)
1205
- # This docstring describes the specific overload only.
1206
- # @param [String] html the HTML
1207
- # @param [Boolean] autolink whether or not to atuomatically link
1208
- # URL references
1209
- # @overload def to_html(html, opts = {})
1210
- # @param [String] html the HTML
1211
- # @param [Hash] opts any attributes to add to the root HTML node
1212
- def to_html(*args)
1213
- # split args depending on context
1214
- end
1215
-
1216
- As you can see each overload takes its own nested tags (including a docstring)
1217
- as if it were its own method. This allows "virtual" overloading behaviour at
1218
- the API level to make Ruby look like overload-aware languages without caring
1219
- about the implementation details required to add the behaviour.
1220
-
1221
- It is still recommended practice, however, to stay away from overloading when
1222
- possible and document the types of each method's real parameters. This allows
1223
- toolkits making use of YARD to get accurate type information for your methods,
1224
- for instance, allowing IDE autocompletion. There are, of course, situations
1225
- where overload just makes more sense.
1226
-
1227
- Better documentation
1228
- --------------------
1229
-
1230
- The first few iterations of YARD were very much a proof of concept. Few people
1231
- were paying attention and it was really just pieced together to see what was
1232
- feasible. Now that YARD is gaining interest, there are many developers that
1233
- want to take advantage of its extensibility support to do some really cool stuff.
1234
- Considerable time was spent for this release documenting, at a high level, what
1235
- YARD can do and how it can be done. Expect this documentation to be extended and
1236
- improved in future releases.
1237
-
1238
- Template changes and bug fixes
1239
- ------------------------------
1240
-
1241
- Of course no new release would be complete without fixing the old broken code.
1242
- Some tags existed but were not present in generated documentation. The templates
1243
- were mostly fixed to add the major omitted tags. In addition to template adjustments,
1244
- many parsing bugs were ironed out to make YARD much more stable with existing projects
1245
- (Rails, HAML, Sinatra, Ramaze, etc.).
1
+ # @title What's New?
2
+
3
+ # What's New in 0.8.x?
4
+
5
+ 1. **Directives (new behavioural tag syntax)** (0.8.0)
6
+ 2. **Added `--embed-mixin(s)` to embed mixins into class docs** (0.8.0)
7
+ 3. **Internationalization (I18n) support for translating docs** (0.8.0)
8
+ 4. **New C parser / handlers architecture** (0.8.0)
9
+ 5. **YARD will now warn if `@param` name not in method params** (0.8.0)
10
+ 6. **Added support for `module_function` calls in Ruby code** (0.8.0)
11
+ 7. **Greatly improved tag documentation using custom template** (0.8.0)
12
+ 8. **Tags can now contain '.' for namespacing** (0.8.0)
13
+ 9. **Added "frames" links for non-framed pages for better nav** (0.8.0)
14
+ 10. **Added Gemfile support to YARD server for local gem sets** (0.8.0)
15
+ 11. **Server now displays README on index route like static docs** (0.8.0)
16
+ 12. **Added line numbers to `yard stats --list-undoc --compact`** (0.8.0)
17
+ 13. **Single object db now default (multi-object db unsupported)** (0.8.0)
18
+ 14. **Added `--api` tag to generate documentation for API sets** (0.8.1)
19
+ 15. **Added `--non-transitive-tag` to disable transitive tag** (0.8.3)
20
+ 16. **Added `-B/--bind` to bind to a port in yard server** (0.8.4)
21
+ 17. **Added `asciidoc` markup type support** (0.8.6)
22
+ 18. **Added `yard markups` command to list available markup types** (0.8.6)
23
+ 19. **Added `yard display` command to display formatted objects** (0.8.6)
24
+ 20. **Added `--layout` to `yard display` command** (0.8.6.1)
25
+ 21. **Added `stats_options` for the rake task** (0.8.7.6)
26
+
27
+ ## Directives (new behavioural tag syntax) (0.8.0)
28
+
29
+ <p class="note">
30
+ The tags {tag:!macro}, {tag:!method}, {tag:!attribute}, {tag:!group},
31
+ {tag:!endgroup}, {tag:!scope} and {tag:!visibility} have been changed
32
+ from meta-data tags to directives. This means they should now be called
33
+ with the "@!" prefix instead of "@". Note however that for <strong>
34
+ backward compatibility</strong>, the old "@macro", "@method", etc.,
35
+ syntax for all of these tags will still work and is supported.
36
+ </p>
37
+
38
+ <p class="note">
39
+ Some <strong>backwards incompatible</strong> changes were made to {tag:!macro} syntax.
40
+ Please read this section carefully if you are using this tag.
41
+ </p>
42
+
43
+ YARD 0.8.0 adds a new tag syntax called "directives" using the `@!`
44
+ prefix. These directive tags can be used to modify parser state while
45
+ processing objects, or even create new objects on the fly. A plugin
46
+ API is available similar to tags, and directives should be registered
47
+ in the {YARD::Tags::Library} class using {YARD::Tags::Library.define_directive}.
48
+
49
+ To use a directive, simply call it the same way as any tag. Tag syntax
50
+ is documented in {file:docs/Tags.md}.
51
+
52
+ ### Notable features of directives
53
+
54
+ #### Directives do not need to be attached to object docstrings
55
+
56
+ Unlike meta-data tags which apply to created objects, directives
57
+ do not need to be attached to an object in order to be used. This
58
+ means you can have free-standing comments with directives, such as:
59
+
60
+ # @macro mymacro
61
+ # A new macro, not attached to any docstring
62
+
63
+ # ...other Ruby code here...
64
+
65
+ # Using the macro:
66
+ # @macro mymacro
67
+ def mymethod; end
68
+
69
+ You can do the same to define methods and attributes, as discussed
70
+ below.
71
+
72
+ #### `@!method` and `@!attribute` directives improved
73
+
74
+ The method and attribute directives can now be used to create multiple
75
+ objects in a single docstring. Previously a `@method` or `@attribute`
76
+ tag would only create one method per docstring. In 0.8.0, you could
77
+ attach multiple methods to the same block of Ruby source, such as:
78
+
79
+ # @!method foo(a, b, c)
80
+ # @!method bar(x, y, z)
81
+ # Docstring for code
82
+ some_ruby_source
83
+
84
+ The above creates #foo and #bar and the source listing for both will
85
+ be `some_ruby_source` with "Docstring for code" as the docstring.
86
+
87
+ The attribute directive can take advantage of this functionality as well.
88
+ Note that these directives also do not need to be attached to a line of
89
+ code to be recognized; they can be in free-standing comments if the
90
+ methods are defined dynamically and not associated with any code.
91
+
92
+ #### New `@!parse` directive to parse Ruby code
93
+
94
+ A new {tag:!parse} directive was added that allows a developer to have
95
+ YARD parse code that might not necessarily be parseable in its original
96
+ form. This is useful when using `instance_eval` and other dynamic
97
+ meta-programming techniques to define methods or perform functionality.
98
+ For instance, a common case of the "self.included" callback in module
99
+ to extend a module on a class might be in the form:
100
+
101
+ def self.included(mod)
102
+ mod.extend(self)
103
+ end
104
+
105
+ Unfortunately, this does not get picked up by YARD, but on the original
106
+ class, we can add:
107
+
108
+ class MyClass
109
+ # @!parse extend TheDynamicModule
110
+ include TheDynamicModule
111
+ end
112
+
113
+ YARD will then parse the code `extend TheDynamicModule` as if
114
+ it were in the source file.
115
+
116
+ You can also use this technique to register regular methods as
117
+ attributes, if you did not define them with `attr_*` methods:
118
+
119
+ def foo; @foo end
120
+ def foo=(v) @foo = v end
121
+
122
+ # Register them as methods:
123
+ # @!parse attr_accessor :foo
124
+
125
+ ### Backward incompatible changes to `@!macro` directive
126
+
127
+ Unfortunately, in order to create the new directives architecture,
128
+ some previously supported syntax in `@macro` tags are no longer supported.
129
+ Specifically, macros can no longer expand text on an entire docstring.
130
+ Instead, macros only expand the data that is indented inside of the tag
131
+ text.
132
+
133
+ This syntax is **no longer supported**:
134
+
135
+ # @macro mymacro
136
+ # Expanding text $1 $2 $3
137
+ property :a, :b, :c
138
+
139
+ In 0.7.0 to 0.7.5, the above would have created a method with the docstring
140
+ "Expanding text a b c". This will not work in 0.8.0. Instead, you must
141
+ indent all the macro expansion data so that it is part of the `@macro`
142
+ tag as follows:
143
+
144
+ # @!macro mymacro
145
+ # Expanding text $1 $2 $3
146
+ property :a, :b, :c
147
+
148
+ Note that we also use the recommended `@!macro` syntax, though `@macro`
149
+ is still supported.
150
+
151
+ ## Added `--embed-mixin(s)` to embed mixins into class docs (0.8.0)
152
+
153
+ Methods from mixins can now be embedded directly into the documentation
154
+ output for a class by using `--embed-mixin ModuleName`, or `--embed-mixins`
155
+ for all mixins. This enables a documentation writer to refactor methods
156
+ into modules without worrying about them showing up in separate files
157
+ in generated documentation. When mixin methods are embedded, they
158
+ show up in both the original module page and the pages of the classes
159
+ they are mixed into. A note is added to the method signature telling the
160
+ user where the method comes from.
161
+
162
+ The `--embed-mixin` command-line option can also take wildcard values
163
+ in order to match specific namespaces. For instance, you can embed
164
+ only mixins inside of a "Foo::Bar" namespace by doing:
165
+
166
+ !!!sh
167
+ $ yard doc --embed-mixin "Foo::Bar::*"
168
+
169
+ ## Internationalization (I18n) support for translating docs
170
+
171
+ YARD now ships with the beginnings of internationalization support
172
+ for translating documentation into multiple languages. The
173
+ `yard i18n` command now allows you to generate ".pot" and ultimately
174
+ ".po" files for translation with [gettext](http://www.gnu.org/software/gettext).
175
+
176
+ Note that this tool is a small step in the larger transition for
177
+ proper I18n support in YARD. We still have to add proper gettext
178
+ support to our templates for proper generation in multiple languages,
179
+ but this tool allows you to get started in translating your
180
+ documents. Improved I18n support will come throughout the 0.8.x series.
181
+
182
+ ## New C parser / handlers architecture (0.8.0)
183
+
184
+ The C parser was completely rewritten to take advantage of YARD's
185
+ parser and handler architecture. This means more YARD will be more robust
186
+ when parsing failures occur, tags and directives will now work consistently
187
+ across Ruby and CRuby files ({tag:!group} will now work, for instance),
188
+ and developers can now write custom handlers that target CRuby source files.
189
+
190
+ ## YARD will now warn if `@param` name not in method params (0.8.0)
191
+
192
+ YARD will now give you a warning if you use a `@param` tag in your
193
+ source but give an invalid parameter name. This should catch a lot of
194
+ common documentation errors and help keep your documentation consistent.
195
+
196
+ ## Added support for `module_function` calls in Ruby code (0.8.0)
197
+
198
+ The `module_function` command in Ruby is now supported in Ruby files.
199
+ It defines two separate methods, one class and one instance method,
200
+ both having the exact same docstring, and marks the instance method
201
+ as private.
202
+
203
+ ## Greatly improved tag documentation using custom template (0.8.0)
204
+
205
+ We have completely revamped the {docs/Tags.md} to include documentation
206
+ for each meta-data tag and directive with at least one useful example
207
+ for each one. This was done using template customization and extension
208
+ available within YARD.
209
+
210
+ ## Tags can now contain '.' for namespacing (0.8.0)
211
+
212
+ Prior to 0.8.0, tags could only contain alphanumeric characters and
213
+ underscore. YARD now allows the '.' character in tag names, and it
214
+ is now recommended for namespacing project-specific custom tags.
215
+ YARD has its own set of custom tags that are namespaced in this
216
+ way (using the "yard.tagname" namespace). The namespace recommendation
217
+ is to use "projectname.tagname", or "projectname.component.tagname".
218
+
219
+ ## Added "frames" links for non-framed pages for better nav (0.8.0)
220
+
221
+ Frames navigation has always had a "(no frames)" link to get rid
222
+ of the frameset. YARD 0.8.0 introduces a "(frames)" link on non-framed
223
+ pages to reverse this, allowing you to navigate between framed and
224
+ frameless pages seamlessly.
225
+
226
+ ## Added Gemfile support to YARD server for local gem sets (0.8.0)
227
+
228
+ The `yard server` command now supports `--gemfile` to serve gems
229
+ from a Gemfile.lock, instead of all system-wide gems.
230
+
231
+ ## Server now displays README on index route like static docs (0.8.0)
232
+
233
+ The `yard server` command will now behave like static docs regarding
234
+ the index action for a project, listing the README file if present
235
+ before displaying the alphabetic index. Note that the route for
236
+ the alphabetic index page has now moved to the explicit '/index' action.
237
+
238
+ ## Added line numbers to `yard stats --list-undoc --compact` (0.8.0)
239
+
240
+ Line numbers are now listed in the compact listing of undocumented objects
241
+ so that they can be more easily located in the files.
242
+
243
+ ## Single object db now default (multi-object db unsupported) (0.8.0)
244
+
245
+ YARD previously would split the .yardoc db into multiple marshal files
246
+ for load-time performance reasons if it grew past a specific number of
247
+ objects. This check is now disabled, and YARD will never automatically
248
+ switch to a multi-object DB. YARD will now always use the single object
249
+ db unless explicitly set with `--no-single-db`. If YARD is taking a
250
+ long time to load your .yardoc database, you can try using this
251
+ option to split your database into multiple files, but note that this
252
+ can cause problems with certain codebases (specifically, if you
253
+ have class methods using the same name as a module/class).
254
+
255
+ ## Added `--api` tag to generate documentation for API sets (0.8.1)
256
+
257
+ You can now use `yardoc --api APINAME` to generate documentation only
258
+ for objects with the `@api APINAME` tag (or any parent namespace objects,
259
+ since this tag is transitive). Multiple `--api` switches may be used to
260
+ generate documentation for multiple APIs together. The following generates
261
+ documentation for both the "public" and "developer" APIs, also including
262
+ any objects with undefined API (via `--no-api`):
263
+
264
+ $ yard doc --api public --api developer --no-api
265
+
266
+ Note that if you use `--api`, you must ensure that you also add `@api`
267
+ tags to your namespace objects (modules and classes), not just your methods.
268
+ If you do not want to do this, you can also include all objects with *no*
269
+ `@api` tag by using `--no-api` as shown above.
270
+
271
+ Remember that applying an `@api` tag to a class or module will apply it
272
+ to all children that do not have this tag already defined, so you can
273
+ declare an entire class public by applying it to the class itself. Note
274
+ also that these tags can be overridden by child elements if the tag is
275
+ re-applied to the individual object.
276
+
277
+ This feature is a simplified version of the more powerful `--query`
278
+ switch. The query to display the same API documentation as the
279
+ above example would be:
280
+
281
+ $ yard doc --query '!@api || @api.text =~ /^(public|private)$/'
282
+
283
+ But note that `--query` does not work when YARD is in "safe mode"
284
+ due to security concerns, whereas `--api` works in either mode.
285
+ This enables `--api` to function on remote documentation sites like
286
+ [rubydoc.info](http://rubydoc.info).
287
+
288
+ ## Added `--non-transitive-tag` to disable transitive tag (0.8.3)
289
+
290
+ You can now use `--non-transitive-tag` to disable transitivity on
291
+ tags that are defined as transitive by default. For instance, in
292
+ some cases you might not want the @api tag to apply to all methods
293
+ when you define it on a class. Only the class itself has a specific
294
+ @api tag. To do this, you can mark @api as non-transitive with:
295
+
296
+ $ yard doc --non-transitive-tag api --api some_api
297
+
298
+ Which will avoid classifying treating @api as a transitive tag
299
+ when parsing modules and classes.
300
+
301
+ ## Added `-B/--bind` to bind to a port in yard server (0.8.4)
302
+
303
+ You can now bind the `yard server` command to a given local port
304
+ with `yard server -B PORT` or `yard server --bind PORT`.
305
+
306
+ ## Added `asciidoc` markup type support (0.8.6)
307
+
308
+ Support for the AsciiDoc markup type is now introduced using the `asciidoc`
309
+ markup type (`yard doc -m asciidoc`). Requires the
310
+ [asciidoctor](http://rubygems.org/gems/asciidoctor) RubyGem library to be
311
+ installed before running YARD.
312
+
313
+ ## Added `yard markups` command to list available markup types (0.8.6)
314
+
315
+ You can now list all available markup types and their respective providers by
316
+ typing `yard markups`. This list also includes the file extensions used to
317
+ auto-identify markup types for extra files and READMEs. To use a markup in
318
+ the list, call `yard doc` with `-m MARKUP_TYPE`. To select a specific markup
319
+ provider library, pass the `-M PROVIDER_NAME` option.
320
+
321
+ ## Added `yard display` command to display formatted objects (0.8.6)
322
+
323
+ <p class="note">This feature requires the .yardoc registry to have already been
324
+ generated. To generate the registry, run <code>yard doc -n</code>.
325
+ </p>
326
+
327
+ You can now display a single object (or a list of objects) in the YARD registry
328
+ using the `yard display OBJECT ...` command. For example, to display the
329
+ `YARD::CodeObjects` module as text (the way it is displayed in `yri`), type:
330
+
331
+ $ yard display YARD::CodeObjects
332
+
333
+ You can also format individual objects as HTML. For example, you can format
334
+ the above object as HTML and pipe the contents into a file readable by a
335
+ web browser:
336
+
337
+ $ yard display -f html YARD::CodeObjects > codeobjects.html
338
+
339
+ Custom templating options from `yard doc` can also be used, see
340
+ `yard display --help` for more options.
341
+
342
+ ## Added `--layout` to `yard display` command (0.8.6.1)
343
+
344
+ The `yard display` command now accepts `--layout` to wrap content in a layout
345
+ template. Currently the `layout` and `onefile` layout templates are supported,
346
+ though any template can be used. If no parameter is specified, the layout will
347
+ default to the `layout` template. Example usage:
348
+
349
+ $ yard display --layout onefile -f html YARD::CodeObjects > codeobjects.html
350
+
351
+ The above generates a `codeobjects.html` file that is self-contained with
352
+ CSS stylesheets and JavaScript code. This is similar to calling
353
+ `yard doc --one-file` with only the YARD::CodeObjects object in the registry.
354
+
355
+ Note that even though this uses the onefile template, the README file will not
356
+ be auto-included the way it is with the `yard doc` command. To include the
357
+ README text at the top of the onefile template, pass the --readme switch:
358
+
359
+ $ yard display --layout onefile -f html --readme README.md OBJECT > out.html
360
+
361
+ # What's New in 0.7.x?
362
+
363
+ 1. **Macro support and detection of DSL methods** (0.7.0)
364
+ 2. **Inherited attributes now show in HTML output** (0.7.0)
365
+ 3. **The 'app' directory is now parsed by default** (0.7.0)
366
+ 4. **Added support for metadata (@title, @markup) in extra files/readmes** (0.7.0)
367
+ 5. **Added `yard list` command (alias for `yardoc --list`)** (0.7.0)
368
+ 6. **Added Git support in `yard diff`** (0.7.0)
369
+ 7. **Added `{include:file:FILENAME}` syntax** (0.7.0)
370
+ 8. **Added `{render:OBJECT}` syntax to embed object docs in extra files** (0.7.0)
371
+ 9. **Added improved templates API for custom CSS/JS/menus** (0.7.0)
372
+ 10. **Added Ruby markup type (`-m ruby`)** (0.7.0)
373
+ 11. **Added state tracking variables to Parser/Handler architecture** (0.7.0)
374
+ 12. **Added before/after callbacks to SourceParser** (0.7.0)
375
+ 13. **Can now use `--yardopts FILE` to specify a custom yardopts file** (0.7.0)
376
+ 14. **Added new `-t guide` template for guide based docs** (0.7.0)
377
+ 15. **Github Flavoured Markdown now works out-of-box** (0.7.4)
378
+ 16. **Added `-m textile_strict` and `-m pre` markup types** (0.7.4)
379
+ 17. **Reorganized markup types 'text' and 'none'** (0.7.4)
380
+ 18. **Add support for `rb_define_alias`** (0.7.4)
381
+
382
+ ## Macro support and detection of DSL methods (0.7.0)
383
+
384
+ YARD will now automatically detect class level method calls, similar to the
385
+ way it knows what an `attr_accessor` is. By simply adding documentation to
386
+ your class level declarations, YARD can automatically detect them as methods
387
+ or attributes in your class. Consider DataMapper's "property" declaration:
388
+
389
+ class Post
390
+ # @attribute
391
+ # @return [String] the title of the post
392
+ property :title, String
393
+ end
394
+
395
+ The above declaration would be created as the `Post#title`. The optional
396
+ `@attribute` tag tells YARD that the property is an "attribute", and not just
397
+ a regular method.
398
+
399
+ In addition to basic DSL method detection, YARD also supports macros to create
400
+ docstrings that can be copies to other objects; these macros can also be
401
+ "attached" to class level methods to create implicit documentation for macros.
402
+
403
+ Macros and DSL method detection are discussed in much more detail in the
404
+ {file:docs/GettingStarted.md}, so you should read about them there if you're
405
+ interested in this feature.
406
+
407
+ ## Inherited attributes now show in HTML output (0.7.0)
408
+
409
+ Inherited attributes will now show up in HTML documentation using the default
410
+ template in the same manner that inherited methods do.
411
+
412
+ ## The 'app' directory is now parsed by default (0.7.0)
413
+
414
+ YARD tries to follow the "It Just Works" attitude in writing developer tools,
415
+ and therefore has added `app/**/*.rb` to the default list of globs that it
416
+ searches for code in. You no longer need to create a `.yardopts` just to
417
+ list your app directory when documenting your code on rubydoc.info.
418
+ We should have done this a while ago! And don't worry, YARD still checks
419
+ lib and ext by default, too.
420
+
421
+ ## Added support for metadata (@title, @markup) in extra files/readmes (0.7.0)
422
+
423
+ Extra files (READMEs, ChangeLogs, LICENSE files, and other guides) now support
424
+ metadata tags, just like docstrings in code comments. By adding @tag values
425
+ to the top of a file (no whitespace preceding it) inside of a `# comment` line,
426
+ YARD will detect and parse these tags and store it for later usage.
427
+
428
+ Tags can contain arbitrary data as well as arbitrary tag names, however the
429
+ tag names @title and @markup are reserved to specify the document title and
430
+ markup format respectively. The title will be used in the file list menu,
431
+ index page, as well as any linking of the file via the `{file:Filename}`
432
+ syntax. An example of a document with metadata would be:
433
+
434
+ # @title The Best Project Ever!
435
+ # @markup rdoc
436
+ # @author Foo Bar (custom tag, does not display in templates)
437
+
438
+ = This Project Rules
439
+
440
+ == Contents
441
+
442
+ ...
443
+
444
+ Note that previous versions of YARD recommended specifying the markup of an
445
+ extra file with the `#!markup` shebang, but the `@markup` metadata tag is now
446
+ the "best practice" for specifying the markup format of an extra file.
447
+
448
+ ## Added `yard list` command (alias for `yardoc --list`) (0.7.0)
449
+
450
+ The `yardoc --list` command is used to list objects that are parsed from
451
+ a codebase. This can be used to grep methods/classes in a codebase from the
452
+ command line. `yard list` now calls `yardoc --list` as a convenience command.
453
+
454
+ Note that the `yardoc --list` command may eventually be replaced by a more
455
+ feature-filled `yard list` command, so `yard list` should be used instead of
456
+ `yardoc --list` when possible.
457
+
458
+ ## Added Git support in `yard diff` (0.7.0)
459
+
460
+ The `yard diff` command can now perform object diffing on git repositories.
461
+ Provide the `--git` switch to `yard diff` with 2 commit/branches like so:
462
+
463
+ $ yard diff --git HEAD~5 HEAD
464
+ Added objects:
465
+
466
+ YARD::Parser::SourceParser#contents
467
+ YARD::Parser::SourceParser#globals
468
+ ...
469
+
470
+ ## Added `{include:file:FILENAME}` syntax (0.7.0)
471
+
472
+ You can now use the `{include:file:FILENAME}` syntax to embed the contents
473
+ of an extra file marked up in its markup format. This syntax supports embedding
474
+ Ruby source files and performing syntax highlighting on the code.
475
+
476
+ ## Added `{render:OBJECT}` syntax to embed object docs in extra files (0.7.0)
477
+
478
+ You can now use the `{render:Object}` syntax to embed the documentation
479
+ rendering of an entire object (method, class, module) inside of an extra file.
480
+ This is useful when writing non-API based guides that might require listing
481
+ a few helper methods or classes. The {file:docs/GettingStarted.md} discussed
482
+ this syntax in more detail (with example usage).
483
+
484
+ ## Added improved templates API for custom CSS/JS/menus (0.7.0)
485
+
486
+ Plugin & template developers can now more easily insert custom stylesheet
487
+ or JavaScript files in their customized templates, thanks to an abstraction
488
+ of the template API. This is documented in the {docs/Templates.md} document.
489
+ In addition to custom CSS/JS, developers can also create custom menu tabs
490
+ in both the framed and non framed version of the default theme.
491
+
492
+ ## Added Ruby markup type (`-m ruby`) (0.7.0)
493
+
494
+ The Ruby markup type (`-m ruby`) will now use syntax highlighting for all
495
+ formatting. This is probably not useful as a global switch, but can be used
496
+ on individual extra files using the metadata markup specification discussed
497
+ above.
498
+
499
+ ## Added state tracking variables to Parser/Handler architecture (0.7.0)
500
+
501
+ The parser and handler architecture now contain state variables
502
+ {YARD::Handlers::Base#extra_state} and {YARD::Handlers::Processor#globals}
503
+ to share data across handlers and the entire processing phase. `#extra_state`
504
+ provided a place to store per-file data, while `#globals` gives the developer
505
+ access to inter-file state when parsing multiple files at once.
506
+
507
+ ## Added before/after callbacks to SourceParser (0.7.0)
508
+
509
+ The {YARD::Parser::SourceParser} class can now register callbacks to execute
510
+ code before and after parsing of file globs, as well as before and after
511
+ parsing of individual files. This allows plugin developers to perform
512
+ setup/teardown (and set global state or update the {YARD::Registry}).
513
+
514
+ See the documentation for the following methods:
515
+
516
+ * {YARD::Parser::SourceParser.before_parse_list}
517
+ * {YARD::Parser::SourceParser.after_parse_list}
518
+ * {YARD::Parser::SourceParser.before_parse_file}
519
+ * {YARD::Parser::SourceParser.after_parse_file}
520
+
521
+ ## Can now use `--yardopts FILE` to specify a custom yardopts file (0.7.0)
522
+
523
+ The `yardoc` command now supports `--yardopts FILE` to specify custom .yardopts
524
+ options files. This is useful if you have multiple documentation sets, such
525
+ as a guide documentation set and an API documentation set.
526
+
527
+ ## Added new `-t guide` template for guide based docs (0.7.0)
528
+
529
+ You can now write guide style documentation using a new 'guide' template that
530
+ only generates documentation for extra files. You would use it in the form:
531
+
532
+ yardoc -t guide - README GettingStarted FAQ TroubleShooting LICENSE
533
+
534
+ This creates the sections for the readme, a getting started, frequently asked
535
+ questions, trouble shooting and license page.
536
+
537
+ If you need to refer to class / method documentation, you can embed API documentation
538
+ using the `{render:Object}` tag discussed above.
539
+
540
+ ## Github Flavoured Markdown now works out-of-box (0.7.4)
541
+
542
+ Due to the growing popularity of Github-Flavoured-Markdown (GFM), YARD now uses
543
+ the Redcarpet library as the default Markdown formatting library with GFM fenced
544
+ code blocks enabled. This means that you can use fenced code blocks inside of
545
+ Markdown files with redcarpet installed without any extra code. Previously, users
546
+ who wanted GFM in their Markdown would have to specify `-m markdown -M redcarpet`,
547
+ but this is now the default behaviour for YARD.
548
+
549
+ Note that you can still specify language types in code blocks without GFM in YARD
550
+ by using the "!!!lang" prefix syntax. For example (plain means no markup):
551
+
552
+ !!!plain
553
+ !!!plain
554
+ Some code
555
+ block here.
556
+
557
+ The GFM version would be:
558
+
559
+ !!!plain
560
+ ```plain
561
+ Some code
562
+ block here.
563
+ ```
564
+
565
+ ## Added `-m textile_strict` and `-m pre` markup types (0.7.4)
566
+
567
+ A new "textile_strict" markup type was added which behaves exactly like "textile"
568
+ except it enables hard breaks, so newlines behave as line breaks in the HTML
569
+ (using `<br>` tags). This option is added for users who want the classic textile
570
+ behaviour.
571
+
572
+ ## Reorganized markup types 'text' and 'none' (0.7.4)
573
+
574
+ Due to the new pre markup type, the behaviour for text and none were slightly
575
+ reorganized to be more intuitive. The following behaviours now represent these
576
+ markup types:
577
+
578
+ * pre: Used to wrap text inside `<pre>` tags
579
+ * text: No formatting except for hard breaks (`<br>`) on newlines
580
+ * none: No formatting at all.
581
+
582
+ In all cases, HTML is escaped from input. If you want no HTML escaping, use the
583
+ html markup type.
584
+
585
+ ## Add support for `rb_define_alias` (0.7.4)
586
+
587
+ CRuby code can now make use of the `rb_define_alias` function. Documentation
588
+ for aliases is not supported, however.
589
+
590
+ # What's New in 0.6.x?
591
+
592
+ 1. **Local documentation server for RubyGems or projects (`yard server`)** (0.6.0)
593
+ 2. **Groups support for method listing** (0.6.0)
594
+ 3. **Single file template (`--one-file`) support** (0.6.0)
595
+ 4. **`yard` CLI executable with pluggable commands** (0.6.0)
596
+ 5. **`yard diff` command to object-diff two versions of a project** (0.6.0)
597
+ 6. **Added `--asset` option to `yardoc`** (0.6.0)
598
+ 7. **New template API** (0.6.0)
599
+ 8. **HTML template now adds inline Table of Contents for extra files pages** (0.6.0)
600
+ 9. **Removed `--incremental` in favour of `--use-cache`** (0.6.0)
601
+ 10. **Ad-hoc tag registration via `yardoc` CLI (`--tag`, etc.)** (0.6.0)
602
+ 11. **Added `--transitive-tags` to register transitive tags** (0.6.0)
603
+ 12. **`yardoc` now displays RDoc-like statistics (`--no-stats` to hide)** (0.6.0)
604
+ 13. **`yri` now works on constants** (0.6.0)
605
+ 14. **Plugins are no longer auto-loaded (added `--plugin` switch)** (0.6.2)
606
+ 15. **Added `YARD::Config` API and `~/.yard/config` configuration file** (0.6.2)
607
+ 16. **Added `yard config` command to view/edit configuration** (0.6.2)
608
+ 17. **Added `yard server -t` template path switch** (0.6.2)
609
+ 18. **Added `YARD::Server.register_static_path` for static server assets** (0.6.2)
610
+ 19. **YARD::Registry is now thread local** (0.6.5)
611
+ 20. **Support for ripper gem in Ruby 1.8.7** (0.6.5)
612
+
613
+ ## Local documentation server for RubyGems or projects (`yard server`) (0.6.0)
614
+
615
+ The new `yard server` command spawns a documentation server that can serve
616
+ either documentation for a local project or installed RubyGems. The server
617
+ will host (by default) on http://localhost:8808.
618
+
619
+ To serve documentation for the active project (in the current directory):
620
+
621
+ $ yard server
622
+
623
+ The server can also run in "incremental" mode for local projects. In this
624
+ situation, any modified sources will immediately be updated at each request,
625
+ ensuring that the server always serve the code exactly as it is on disk.
626
+ Documenting your code in this fashion essentially gives you an efficient a
627
+ live preview without running a separate command everytime you make a change.
628
+ To serve documentation for the active project in incremental mode:
629
+
630
+ $ yard server --reload
631
+
632
+ <span class="note">Note that in incremental mode, objects or method groupings
633
+ cannot be removed. If you have removed objects or modified groupings, you
634
+ will need to flush the cache by deleting `.yardoc` and (optionally)
635
+ restarting the server.</span>
636
+
637
+ The documentation server can also serve documentation for all installed gems
638
+ on your system, similar to `gem server`, but using YARD's functionality and
639
+ templates. To serve documentation for installed gems:
640
+
641
+ $ yard server --gems
642
+
643
+ <span class="note">Documentation for the gem need not be previously generated
644
+ at install-time. If documentation for the gem has not been generated, YARD
645
+ will do this for you on-the-fly. It is therefore possible to speed up your
646
+ gem installs by using `gem install GEMNAME --no-rdoc` without repercussion.
647
+ You can also add this switch to your `~/.gemrc` file so that you don't need
648
+ to re-type it each time. See [this link](http://stackoverflow.com/questions/1789376/how-do-i-make-no-ri-no-rdoc-the-default-for-gem-install)
649
+ for exact instructions.</span>
650
+
651
+ ## Groups support for method listing (0.6.0)
652
+
653
+ You can now organize methods in a class/module into logical separated groups.
654
+ These groups apply lexically and are listed in the order they are defined.
655
+ For instance, to define a group:
656
+
657
+ # @group Rendering an Object
658
+
659
+ # Documentation here
660
+ def foo; end
661
+
662
+ # Extra documentation...
663
+ def bar; end
664
+
665
+ # @group Another Group
666
+
667
+ def aaa; end
668
+
669
+ <span class="note">Note that these `@group` and `@endgroup` declarations are
670
+ not "tags" and should always be separated with at least 1 line of whitespace
671
+ from any other documentation or code.</span>
672
+
673
+ In the above example, "Rendering an Object" will be listed with "foo" and
674
+ "bar" above "Another Group", even though "aaa" comes before the two other
675
+ methods, alphabetically. To end a group, use `@endgroup`. It is not necessary
676
+ to end a group to start a new one, only if there is an object following the
677
+ group that should not belong in any group.
678
+
679
+ # @group Group 1
680
+
681
+ def foo; end
682
+
683
+ # @endgroup
684
+
685
+ # This method should not be listed in any group
686
+ def bar; end
687
+
688
+ ## Single file template (`--one-file`) support (0.6.0)
689
+
690
+ `yardoc` now has the `--one-file` option to generate a single-file template
691
+ for small scripts and libraries. In this case, any comments at the top of
692
+ the script file will be recognized as a README.
693
+
694
+ ## `yard` CLI executable with pluggable commands (0.6.0)
695
+
696
+ <span class="note">The `yardoc` and `yri` commands are not deprecated and can
697
+ continue to be used. They are shortcuts for `yard doc` and `yard ri`
698
+ respectively. However, `yard-graph` has been removed.</span>
699
+
700
+ YARD now has a `yard` executable which combines all pre-existing and new
701
+ commands into a single pluggable command that is both easier to remember and
702
+ access. To get a list of commands, type `yard --help`.
703
+
704
+ If you are a plugin developer, you can create your own `yard` command by first
705
+ subclassing the {YARD::CLI::Command} class and then registering this class
706
+ with the {YARD::CLI::CommandParser.commands} list. For instance:
707
+
708
+ YARD::CLI::CommandParser.commands[:my_command] = MyCommandClass
709
+
710
+ The above line will enable the user to execute `yard my_command [options]`.
711
+
712
+ ## `yard diff` command to object-diff two versions of a project (0.6.0)
713
+
714
+ One of the built-in commands that comes with the new `yard` executable is the
715
+ ability to do object-oriented diffing across multiple versions of the same
716
+ project, either by 2 versions of a gem, or 2 working copies. Just like
717
+ regular diffing tells you which lines have been added/removed in a file,
718
+ object diffing allows you to see what classes/methods/modules have been
719
+ added/removed between versions of a codebase.
720
+
721
+ For an overview of how to use `yard diff`, see [YARD Object Oriented Diffing](http://gnuu.org/2010/06/26/yard-object-oriented-diffing/).
722
+
723
+ ## `yard stats` to display statistics and undocumented objects (0.6.0)
724
+
725
+ YARD now outputs the following statistics when `yard stats` is run:
726
+
727
+ Files: 125
728
+ Modules: 35 ( 4 undocumented)
729
+ Classes: 139 ( 29 undocumented)
730
+ Constants: 53 ( 20 undocumented)
731
+ Methods: 602 ( 70 undocumented)
732
+ 85.16% documented
733
+
734
+ Note that these statistics are based on what you have set to show in your
735
+ documentation. If you use `@private` tags and/or do not display
736
+ private/protected methods in your documentation, these will not show up as
737
+ undocumented. Therefore this metric is contextual.
738
+
739
+ You can also specifically list all undocumented objects (and their file
740
+ locations) with the `--list-undoc` option.
741
+
742
+ ## Added `--asset` option to `yardoc` (0.6.0)
743
+
744
+ The `yardoc` command can now take the `--asset` option to copy over
745
+ files/directories (recursively) to the output path after generating
746
+ documentation. The format of the argument is "from:to" where from is the
747
+ source path and to is the destination. For instance, YARD uses the following
748
+ syntax in the `.yardopts` file to copy over image assets from the
749
+ 'docs/images' directory into the 'images' directory after generating HTML:
750
+
751
+ --asset docs/images:images
752
+
753
+ ## New template API (0.6.0)
754
+
755
+ The new template API allows for easier insertion of sections within an
756
+ inherited template. You should no longer need to insert by index, an
757
+ error-prone process that could break when a template is updated. Instead of:
758
+
759
+ sections.last.place(:my_section).before(:another_section)
760
+
761
+ use:
762
+
763
+ sections.place(:my_section).before_any(:another_section)
764
+
765
+ You can see more in the {file:docs/Templates.md#Inserting_and_Traversing_Sections}
766
+ document.
767
+
768
+ ## HTML template now adds inline Table of Contents for extra files pages (0.6.0)
769
+
770
+ A table of contents is now generated dynamically using JavaScript for extra
771
+ file pages (such as README's, or this document). It is generated based off the
772
+ headers (h1,h2,... tags) used in the document, and can be floated to the
773
+ right or listed inline on the page.
774
+
775
+ ## Ad-hoc tag registration via `yardoc` CLI (`--tag`, etc.) (0.6.0)
776
+
777
+ Simple meta-data tags can now be added at the command-line and registered to
778
+ display in templates in a number of pre-defined ways. For instance, to create
779
+ a freeform text tag, use the following:
780
+
781
+ --tag my_tag_name:"My Tag Title"
782
+
783
+ You can also create a "typed" tag (similar to `@return`), a typed named tag
784
+ (similar to `@param`) as well as various combinations. The full list of
785
+ options are listed in `yardoc --help` under the "Tag Options" section.
786
+
787
+ If you wish to create a tag to store data but do not wish to show this data
788
+ in the templates, use the `--hide-tag` option to hide it from generated output:
789
+
790
+ --hide-tag my_tag_name
791
+
792
+ ## Added `--transitive-tags` to register transitive tags (0.6.0)
793
+
794
+ Transitive tags are tags that apply to all descendants of a namespace (class
795
+ or module) when documented on that namespace. For instance, the `@since` tag
796
+ is a transitive tag. Applying `@since` to a class will automatically apply
797
+ `@since` to all methods in the class. Creating a `@since` tag directly on a
798
+ method will override the inherited value.
799
+
800
+ You can specify transitive tags on the command-line by using this option. Note
801
+ that the tags must already exist (built-in or created with the `--tag` option)
802
+ to be specified as transitive. If you wish to do this programmatically, see
803
+ the {YARD::Tags::Library.transitive_tags} attribute.
804
+
805
+ ## `yardoc` now displays RDoc-like statistics (`--no-stats` to hide) (0.6.0)
806
+
807
+ As seen in the `yard stats` feature overview, `yardoc` displays RDoc-like
808
+ statistics when it is run. The output is equivalent to typing `yard stats`.
809
+ To hide this output when yardoc is run, use `--no-stats`.
810
+
811
+ ## `yri` now works on constants (0.6.0)
812
+
813
+ Templates have now been added for text view of constants, which displays any
814
+ documentation and the constant value.
815
+
816
+ ## Plugins are no longer auto-loaded (added `--plugin` switch) (0.6.2)
817
+
818
+ This is a backwards-incompatible change that disables plugins from automatically
819
+ loading when YARD starts up. From now on, you should manually declare which
820
+ plugins your project is using by adding `--plugin PLUGINNAME` to a `.yardopts`
821
+ file in the root of your project. You can also re-enable autoloaded plugins
822
+ by setting `load_plugins` to true in your configuration file (`yard config load_plugins true`,
823
+ see next item). You can also set `autoload_plugins` to a list of plugins
824
+ to be automatically loaded on start.
825
+
826
+ If you are a YARD plugin author, please make sure to inform your users of these
827
+ changes.
828
+
829
+ Note that `--plugin` switches passed on the commandline (not via `.yardopts`)
830
+ are parsed before commands are loaded, and therefore can add in new CLI commands.
831
+
832
+ ## Added `YARD::Config` API and `~/.yard/config` configuration file (0.6.2)
833
+
834
+ There is a new global configuration API that can be accessed programmatically
835
+ and set via the `~/.yard/config` file. The file is encoded as a YAML file,
836
+ and looks like:
837
+
838
+ :load_plugins: false
839
+ :ignored_plugins:
840
+ - my_plugin
841
+ - my_other_plugin
842
+ :autoload_plugins:
843
+ - my_autoload_plugin
844
+ :safe_mode: false
845
+
846
+ You can also set configuration options via the command-line (see next item).
847
+
848
+ ## Added `yard config` command to view/edit configuration (0.6.2)
849
+
850
+ A new `yard config` command was created to view or edit the configuration
851
+ file via the commandline.
852
+
853
+ * To view the current configuration use `yard config --list`.
854
+ * To view a specific item use `yard config ITEMNAME`
855
+ * To modify an item value use `yard config ITEMNAME VALUE`
856
+
857
+ ## Added `yard server -t` template path switch (0.6.2)
858
+
859
+ The `yard server` command now accepts `-t` or `--template-path` to register
860
+ a new template path for template customization.
861
+
862
+ ## Added `YARD::Server.register_static_path` for static server assets (0.6.2)
863
+
864
+ The server now supports a command to register static asset paths. If you are
865
+ extending the YARD::Server modules, make sure to register your asset paths
866
+ through this method.
867
+
868
+ ## YARD::Registry is now thread local (0.6.5)
869
+
870
+ Creating a new thread will now implicitly load a new Registry that can be used
871
+ to parse and process new code objects independently of the other threads. Note
872
+ that this means you can no longer use the Registry across threads; you must
873
+ either access the threadlocal object directly, or synchronize threads to do
874
+ the processing in the initial registry's thread.
875
+
876
+ ## Support for ripper gem in Ruby 1.8.7 (0.6.5)
877
+
878
+ YARD now supports the Ruby 1.8.7 port of the `ripper` gem to improve parsing
879
+ of source, both in terms of performance and functionality. When the `ripper`
880
+ gem is available, YARD will use the "new-style" handlers. You can take advantage
881
+ of this functionality by performing a `gem install ripper`.
882
+
883
+
884
+ What's New in 0.5.x?
885
+ ====================
886
+
887
+ 1. **Support for documenting native Ruby C code** (0.5.0)
888
+ 2. **Incremental parsing and output generation with `yardoc -c`** (0.5.0, 0.5.3)
889
+ 2. **Improved `yri` support to perform lookups on installed Gems** (0.5.0)
890
+ 3. **Added `yardoc --default-return` and `yardoc --hide-void-return`** (0.5.0)
891
+ 4. **Multiple syntax highlighting language support** (0.5.0)
892
+ 5. **New .yardoc format** (0.5.0)
893
+ 6. **Support for yard-doc-* gem packages as hosted .yardoc dbs** (0.5.1)
894
+ 7. **Support for extra search paths in `yri`** (0.5.1)
895
+ 8. **Generating HTML docs now adds frames view** (0.5.3)
896
+ 9. **Tree view for class list** (0.5.3)
897
+ 10. **Ability to specify markup format of extra files** (0.5.3)
898
+ 11. **Keyboard shortcuts for default HTML template** (0.5.4)
899
+
900
+ Support for documenting native Ruby C code (0.5.0)
901
+ --------------------------------------------------
902
+
903
+ It is now possible to document native Ruby extensions with YARD with a new
904
+ C parser mostly borrowed from RDoc. This enables the ability to document
905
+ Ruby's core and stdlibs which will be hosted on http://yardoc.org/docs. In
906
+ addition, the .yardoc dump for the Ruby-core classes will become available
907
+ as an installable gem for yri support (see #3).
908
+
909
+ Incremental parsing and output generation with `yardoc -c` (0.5.0, 0.5.3)
910
+ -------------------------------------------------------------------------
911
+
912
+ <p class="note">Note: in 0.5.3 and above you must use <tt>--incremental</tt>
913
+ to incrementally generate HTML, otherwise only parsing will be done
914
+ incrementally but HTML will be generated with all objects. <tt>--incremental</tt>
915
+ implies <tt>-c</tt>, so no need to specify them both.</p>
916
+
917
+ YARD now compares file checksums before parsing when using `yardoc -c`
918
+ (aka `yardoc --use-cache`) to do incremental parsing of only the files that
919
+ have changed. HTML (or other output format) generation will also only be
920
+ done on the objects that were parsed from changed files (\*). This makes doing
921
+ a documentation development cycle much faster for quick HTML previews. Just
922
+ remember that when using incremental output generation, the index will not
923
+ be rebuilt and inter-file links might not hook up right, so it is best to
924
+ perform a full rebuild at the end of such previews.
925
+
926
+ (\*) Only for versions prior to 0.5.3. For 0.5.3+, use `--incremental` for
927
+ incremental HTML output.
928
+
929
+ Improved `yri` support to perform lookups on installed Gems (0.5.0)
930
+ -------------------------------------------------------------------
931
+
932
+ The `yri` executable can now perform lookups on gems that have been parsed
933
+ by yard. Therefore, to use this command you must first parse all gems with
934
+ YARD. To parse all gems, use the following command:
935
+
936
+ $ sudo yardoc --build-gems
937
+
938
+ The above command builds a .yardoc file for all installed gems in the
939
+ respective gem directory. If you do not have write access to the gem path,
940
+ YARD will write the yardoc file to `~/.yard/gem_index/NAME-VERSION.yardoc`.
941
+
942
+ Note: you can also use `--re-build-gems` to force re-parsing of all gems.
943
+
944
+ You can now do lookups with yri:
945
+
946
+ $ yri JSON
947
+
948
+ All lookups are cached to `~/.yard/yri_cache` for quicker lookups the second
949
+ time onward.
950
+
951
+ Added `yardoc --default-return` and `yardoc --hide-void-return` (0.5.0)
952
+ -----------------------------------------------------------------------
953
+
954
+ YARD defaults to displaying (Object) as the default return type of any
955
+ method that has not declared a @return tag. To customize the default
956
+ return type, you can specify:
957
+
958
+ $ yardoc --default-return 'MyDefaultType'
959
+
960
+ You can also use the empty string to list no return type.
961
+
962
+ In addition, you can use --hide-void-return to ignore any method that
963
+ defines itself as a void type by: `@return [void]`
964
+
965
+ Multiple syntax highlighting language support (0.5.0)
966
+ -----------------------------------------------------
967
+
968
+ YARD now supports the ability to specify a language type for code blocks in
969
+ docstrings. Although no actual highlighting support is added for any language
970
+ but Ruby, you can add your own support by writing your own helper method:
971
+
972
+ # Where LANGNAME is the language:
973
+ def html_syntax_highlight_LANGNAME(source)
974
+ # return highlighted HTML
975
+ end
976
+
977
+ To use this language in code blocks, prefix the block with `!!!LANGNAME`:
978
+
979
+ !!!plain
980
+ !!!python
981
+ def python_code(self):
982
+ return self
983
+
984
+ By the same token. you can now use `!!!plain` to ignore highlighting for
985
+ a specific code block.
986
+
987
+ New .yardoc format (0.5.0)
988
+ --------------------------
989
+
990
+ To make the above yri support possible, the .yardoc format was redesigned
991
+ to be a directory instead of a file. YARD can still load old .yardoc files,
992
+ but they will be automatically upgraded if re-saved. The new .yardoc format
993
+ does have a larger memory footprint, but this will hopefully be optimized
994
+ downward.
995
+
996
+ Support for yard-doc-* gem packages as hosted .yardoc dbs (0.5.1)
997
+ -----------------------------------------------------------------
998
+
999
+ You can now install special YARD plugin gems titled yard-doc-NAME to get
1000
+ packaged a .yardoc database. This will enable yri lookups or building docs
1001
+ for the gem without the code.
1002
+
1003
+ One main use for this is the `yard-doc-core` package, which enabled yri
1004
+ support for Ruby core classes (stdlib coming soon as `yard-doc-stdlib`).
1005
+ To install it, simply:
1006
+
1007
+ $ sudo gem install yard-doc-core
1008
+ # now you can use:
1009
+ $ yri String
1010
+
1011
+ This will by default install the 1.9.1 core library. To install a library
1012
+ for a specific version of Ruby, use the `--version` switch on gem:
1013
+
1014
+ $ sudo gem install --version '= 1.8.6' yard-doc-core
1015
+
1016
+ Support for extra search paths in `yri` (0.5.1)
1017
+ -----------------------------------------------
1018
+
1019
+ You can now add custom paths to non-gem .yardoc files
1020
+ by adding them as newline separated paths in `~/.yard/yri_search_paths`.
1021
+
1022
+ Generating HTML docs now adds frames view (0.5.3)
1023
+ -------------------------------------------------
1024
+
1025
+ `yardoc` will now create a `frames.html` file when generating HTML documents
1026
+ which allows the user to view documentation inside frames, for those users who
1027
+ still find frames beneficial.
1028
+
1029
+ Tree view for class list (0.5.3)
1030
+ --------------------------------
1031
+
1032
+ The class list now displays as an expandable tree view to better organized an
1033
+ otherwise cluttered namespace. If you properly namespace your less important
1034
+ classes (like Rails timezone classes), they will not take up space in the
1035
+ class list unless the user looks for them.
1036
+
1037
+ Ability to specify markup format of extra files (0.5.3)
1038
+ -------------------------------------------------------
1039
+
1040
+ You can now specify the markup format of an extra file (like README) at the
1041
+ top of the file with a shebang-like line:
1042
+
1043
+ #!textile
1044
+ contents here
1045
+
1046
+ The above file contents will be rendered with a textile markup engine
1047
+ (eg. RedCloth).
1048
+
1049
+ Keyboard shortcuts for default HTML template (0.5.4)
1050
+ ----------------------------------------------------
1051
+
1052
+ You can now access the "Class List", "Method List" and "File List" with the
1053
+ 'c', 'm' and 'f' keyboard shortcuts in the default HTML template, allowing
1054
+ for keyboard-only navigation around YARD documentation.
1055
+
1056
+ API for registering custom parsers (0.5.6)
1057
+ ------------------------------------------
1058
+
1059
+ You can now register parsers for custom source languages by calling the
1060
+ following method:
1061
+
1062
+ SourceParser.register_parser_type(:java, MyJavaParser, 'java')
1063
+
1064
+ The parser class MyJavaParser should be a subclass of {YARD::Parser::Base},
1065
+ and the last argument is a set of extensions (string, array or regexp). You
1066
+ can read more about registering parsers at the {YARD::Parser::SourceParser}
1067
+ class documentation.
1068
+
1069
+
1070
+ What's New in 0.4.x?
1071
+ ====================
1072
+
1073
+ 1. **New templating engine and templates**
1074
+ 2. **yardoc `--query` argument**
1075
+ 3. **Greatly expanded API documentation**
1076
+ 4. **New plugin support**
1077
+ 5. **New tags (@abstract, @private)**
1078
+ 6. **Default rake task is now `rake yard`**
1079
+
1080
+ New templating engine and templates
1081
+ -----------------------------------
1082
+
1083
+ The templates were redesigned, most notably removing the ugly frameset, adding
1084
+ search to the class/method lists, simplifying the layout and making things
1085
+ generally prettier. You should also notice that more tags are now visible in
1086
+ the templates such as @todo, the new @abstract and @note tags and some others
1087
+ that existed but were previously omitted from the generated documentation.
1088
+
1089
+ There is also a new templating engine (based on the tadpole templating library)
1090
+ to allow for much more user customization. You can read about it in
1091
+ {file:docs/Templates.md}.
1092
+
1093
+ yardoc `--query` argument
1094
+ -------------------------
1095
+
1096
+ The yardoc command-line tool now supports queries to select which classes,
1097
+ modules or methods to include in documentation based on their data or meta-data.
1098
+ For instance, you can now generate documentation for your "public" API only by
1099
+ adding "@api public" to each of your public API methods/classes and using
1100
+ the following argument:
1101
+
1102
+ --query '@api.text == "public"'
1103
+
1104
+ More information on queries is in the {file:README.md}.
1105
+
1106
+ Greatly expanded API documentation
1107
+ ----------------------------------
1108
+
1109
+ Last release focused on many how-to and architecture documents to explain
1110
+ the design of YARD, but many of the actual API classes/methods were still
1111
+ left undocumented. This release marks a focus on getting YARD's own documentation
1112
+ up to par so that it can serve as an official reference on the recommended
1113
+ conventions to use when documenting code.
1114
+
1115
+ New plugin support
1116
+ ------------------
1117
+
1118
+ YARD now supports loading of plugins via RubyGems. Any gem named `yard-*` or
1119
+ `yard_*` will now be loaded when YARD starts up. Note that the '-' separator
1120
+ is the recommended naming scheme.
1121
+
1122
+ To ignore plugins, add the gem names to `~/.yard/ignored_plugins` on separate
1123
+ lines (or separated by whitespace).
1124
+
1125
+ New tags (@abstract, @private)
1126
+ ------------------------------
1127
+
1128
+ Two new tags were added to the list of builtin meta-tags in YARD. `@abstract`
1129
+ marks a class/module/method as abstract while `@private` marks an object
1130
+ as "private". The latter tag is used in situations where an object is public
1131
+ due to Ruby's own visibility limitations (constants, classes and modules
1132
+ can never be private) but not actually part of your public API. You should
1133
+ use this tag sparingly, as it is not meant to be an equivalent to RDoc's
1134
+ `:nodoc:` tag. Remember, YARD recommends documenting private objects too.
1135
+ This tag exists so that you can create a query (`--query !@private`) to
1136
+ ignore all of these private objects in your documentation. You can also
1137
+ use the new `--no-private` switch, which is a shortcut to the aforementioned
1138
+ query. You can read more about the new tags in the {file:docs/GettingStarted.md}
1139
+ guide.
1140
+
1141
+ Default rake task is now `rake yard`
1142
+ ------------------------------------
1143
+
1144
+ Not a big change, but anyone using the default "rake yardoc" task should
1145
+ update their scripts:
1146
+
1147
+ [http://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0](http://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0)
1148
+
1149
+
1150
+ What's New in 0.2.3.x?
1151
+ ======================
1152
+
1153
+ 1. **Full Ruby 1.9 support**
1154
+ 2. **New parser code and handler API for 1.9**
1155
+ 3. **A new `@overload` tag**
1156
+ 4. **Better documentation**
1157
+ 5. **Template changes and bug fixes**
1158
+
1159
+ Full Ruby 1.9 support
1160
+ ---------------------
1161
+
1162
+ YARD's development actually focuses primarily on 1.9 from the get-go, so it is
1163
+ not an afterthought. All features are first implemented for compatibility with
1164
+ 1.9, but of course all functionality is also tested in 1.8.x. YARD 0.2.2 was
1165
+ mostly compatible with 1.9, but the new release improves and extends in certain
1166
+ areas where compatibility was lacking. The new release should be fully functional
1167
+ in Ruby 1.9.
1168
+
1169
+ New parser code and handler API for 1.9
1170
+ ---------------------------------------
1171
+
1172
+ Using Ruby 1.9 also gives YARD the advantage of using the new `ripper` library
1173
+ which was added to stdlib. The ripper parser is Ruby's official answer to
1174
+ projects like ParseTree and ruby2ruby. Ripper allows access to the AST as it
1175
+ is parsed by the Ruby compiler. This has some large benefits over alternative
1176
+ projects:
1177
+
1178
+ 1. It is officially supported and maintained by the Ruby core team.
1179
+ 2. The AST is generated directly from the exact same code that drives the
1180
+ compiler, meaning anything that compiles is guaranteed to generate the
1181
+ equivalent AST.
1182
+ 3. It needs no hacks, gems or extra libs and works out of the box in 1.9.
1183
+ 4. It's *fast*.
1184
+
1185
+ Having the AST means that developers looking to extend YARD have much better
1186
+ access to the parsed code than in previous versions. The only caveat is that
1187
+ this library is not back-compatible to 1.8.x. Because of this, there are
1188
+ subtle changes to the handler extension API that developers use to extend YARD.
1189
+ Namely, there is now a standard API for 1.9 and a "legacy" API that can run in
1190
+ both 1.8.x and 1.9 if needed. A developer can still use the legacy API to write
1191
+ handlers that are compatible for both 1.8.x and 1.9 in one shot, or decide to
1192
+ implement the handler using both APIs. Realize that the benefit of using the new
1193
+ API means 1.9 users will get a 2.5x parsing speed increase over running the legacy
1194
+ handlers (this is *in addition to* the ~1.8x speed increase of using YARV over MRI).
1195
+
1196
+ A new `@overload` tag
1197
+ ---------------------
1198
+
1199
+ The new `@overload` tag enables users to document methods that take multiple
1200
+ parameters depending on context. This is basically equivalent to RDoc's call-seq,
1201
+ but with a name that is more akin to the OOP concept of method overloading
1202
+ that is actually being employed. Here's an example:
1203
+
1204
+ # @overload def to_html(html, autolink = true)
1205
+ # This docstring describes the specific overload only.
1206
+ # @param [String] html the HTML
1207
+ # @param [Boolean] autolink whether or not to atuomatically link
1208
+ # URL references
1209
+ # @overload def to_html(html, opts = {})
1210
+ # @param [String] html the HTML
1211
+ # @param [Hash] opts any attributes to add to the root HTML node
1212
+ def to_html(*args)
1213
+ # split args depending on context
1214
+ end
1215
+
1216
+ As you can see each overload takes its own nested tags (including a docstring)
1217
+ as if it were its own method. This allows "virtual" overloading behaviour at
1218
+ the API level to make Ruby look like overload-aware languages without caring
1219
+ about the implementation details required to add the behaviour.
1220
+
1221
+ It is still recommended practice, however, to stay away from overloading when
1222
+ possible and document the types of each method's real parameters. This allows
1223
+ toolkits making use of YARD to get accurate type information for your methods,
1224
+ for instance, allowing IDE autocompletion. There are, of course, situations
1225
+ where overload just makes more sense.
1226
+
1227
+ Better documentation
1228
+ --------------------
1229
+
1230
+ The first few iterations of YARD were very much a proof of concept. Few people
1231
+ were paying attention and it was really just pieced together to see what was
1232
+ feasible. Now that YARD is gaining interest, there are many developers that
1233
+ want to take advantage of its extensibility support to do some really cool stuff.
1234
+ Considerable time was spent for this release documenting, at a high level, what
1235
+ YARD can do and how it can be done. Expect this documentation to be extended and
1236
+ improved in future releases.
1237
+
1238
+ Template changes and bug fixes
1239
+ ------------------------------
1240
+
1241
+ Of course no new release would be complete without fixing the old broken code.
1242
+ Some tags existed but were not present in generated documentation. The templates
1243
+ were mostly fixed to add the major omitted tags. In addition to template adjustments,
1244
+ many parsing bugs were ironed out to make YARD much more stable with existing projects
1245
+ (Rails, HAML, Sinatra, Ramaze, etc.).