deg-yard 0.8.7.1

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