hyper-pro-gem 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. checksums.yaml +7 -0
  2. data/hyper-pro-gem.gemspec +12 -0
  3. data/yard-0.9.44/CHANGELOG.md +983 -0
  4. data/yard-0.9.44/LEGAL +94 -0
  5. data/yard-0.9.44/LICENSE +22 -0
  6. data/yard-0.9.44/README.md +329 -0
  7. data/yard-0.9.44/bin/yard +13 -0
  8. data/yard-0.9.44/bin/yardoc +13 -0
  9. data/yard-0.9.44/bin/yri +13 -0
  10. data/yard-0.9.44/docs/CodeObjects.md +115 -0
  11. data/yard-0.9.44/docs/GettingStarted.md +705 -0
  12. data/yard-0.9.44/docs/Handlers.md +152 -0
  13. data/yard-0.9.44/docs/Overview.md +61 -0
  14. data/yard-0.9.44/docs/Parser.md +166 -0
  15. data/yard-0.9.44/docs/Tags.md +304 -0
  16. data/yard-0.9.44/docs/TagsArch.md +123 -0
  17. data/yard-0.9.44/docs/Templates.md +497 -0
  18. data/yard-0.9.44/docs/WhatsNew.md +1297 -0
  19. data/yard-0.9.44/docs/images/code-objects-class-diagram.png +0 -0
  20. data/yard-0.9.44/docs/images/handlers-class-diagram.png +0 -0
  21. data/yard-0.9.44/docs/images/overview-class-diagram.png +0 -0
  22. data/yard-0.9.44/docs/images/parser-class-diagram.png +0 -0
  23. data/yard-0.9.44/docs/images/tags-class-diagram.png +0 -0
  24. data/yard-0.9.44/docs/templates/default/fulldoc/html/full_list_tag.erb +9 -0
  25. data/yard-0.9.44/docs/templates/default/fulldoc/html/setup.rb +6 -0
  26. data/yard-0.9.44/docs/templates/default/layout/html/setup.rb +9 -0
  27. data/yard-0.9.44/docs/templates/default/layout/html/tag_list.erb +11 -0
  28. data/yard-0.9.44/docs/templates/default/yard_tags/html/list.erb +18 -0
  29. data/yard-0.9.44/docs/templates/default/yard_tags/html/setup.rb +26 -0
  30. data/yard-0.9.44/docs/templates/plugin.rb +70 -0
  31. data/yard-0.9.44/lib/rubygems_plugin.rb +9 -0
  32. data/yard-0.9.44/lib/yard/autoload.rb +328 -0
  33. data/yard-0.9.44/lib/yard/cli/command.rb +85 -0
  34. data/yard-0.9.44/lib/yard/cli/command_parser.rb +93 -0
  35. data/yard-0.9.44/lib/yard/cli/config.rb +198 -0
  36. data/yard-0.9.44/lib/yard/cli/diff.rb +278 -0
  37. data/yard-0.9.44/lib/yard/cli/display.rb +69 -0
  38. data/yard-0.9.44/lib/yard/cli/gems.rb +84 -0
  39. data/yard-0.9.44/lib/yard/cli/graph.rb +125 -0
  40. data/yard-0.9.44/lib/yard/cli/help.rb +20 -0
  41. data/yard-0.9.44/lib/yard/cli/i18n.rb +70 -0
  42. data/yard-0.9.44/lib/yard/cli/list.rb +23 -0
  43. data/yard-0.9.44/lib/yard/cli/markup_types.rb +32 -0
  44. data/yard-0.9.44/lib/yard/cli/server.rb +266 -0
  45. data/yard-0.9.44/lib/yard/cli/stats.rb +234 -0
  46. data/yard-0.9.44/lib/yard/cli/yardoc.rb +791 -0
  47. data/yard-0.9.44/lib/yard/cli/yardopts_command.rb +110 -0
  48. data/yard-0.9.44/lib/yard/cli/yri.rb +215 -0
  49. data/yard-0.9.44/lib/yard/code_objects/base.rb +626 -0
  50. data/yard-0.9.44/lib/yard/code_objects/class_object.rb +146 -0
  51. data/yard-0.9.44/lib/yard/code_objects/class_variable_object.rb +11 -0
  52. data/yard-0.9.44/lib/yard/code_objects/constant_object.rb +16 -0
  53. data/yard-0.9.44/lib/yard/code_objects/extended_method_object.rb +24 -0
  54. data/yard-0.9.44/lib/yard/code_objects/extra_file_object.rb +135 -0
  55. data/yard-0.9.44/lib/yard/code_objects/macro_object.rb +171 -0
  56. data/yard-0.9.44/lib/yard/code_objects/method_object.rb +196 -0
  57. data/yard-0.9.44/lib/yard/code_objects/module_object.rb +21 -0
  58. data/yard-0.9.44/lib/yard/code_objects/namespace_mapper.rb +141 -0
  59. data/yard-0.9.44/lib/yard/code_objects/namespace_object.rb +200 -0
  60. data/yard-0.9.44/lib/yard/code_objects/proxy.rb +245 -0
  61. data/yard-0.9.44/lib/yard/code_objects/root_object.rb +19 -0
  62. data/yard-0.9.44/lib/yard/config.rb +274 -0
  63. data/yard-0.9.44/lib/yard/core_ext/array.rb +16 -0
  64. data/yard-0.9.44/lib/yard/core_ext/file.rb +69 -0
  65. data/yard-0.9.44/lib/yard/core_ext/hash.rb +16 -0
  66. data/yard-0.9.44/lib/yard/core_ext/insertion.rb +63 -0
  67. data/yard-0.9.44/lib/yard/core_ext/module.rb +11 -0
  68. data/yard-0.9.44/lib/yard/core_ext/string.rb +68 -0
  69. data/yard-0.9.44/lib/yard/core_ext/symbol_hash.rb +75 -0
  70. data/yard-0.9.44/lib/yard/docstring.rb +386 -0
  71. data/yard-0.9.44/lib/yard/docstring_parser.rb +344 -0
  72. data/yard-0.9.44/lib/yard/gem_index.rb +29 -0
  73. data/yard-0.9.44/lib/yard/globals.rb +22 -0
  74. data/yard-0.9.44/lib/yard/handlers/base.rb +617 -0
  75. data/yard-0.9.44/lib/yard/handlers/c/alias_handler.rb +16 -0
  76. data/yard-0.9.44/lib/yard/handlers/c/attribute_handler.rb +13 -0
  77. data/yard-0.9.44/lib/yard/handlers/c/base.rb +164 -0
  78. data/yard-0.9.44/lib/yard/handlers/c/class_handler.rb +27 -0
  79. data/yard-0.9.44/lib/yard/handlers/c/constant_handler.rb +13 -0
  80. data/yard-0.9.44/lib/yard/handlers/c/handler_methods.rb +212 -0
  81. data/yard-0.9.44/lib/yard/handlers/c/init_handler.rb +20 -0
  82. data/yard-0.9.44/lib/yard/handlers/c/method_handler.rb +45 -0
  83. data/yard-0.9.44/lib/yard/handlers/c/mixin_handler.rb +21 -0
  84. data/yard-0.9.44/lib/yard/handlers/c/module_handler.rb +17 -0
  85. data/yard-0.9.44/lib/yard/handlers/c/override_comment_handler.rb +31 -0
  86. data/yard-0.9.44/lib/yard/handlers/c/path_handler.rb +11 -0
  87. data/yard-0.9.44/lib/yard/handlers/c/struct_handler.rb +13 -0
  88. data/yard-0.9.44/lib/yard/handlers/c/symbol_handler.rb +8 -0
  89. data/yard-0.9.44/lib/yard/handlers/common/method_handler.rb +19 -0
  90. data/yard-0.9.44/lib/yard/handlers/processor.rb +200 -0
  91. data/yard-0.9.44/lib/yard/handlers/rbs/attribute_handler.rb +79 -0
  92. data/yard-0.9.44/lib/yard/handlers/rbs/base.rb +38 -0
  93. data/yard-0.9.44/lib/yard/handlers/rbs/constant_handler.rb +18 -0
  94. data/yard-0.9.44/lib/yard/handlers/rbs/method_handler.rb +327 -0
  95. data/yard-0.9.44/lib/yard/handlers/rbs/mixin_handler.rb +20 -0
  96. data/yard-0.9.44/lib/yard/handlers/rbs/namespace_handler.rb +26 -0
  97. data/yard-0.9.44/lib/yard/handlers/ruby/alias_handler.rb +45 -0
  98. data/yard-0.9.44/lib/yard/handlers/ruby/attribute_handler.rb +90 -0
  99. data/yard-0.9.44/lib/yard/handlers/ruby/base.rb +165 -0
  100. data/yard-0.9.44/lib/yard/handlers/ruby/class_condition_handler.rb +92 -0
  101. data/yard-0.9.44/lib/yard/handlers/ruby/class_handler.rb +119 -0
  102. data/yard-0.9.44/lib/yard/handlers/ruby/class_variable_handler.rb +17 -0
  103. data/yard-0.9.44/lib/yard/handlers/ruby/comment_handler.rb +10 -0
  104. data/yard-0.9.44/lib/yard/handlers/ruby/constant_handler.rb +73 -0
  105. data/yard-0.9.44/lib/yard/handlers/ruby/decorator_handler_methods.rb +123 -0
  106. data/yard-0.9.44/lib/yard/handlers/ruby/dsl_handler.rb +15 -0
  107. data/yard-0.9.44/lib/yard/handlers/ruby/dsl_handler_methods.rb +96 -0
  108. data/yard-0.9.44/lib/yard/handlers/ruby/exception_handler.rb +27 -0
  109. data/yard-0.9.44/lib/yard/handlers/ruby/extend_handler.rb +22 -0
  110. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/alias_handler.rb +37 -0
  111. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/attribute_handler.rb +65 -0
  112. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/base.rb +245 -0
  113. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +83 -0
  114. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_handler.rb +113 -0
  115. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +15 -0
  116. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/comment_handler.rb +10 -0
  117. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/constant_handler.rb +29 -0
  118. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/dsl_handler.rb +17 -0
  119. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/exception_handler.rb +13 -0
  120. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/extend_handler.rb +21 -0
  121. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/method_handler.rb +90 -0
  122. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/mixin_handler.rb +39 -0
  123. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/module_function_handler.rb +19 -0
  124. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/module_handler.rb +12 -0
  125. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +22 -0
  126. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +22 -0
  127. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/visibility_handler.rb +18 -0
  128. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/yield_handler.rb +29 -0
  129. data/yard-0.9.44/lib/yard/handlers/ruby/method_condition_handler.rb +9 -0
  130. data/yard-0.9.44/lib/yard/handlers/ruby/method_handler.rb +104 -0
  131. data/yard-0.9.44/lib/yard/handlers/ruby/mixin_handler.rb +61 -0
  132. data/yard-0.9.44/lib/yard/handlers/ruby/module_function_handler.rb +39 -0
  133. data/yard-0.9.44/lib/yard/handlers/ruby/module_handler.rb +12 -0
  134. data/yard-0.9.44/lib/yard/handlers/ruby/private_class_method_handler.rb +14 -0
  135. data/yard-0.9.44/lib/yard/handlers/ruby/private_constant_handler.rb +43 -0
  136. data/yard-0.9.44/lib/yard/handlers/ruby/public_class_method_handler.rb +14 -0
  137. data/yard-0.9.44/lib/yard/handlers/ruby/struct_handler_methods.rb +143 -0
  138. data/yard-0.9.44/lib/yard/handlers/ruby/visibility_handler.rb +35 -0
  139. data/yard-0.9.44/lib/yard/handlers/ruby/yield_handler.rb +31 -0
  140. data/yard-0.9.44/lib/yard/i18n/locale.rb +67 -0
  141. data/yard-0.9.44/lib/yard/i18n/message.rb +57 -0
  142. data/yard-0.9.44/lib/yard/i18n/messages.rb +56 -0
  143. data/yard-0.9.44/lib/yard/i18n/po_parser.rb +61 -0
  144. data/yard-0.9.44/lib/yard/i18n/pot_generator.rb +290 -0
  145. data/yard-0.9.44/lib/yard/i18n/text.rb +173 -0
  146. data/yard-0.9.44/lib/yard/logging.rb +260 -0
  147. data/yard-0.9.44/lib/yard/open_struct.rb +67 -0
  148. data/yard-0.9.44/lib/yard/options.rb +217 -0
  149. data/yard-0.9.44/lib/yard/parser/base.rb +57 -0
  150. data/yard-0.9.44/lib/yard/parser/c/c_parser.rb +235 -0
  151. data/yard-0.9.44/lib/yard/parser/c/comment_parser.rb +134 -0
  152. data/yard-0.9.44/lib/yard/parser/c/statement.rb +66 -0
  153. data/yard-0.9.44/lib/yard/parser/rbs/rbs_parser.rb +325 -0
  154. data/yard-0.9.44/lib/yard/parser/rbs/statement.rb +75 -0
  155. data/yard-0.9.44/lib/yard/parser/ruby/ast_node.rb +559 -0
  156. data/yard-0.9.44/lib/yard/parser/ruby/legacy/irb/slex.rb +294 -0
  157. data/yard-0.9.44/lib/yard/parser/ruby/legacy/ruby_lex.rb +1360 -0
  158. data/yard-0.9.44/lib/yard/parser/ruby/legacy/ruby_parser.rb +32 -0
  159. data/yard-0.9.44/lib/yard/parser/ruby/legacy/statement.rb +68 -0
  160. data/yard-0.9.44/lib/yard/parser/ruby/legacy/statement_list.rb +394 -0
  161. data/yard-0.9.44/lib/yard/parser/ruby/legacy/token_list.rb +74 -0
  162. data/yard-0.9.44/lib/yard/parser/ruby/ruby_parser.rb +792 -0
  163. data/yard-0.9.44/lib/yard/parser/ruby/token_resolver.rb +158 -0
  164. data/yard-0.9.44/lib/yard/parser/source_parser.rb +526 -0
  165. data/yard-0.9.44/lib/yard/rake/yardoc_task.rb +81 -0
  166. data/yard-0.9.44/lib/yard/registry.rb +439 -0
  167. data/yard-0.9.44/lib/yard/registry_resolver.rb +225 -0
  168. data/yard-0.9.44/lib/yard/registry_store.rb +342 -0
  169. data/yard-0.9.44/lib/yard/rubygems/backports/LICENSE.txt +57 -0
  170. data/yard-0.9.44/lib/yard/rubygems/backports/MIT.txt +20 -0
  171. data/yard-0.9.44/lib/yard/rubygems/backports/gem.rb +10 -0
  172. data/yard-0.9.44/lib/yard/rubygems/backports/source_index.rb +365 -0
  173. data/yard-0.9.44/lib/yard/rubygems/backports.rb +10 -0
  174. data/yard-0.9.44/lib/yard/rubygems/doc_manager.rb +90 -0
  175. data/yard-0.9.44/lib/yard/rubygems/hook.rb +197 -0
  176. data/yard-0.9.44/lib/yard/rubygems/specification.rb +50 -0
  177. data/yard-0.9.44/lib/yard/serializers/base.rb +83 -0
  178. data/yard-0.9.44/lib/yard/serializers/file_system_serializer.rb +123 -0
  179. data/yard-0.9.44/lib/yard/serializers/process_serializer.rb +24 -0
  180. data/yard-0.9.44/lib/yard/serializers/stdout_serializer.rb +34 -0
  181. data/yard-0.9.44/lib/yard/serializers/yardoc_serializer.rb +152 -0
  182. data/yard-0.9.44/lib/yard/server/adapter.rb +100 -0
  183. data/yard-0.9.44/lib/yard/server/commands/base.rb +203 -0
  184. data/yard-0.9.44/lib/yard/server/commands/display_file_command.rb +29 -0
  185. data/yard-0.9.44/lib/yard/server/commands/display_object_command.rb +65 -0
  186. data/yard-0.9.44/lib/yard/server/commands/frames_command.rb +16 -0
  187. data/yard-0.9.44/lib/yard/server/commands/library_command.rb +187 -0
  188. data/yard-0.9.44/lib/yard/server/commands/library_index_command.rb +28 -0
  189. data/yard-0.9.44/lib/yard/server/commands/list_command.rb +25 -0
  190. data/yard-0.9.44/lib/yard/server/commands/root_request_command.rb +15 -0
  191. data/yard-0.9.44/lib/yard/server/commands/search_command.rb +79 -0
  192. data/yard-0.9.44/lib/yard/server/commands/static_file_command.rb +23 -0
  193. data/yard-0.9.44/lib/yard/server/commands/static_file_helpers.rb +60 -0
  194. data/yard-0.9.44/lib/yard/server/doc_server_helper.rb +91 -0
  195. data/yard-0.9.44/lib/yard/server/doc_server_serializer.rb +39 -0
  196. data/yard-0.9.44/lib/yard/server/http_utils.rb +512 -0
  197. data/yard-0.9.44/lib/yard/server/library_version.rb +277 -0
  198. data/yard-0.9.44/lib/yard/server/rack_adapter.rb +97 -0
  199. data/yard-0.9.44/lib/yard/server/router.rb +187 -0
  200. data/yard-0.9.44/lib/yard/server/static_caching.rb +77 -0
  201. data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/css/custom.css +207 -0
  202. data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/images/processing.gif +0 -0
  203. data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +203 -0
  204. data/yard-0.9.44/lib/yard/server/templates/default/layout/html/breadcrumb.erb +21 -0
  205. data/yard-0.9.44/lib/yard/server/templates/default/layout/html/script_setup.erb +7 -0
  206. data/yard-0.9.44/lib/yard/server/templates/default/layout/html/setup.rb +8 -0
  207. data/yard-0.9.44/lib/yard/server/templates/default/method_details/html/permalink.erb +6 -0
  208. data/yard-0.9.44/lib/yard/server/templates/default/method_details/html/setup.rb +5 -0
  209. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/headers.erb +8 -0
  210. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +13 -0
  211. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/listing.erb +13 -0
  212. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/setup.rb +6 -0
  213. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/title.erb +2 -0
  214. data/yard-0.9.44/lib/yard/server/templates/doc_server/processing/html/processing.erb +58 -0
  215. data/yard-0.9.44/lib/yard/server/templates/doc_server/processing/html/setup.rb +4 -0
  216. data/yard-0.9.44/lib/yard/server/templates/doc_server/search/html/search.erb +18 -0
  217. data/yard-0.9.44/lib/yard/server/templates/doc_server/search/html/setup.rb +9 -0
  218. data/yard-0.9.44/lib/yard/server/webrick_adapter.rb +45 -0
  219. data/yard-0.9.44/lib/yard/server.rb +13 -0
  220. data/yard-0.9.44/lib/yard/tags/default_factory.rb +192 -0
  221. data/yard-0.9.44/lib/yard/tags/default_tag.rb +13 -0
  222. data/yard-0.9.44/lib/yard/tags/directives.rb +631 -0
  223. data/yard-0.9.44/lib/yard/tags/library.rb +633 -0
  224. data/yard-0.9.44/lib/yard/tags/option_tag.rb +13 -0
  225. data/yard-0.9.44/lib/yard/tags/overload_tag.rb +72 -0
  226. data/yard-0.9.44/lib/yard/tags/ref_tag.rb +8 -0
  227. data/yard-0.9.44/lib/yard/tags/ref_tag_list.rb +28 -0
  228. data/yard-0.9.44/lib/yard/tags/tag.rb +72 -0
  229. data/yard-0.9.44/lib/yard/tags/tag_format_error.rb +7 -0
  230. data/yard-0.9.44/lib/yard/tags/types_explainer.rb +288 -0
  231. data/yard-0.9.44/lib/yard/templates/engine.rb +185 -0
  232. data/yard-0.9.44/lib/yard/templates/erb_cache.rb +23 -0
  233. data/yard-0.9.44/lib/yard/templates/helpers/base_helper.rb +215 -0
  234. data/yard-0.9.44/lib/yard/templates/helpers/filter_helper.rb +27 -0
  235. data/yard-0.9.44/lib/yard/templates/helpers/html_helper.rb +688 -0
  236. data/yard-0.9.44/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +83 -0
  237. data/yard-0.9.44/lib/yard/templates/helpers/markup/html_entities.rb +2140 -0
  238. data/yard-0.9.44/lib/yard/templates/helpers/markup/hybrid_markdown.rb +2131 -0
  239. data/yard-0.9.44/lib/yard/templates/helpers/markup/rdoc_markdown.rb +23 -0
  240. data/yard-0.9.44/lib/yard/templates/helpers/markup/rdoc_markup.rb +112 -0
  241. data/yard-0.9.44/lib/yard/templates/helpers/markup_helper.rb +175 -0
  242. data/yard-0.9.44/lib/yard/templates/helpers/method_helper.rb +77 -0
  243. data/yard-0.9.44/lib/yard/templates/helpers/module_helper.rb +21 -0
  244. data/yard-0.9.44/lib/yard/templates/helpers/text_helper.rb +112 -0
  245. data/yard-0.9.44/lib/yard/templates/helpers/uml_helper.rb +47 -0
  246. data/yard-0.9.44/lib/yard/templates/section.rb +103 -0
  247. data/yard-0.9.44/lib/yard/templates/template.rb +420 -0
  248. data/yard-0.9.44/lib/yard/templates/template_options.rb +91 -0
  249. data/yard-0.9.44/lib/yard/verifier.rb +151 -0
  250. data/yard-0.9.44/lib/yard/version.rb +6 -0
  251. data/yard-0.9.44/lib/yard.rb +75 -0
  252. data/yard-0.9.44/po/ja.po +31108 -0
  253. data/yard-0.9.44/templates/default/class/dot/setup.rb +7 -0
  254. data/yard-0.9.44/templates/default/class/dot/superklass.erb +3 -0
  255. data/yard-0.9.44/templates/default/class/html/constructor_details.erb +8 -0
  256. data/yard-0.9.44/templates/default/class/html/setup.rb +2 -0
  257. data/yard-0.9.44/templates/default/class/html/subclasses.erb +4 -0
  258. data/yard-0.9.44/templates/default/class/setup.rb +36 -0
  259. data/yard-0.9.44/templates/default/class/text/setup.rb +12 -0
  260. data/yard-0.9.44/templates/default/class/text/subclasses.erb +5 -0
  261. data/yard-0.9.44/templates/default/constant/text/header.erb +11 -0
  262. data/yard-0.9.44/templates/default/constant/text/setup.rb +4 -0
  263. data/yard-0.9.44/templates/default/docstring/html/abstract.erb +4 -0
  264. data/yard-0.9.44/templates/default/docstring/html/deprecated.erb +1 -0
  265. data/yard-0.9.44/templates/default/docstring/html/index.erb +5 -0
  266. data/yard-0.9.44/templates/default/docstring/html/note.erb +6 -0
  267. data/yard-0.9.44/templates/default/docstring/html/private.erb +4 -0
  268. data/yard-0.9.44/templates/default/docstring/html/returns_void.erb +1 -0
  269. data/yard-0.9.44/templates/default/docstring/html/text.erb +1 -0
  270. data/yard-0.9.44/templates/default/docstring/html/todo.erb +6 -0
  271. data/yard-0.9.44/templates/default/docstring/setup.rb +52 -0
  272. data/yard-0.9.44/templates/default/docstring/text/abstract.erb +2 -0
  273. data/yard-0.9.44/templates/default/docstring/text/deprecated.erb +2 -0
  274. data/yard-0.9.44/templates/default/docstring/text/index.erb +2 -0
  275. data/yard-0.9.44/templates/default/docstring/text/note.erb +4 -0
  276. data/yard-0.9.44/templates/default/docstring/text/private.erb +2 -0
  277. data/yard-0.9.44/templates/default/docstring/text/returns_void.erb +1 -0
  278. data/yard-0.9.44/templates/default/docstring/text/text.erb +1 -0
  279. data/yard-0.9.44/templates/default/docstring/text/todo.erb +4 -0
  280. data/yard-0.9.44/templates/default/fulldoc/html/css/common.css +1 -0
  281. data/yard-0.9.44/templates/default/fulldoc/html/css/full_list.css +206 -0
  282. data/yard-0.9.44/templates/default/fulldoc/html/css/style.css +1089 -0
  283. data/yard-0.9.44/templates/default/fulldoc/html/frames.erb +22 -0
  284. data/yard-0.9.44/templates/default/fulldoc/html/full_list.erb +40 -0
  285. data/yard-0.9.44/templates/default/fulldoc/html/full_list_class.erb +2 -0
  286. data/yard-0.9.44/templates/default/fulldoc/html/full_list_file.erb +7 -0
  287. data/yard-0.9.44/templates/default/fulldoc/html/full_list_method.erb +10 -0
  288. data/yard-0.9.44/templates/default/fulldoc/html/js/app.js +801 -0
  289. data/yard-0.9.44/templates/default/fulldoc/html/js/full_list.js +334 -0
  290. data/yard-0.9.44/templates/default/fulldoc/html/js/jquery.js +4 -0
  291. data/yard-0.9.44/templates/default/fulldoc/html/setup.rb +249 -0
  292. data/yard-0.9.44/templates/default/layout/dot/header.erb +6 -0
  293. data/yard-0.9.44/templates/default/layout/dot/setup.rb +15 -0
  294. data/yard-0.9.44/templates/default/layout/html/breadcrumb.erb +11 -0
  295. data/yard-0.9.44/templates/default/layout/html/files.erb +11 -0
  296. data/yard-0.9.44/templates/default/layout/html/footer.erb +5 -0
  297. data/yard-0.9.44/templates/default/layout/html/headers.erb +15 -0
  298. data/yard-0.9.44/templates/default/layout/html/index.erb +2 -0
  299. data/yard-0.9.44/templates/default/layout/html/layout.erb +26 -0
  300. data/yard-0.9.44/templates/default/layout/html/listing.erb +4 -0
  301. data/yard-0.9.44/templates/default/layout/html/objects.erb +32 -0
  302. data/yard-0.9.44/templates/default/layout/html/script_setup.erb +4 -0
  303. data/yard-0.9.44/templates/default/layout/html/search.erb +13 -0
  304. data/yard-0.9.44/templates/default/layout/html/setup.rb +89 -0
  305. data/yard-0.9.44/templates/default/method/html/header.erb +17 -0
  306. data/yard-0.9.44/templates/default/method/setup.rb +4 -0
  307. data/yard-0.9.44/templates/default/method/text/header.erb +1 -0
  308. data/yard-0.9.44/templates/default/method_details/html/header.erb +3 -0
  309. data/yard-0.9.44/templates/default/method_details/html/method_signature.erb +25 -0
  310. data/yard-0.9.44/templates/default/method_details/html/source.erb +10 -0
  311. data/yard-0.9.44/templates/default/method_details/setup.rb +11 -0
  312. data/yard-0.9.44/templates/default/method_details/text/header.erb +10 -0
  313. data/yard-0.9.44/templates/default/method_details/text/method_signature.erb +12 -0
  314. data/yard-0.9.44/templates/default/method_details/text/setup.rb +11 -0
  315. data/yard-0.9.44/templates/default/module/dot/child.erb +1 -0
  316. data/yard-0.9.44/templates/default/module/dot/dependencies.erb +3 -0
  317. data/yard-0.9.44/templates/default/module/dot/header.erb +6 -0
  318. data/yard-0.9.44/templates/default/module/dot/info.erb +14 -0
  319. data/yard-0.9.44/templates/default/module/dot/setup.rb +15 -0
  320. data/yard-0.9.44/templates/default/module/html/attribute_details.erb +10 -0
  321. data/yard-0.9.44/templates/default/module/html/attribute_summary.erb +8 -0
  322. data/yard-0.9.44/templates/default/module/html/box_info.erb +43 -0
  323. data/yard-0.9.44/templates/default/module/html/children.erb +8 -0
  324. data/yard-0.9.44/templates/default/module/html/constant_summary.erb +17 -0
  325. data/yard-0.9.44/templates/default/module/html/defines.erb +3 -0
  326. data/yard-0.9.44/templates/default/module/html/header.erb +5 -0
  327. data/yard-0.9.44/templates/default/module/html/inherited_attributes.erb +14 -0
  328. data/yard-0.9.44/templates/default/module/html/inherited_constants.erb +8 -0
  329. data/yard-0.9.44/templates/default/module/html/inherited_methods.erb +20 -0
  330. data/yard-0.9.44/templates/default/module/html/item_summary.erb +40 -0
  331. data/yard-0.9.44/templates/default/module/html/method_details_list.erb +9 -0
  332. data/yard-0.9.44/templates/default/module/html/method_summary.erb +22 -0
  333. data/yard-0.9.44/templates/default/module/html/methodmissing.erb +12 -0
  334. data/yard-0.9.44/templates/default/module/html/pre_docstring.erb +1 -0
  335. data/yard-0.9.44/templates/default/module/setup.rb +187 -0
  336. data/yard-0.9.44/templates/default/module/text/children.erb +10 -0
  337. data/yard-0.9.44/templates/default/module/text/class_meths_list.erb +8 -0
  338. data/yard-0.9.44/templates/default/module/text/extends.erb +8 -0
  339. data/yard-0.9.44/templates/default/module/text/header.erb +7 -0
  340. data/yard-0.9.44/templates/default/module/text/includes.erb +8 -0
  341. data/yard-0.9.44/templates/default/module/text/instance_meths_list.erb +8 -0
  342. data/yard-0.9.44/templates/default/module/text/setup.rb +13 -0
  343. data/yard-0.9.44/templates/default/onefile/html/files.erb +5 -0
  344. data/yard-0.9.44/templates/default/onefile/html/headers.erb +8 -0
  345. data/yard-0.9.44/templates/default/onefile/html/layout.erb +16 -0
  346. data/yard-0.9.44/templates/default/onefile/html/readme.erb +3 -0
  347. data/yard-0.9.44/templates/default/onefile/html/setup.rb +62 -0
  348. data/yard-0.9.44/templates/default/root/dot/child.erb +3 -0
  349. data/yard-0.9.44/templates/default/root/dot/setup.rb +6 -0
  350. data/yard-0.9.44/templates/default/root/html/setup.rb +2 -0
  351. data/yard-0.9.44/templates/default/tags/html/example.erb +11 -0
  352. data/yard-0.9.44/templates/default/tags/html/index.erb +3 -0
  353. data/yard-0.9.44/templates/default/tags/html/option.erb +24 -0
  354. data/yard-0.9.44/templates/default/tags/html/overload.erb +14 -0
  355. data/yard-0.9.44/templates/default/tags/html/see.erb +8 -0
  356. data/yard-0.9.44/templates/default/tags/html/tag.erb +20 -0
  357. data/yard-0.9.44/templates/default/tags/setup.rb +57 -0
  358. data/yard-0.9.44/templates/default/tags/text/example.erb +12 -0
  359. data/yard-0.9.44/templates/default/tags/text/index.erb +1 -0
  360. data/yard-0.9.44/templates/default/tags/text/option.erb +20 -0
  361. data/yard-0.9.44/templates/default/tags/text/overload.erb +19 -0
  362. data/yard-0.9.44/templates/default/tags/text/see.erb +11 -0
  363. data/yard-0.9.44/templates/default/tags/text/tag.erb +13 -0
  364. data/yard-0.9.44/templates/guide/class/html/setup.rb +2 -0
  365. data/yard-0.9.44/templates/guide/docstring/html/setup.rb +2 -0
  366. data/yard-0.9.44/templates/guide/fulldoc/html/css/style.css +358 -0
  367. data/yard-0.9.44/templates/guide/fulldoc/html/js/app.js +61 -0
  368. data/yard-0.9.44/templates/guide/fulldoc/html/setup.rb +74 -0
  369. data/yard-0.9.44/templates/guide/layout/html/layout.erb +78 -0
  370. data/yard-0.9.44/templates/guide/layout/html/setup.rb +25 -0
  371. data/yard-0.9.44/templates/guide/method/html/header.erb +18 -0
  372. data/yard-0.9.44/templates/guide/method/html/setup.rb +22 -0
  373. data/yard-0.9.44/templates/guide/module/html/header.erb +7 -0
  374. data/yard-0.9.44/templates/guide/module/html/method_list.erb +5 -0
  375. data/yard-0.9.44/templates/guide/module/html/setup.rb +27 -0
  376. data/yard-0.9.44/templates/guide/onefile/html/files.erb +4 -0
  377. data/yard-0.9.44/templates/guide/onefile/html/setup.rb +6 -0
  378. data/yard-0.9.44/templates/guide/onefile/html/toc.erb +3 -0
  379. data/yard-0.9.44/templates/guide/tags/html/setup.rb +9 -0
  380. metadata +419 -0
@@ -0,0 +1,791 @@
1
+ # frozen_string_literal: true
2
+ require 'digest/sha1'
3
+ require 'fileutils'
4
+
5
+ module YARD
6
+ module CLI
7
+ # Default options used in +yard doc+ command.
8
+ class YardocOptions < Templates::TemplateOptions
9
+ # @return [Array<CodeObjects::ExtraFileObject>]
10
+ # the list of extra files rendered along with objects
11
+ default_attr :files, lambda { [] }
12
+
13
+ # @return [String] the default title appended to each generated page
14
+ default_attr :title, "Documentation by YARD #{YARD::VERSION}"
15
+
16
+ # @return [Verifier] the default verifier object to filter queries
17
+ default_attr :verifier, lambda { Verifier.new }
18
+
19
+ # @return [Serializers::Base] the default serializer for generating output
20
+ # to disk.
21
+ default_attr :serializer, lambda { Serializers::FileSystemSerializer.new }
22
+
23
+ # @return [Symbol] the default output format (:html).
24
+ default_attr :format, :html
25
+
26
+ # @return [Boolean] whether the data should be rendered in a single page,
27
+ # if the template supports it.
28
+ default_attr :onefile, false
29
+
30
+ # @return [CodeObjects::ExtraFileObject] the README file object rendered
31
+ # along with objects
32
+ attr_accessor :readme
33
+
34
+ # @return [Array<CodeObjects::Base>] the list of code objects to render
35
+ # the templates with.
36
+ attr_accessor :objects
37
+
38
+ # @return [Numeric] An index value for rendering sequentially related templates
39
+ attr_accessor :index
40
+
41
+ # @return [CodeObjects::Base] an extra item to send to a template that is not
42
+ # the main rendered object
43
+ attr_accessor :item
44
+
45
+ # @return [CodeObjects::ExtraFileObject] the file object being rendered.
46
+ # The +object+ key is not used so that a file may be rendered in the context
47
+ # of an object's namespace (for generating links).
48
+ attr_accessor :file
49
+
50
+ # @return [String] the current locale
51
+ attr_accessor :locale
52
+ end
53
+
54
+ # Yardoc is the default YARD CLI command (+yard doc+ and historic +yardoc+
55
+ # executable) used to generate and output (mainly) HTML documentation given
56
+ # a set of source files.
57
+ #
58
+ # == Usage
59
+ #
60
+ # Main usage for this command is:
61
+ #
62
+ # $ yardoc [options] [source_files [- extra_files]]
63
+ #
64
+ # See +yardoc --help+ for details on valid options.
65
+ #
66
+ # == Options File (+.yardopts+)
67
+ #
68
+ # If a +.yardopts+ file is found in the source directory being processed,
69
+ # YARD will use the contents of the file as arguments to the command,
70
+ # treating newlines as spaces. You can use shell-style quotations to
71
+ # group space delimited arguments, just like on the command line.
72
+ #
73
+ # A valid +.yardopts+ file might look like:
74
+ #
75
+ # --no-private
76
+ # --title "My Title"
77
+ # --exclude foo --exclude bar
78
+ # lib/**/*.erb
79
+ # lib/**/*.rb -
80
+ # HACKING.rdoc LEGAL COPYRIGHT
81
+ #
82
+ # Note that Yardoc also supports the legacy RDoc style +.document+ file,
83
+ # though this file can only specify source globs to parse, not options.
84
+ #
85
+ # == Queries (+--query+)
86
+ #
87
+ # Yardoc supports queries to select specific code objects for which to
88
+ # generate documentation. For example, you might want to generate
89
+ # documentation only for your public API. If you've documented your public
90
+ # methods with +@api public+, you can use the following query to select
91
+ # all of these objects:
92
+ #
93
+ # --query '@api.text == "public"'
94
+ #
95
+ # Note that the syntax for queries is mostly Ruby with a few syntactic
96
+ # simplifications for meta-data tags. See the {Verifier} class for an
97
+ # overview of this syntax.
98
+ #
99
+ # == Adding Custom Ad-Hoc Meta-data Tags (+--tag+)
100
+ #
101
+ # YARD allows specification of {file:docs/Tags.md meta-data tags}
102
+ # programmatically via the {YARD::Tags::Library} class, but often this is not
103
+ # practical for users writing documentation. To make adding custom tags
104
+ # easier, Yardoc has a few command-line switches for creating basic tags
105
+ # and displaying them in generated HTML output.
106
+ #
107
+ # To specify a custom tag to be displayed in output, use any of the
108
+ # following:
109
+ #
110
+ # * +--tag+ TAG:TITLE
111
+ # * +--name-tag+ TAG:TITLE
112
+ # * +--type-tag+ TAG:TITLE
113
+ # * +--type-name-tag+ TAG:TITLE
114
+ # * +--title-tag+ TAG:TITLE
115
+ #
116
+ # "TAG:TITLE" is of the form: name:"Display Title", for example:
117
+ #
118
+ # --tag overload:"Overloaded Method"
119
+ #
120
+ # See +yard help doc+ for a description of the various options.
121
+ #
122
+ # Tags added in this way are automatically displayed in output. To add
123
+ # a meta-data tag that does not show up in output, use +--hide-tag TAG+.
124
+ # Note that you can also use this option on existing tags to hide
125
+ # builtin tags, for instance.
126
+ #
127
+ # == Processed Data Storage (+.yardoc+ directory)
128
+ #
129
+ # When Yardoc parses a source directory, it creates a +.yardoc+ directory
130
+ # (by default, override with +-b+) at the root of the project. This directory
131
+ # contains marshal dumps for all raw object data in the source, so that
132
+ # you can access it later for various commands (+stats+, +graph+, etc.).
133
+ # This directory is also used as a cache for any future calls to +yardoc+
134
+ # so as to process only the files which have changed since the last call.
135
+ #
136
+ # When Yardoc uses the cache in subsequent calls to +yardoc+, methods
137
+ # or classes that have been deleted from source since the last parsing
138
+ # will not be erased from the cache (YARD never deletes objects). In such
139
+ # a case, you should wipe the cache and do a clean parsing of the source tree.
140
+ # You can do this by deleting the +.yardoc+ directory manually, or running
141
+ # Yardoc without +--use-cache+ (+-c+).
142
+ #
143
+ # @since 0.2.1
144
+ # @see Verifier
145
+ class Yardoc < YardoptsCommand
146
+ # @return [Hash] the hash of options passed to the template.
147
+ # @see Templates::Engine#render
148
+ attr_reader :options
149
+
150
+ # @return [Array<String>] list of Ruby source files to process
151
+ attr_accessor :files
152
+
153
+ # @return [Array<String>] list of excluded paths (regexp matches)
154
+ # @since 0.5.3
155
+ attr_accessor :excluded
156
+
157
+ # @return [Boolean] whether to use the existing yardoc db if the
158
+ # .yardoc already exists. Also makes use of file checksums to
159
+ # parse only changed files.
160
+ attr_accessor :use_cache
161
+
162
+ # @return [Boolean] whether objects should be serialized to .yardoc db
163
+ attr_accessor :save_yardoc
164
+
165
+ # @return [Boolean] whether to generate output
166
+ attr_accessor :generate
167
+
168
+ # @return [Boolean] whether to print a list of objects
169
+ # @since 0.5.5
170
+ attr_accessor :list
171
+
172
+ # Keep track of which visibilities are to be shown
173
+ # @return [Array<Symbol>] a list of visibilities
174
+ # @since 0.5.6
175
+ attr_accessor :visibilities
176
+
177
+ # Keep track of which APIs are to be shown
178
+ # @return [Array<String>] a list of APIs
179
+ # @since 0.8.1
180
+ attr_accessor :apis
181
+
182
+ # Keep track of which APIs are to be hidden
183
+ # @return [Array<String>] a list of APIs to be hidden
184
+ # @since 0.8.7
185
+ attr_accessor :hidden_apis
186
+
187
+ # @return [Array<Symbol>] a list of tags to hide from templates
188
+ # @since 0.6.0
189
+ attr_accessor :hidden_tags
190
+
191
+ # @return [Boolean] whether to print statistics after parsing
192
+ # @since 0.6.0
193
+ attr_accessor :statistics
194
+
195
+ # @return [Array<String>] a list of assets to copy after generation
196
+ # @since 0.6.0
197
+ attr_accessor :assets
198
+
199
+ # @return [Boolean] whether markup option was specified
200
+ # @since 0.7.0
201
+ attr_accessor :has_markup
202
+
203
+ # @return [Boolean] whether yard exits with error status code if a warning occurs
204
+ attr_accessor :fail_on_warning
205
+
206
+ # Creates a new instance of the commandline utility
207
+ def initialize
208
+ super
209
+ @options = YardocOptions.new
210
+ @options.reset_defaults
211
+ @visibilities = [:public]
212
+ @apis = []
213
+ @hidden_apis = []
214
+ @assets = {}
215
+ @excluded = []
216
+ @files = []
217
+ @hidden_tags = []
218
+ @use_cache = false
219
+ @generate = true
220
+ @statistics = true
221
+ @list = false
222
+ @save_yardoc = true
223
+ @has_markup = false
224
+ @fail_on_warning = false
225
+
226
+ if defined?(::Encoding) && ::Encoding.respond_to?(:default_external=)
227
+ utf8 = ::Encoding.find('utf-8')
228
+
229
+ ::Encoding.default_external = utf8 unless ::Encoding.default_external == utf8
230
+ ::Encoding.default_internal = utf8 unless ::Encoding.default_internal == utf8
231
+ end
232
+ end
233
+
234
+ def description
235
+ "Generates documentation"
236
+ end
237
+
238
+ # Runs the commandline utility, parsing arguments and generating
239
+ # output if set.
240
+ #
241
+ # @param [Array<String>] args the list of arguments. If the list only
242
+ # contains a single nil value, skip calling of {#parse_arguments}
243
+ # @return [void]
244
+ def run(*args)
245
+ log.show_progress = true
246
+ if args.empty? || !args.first.nil?
247
+ # fail early if arguments are not valid
248
+ return unless parse_arguments(*args)
249
+ end
250
+
251
+ checksums = nil
252
+ if use_cache
253
+ Registry.load
254
+ checksums = Registry.checksums.dup
255
+ end
256
+
257
+ if save_yardoc
258
+ Registry.lock_for_writing do
259
+ YARD.parse(files, excluded)
260
+ Registry.save(use_cache)
261
+ end
262
+ else
263
+ YARD.parse(files, excluded)
264
+ end
265
+
266
+ if generate
267
+ run_generate(checksums)
268
+ copy_assets
269
+ elsif list
270
+ print_list
271
+ end
272
+
273
+ if !list && statistics && log.level < Logger::ERROR
274
+ Registry.load_all
275
+ log.enter_level(Logger::ERROR) do
276
+ Stats.new(false).run(*args)
277
+ end
278
+ end
279
+
280
+ abort if fail_on_warning && log.warned
281
+
282
+ true
283
+ ensure
284
+ log.show_progress = false
285
+ end
286
+
287
+ # Parses commandline arguments
288
+ # @param [Array<String>] args the list of arguments
289
+ # @return [Boolean] whether or not arguments are valid
290
+ # @since 0.5.6
291
+ def parse_arguments(*args)
292
+ super(*args)
293
+
294
+ # Last minute modifications
295
+ self.files = Parser::SourceParser::DEFAULT_PATH_GLOB if files.empty?
296
+ files.delete_if {|x| x =~ /\A\s*\Z/ } # remove empty ones
297
+ readme = Dir.glob('README{,*[^~]}').
298
+ select {|f| extra_file_valid?(f)}.
299
+ sort_by {|r| [r.count('.'), r.index('.'), r] }.first
300
+ readme ||= Dir.glob(files.first).first if options.onefile && !files.empty?
301
+ options.readme ||= CodeObjects::ExtraFileObject.new(readme) if readme && extra_file_valid?(readme)
302
+ options.files.unshift(options.readme).uniq! if options.readme
303
+
304
+ Tags::Library.visible_tags -= hidden_tags
305
+ add_visibility_verifier
306
+ add_api_verifier
307
+
308
+ apply_locale
309
+
310
+ # US-ASCII is invalid encoding for onefile
311
+ if defined?(::Encoding) && options.onefile
312
+ if ::Encoding.default_internal == ::Encoding::US_ASCII
313
+ log.warn "--one-file is not compatible with US-ASCII encoding, using ASCII-8BIT"
314
+ ::Encoding.default_external, ::Encoding.default_internal = ['ascii-8bit'] * 2
315
+ end
316
+ end
317
+
318
+ if generate && !verify_markup_options
319
+ false
320
+ else
321
+ true
322
+ end
323
+ end
324
+
325
+ # The list of all objects to process. Override this method to change
326
+ # which objects YARD should generate documentation for.
327
+ #
328
+ # @deprecated To hide methods use the +@private+ tag instead.
329
+ # @return [Array<CodeObjects::Base>] a list of code objects to process
330
+ def all_objects
331
+ Registry.all(:root, :module, :class)
332
+ end
333
+
334
+ private
335
+
336
+ # Generates output for objects
337
+ # @param [Hash, nil] checksums if supplied, a list of checksums for files.
338
+ # @return [void]
339
+ # @since 0.5.1
340
+ def run_generate(checksums)
341
+ if checksums
342
+ changed_files = []
343
+ Registry.checksums.each do |file, hash|
344
+ changed_files << file if checksums[file] != hash
345
+ end
346
+ end
347
+ Registry.load_all if use_cache
348
+ objects = run_verifier(all_objects).reject do |object|
349
+ serialized = !options.serializer || options.serializer.exists?(object)
350
+ if checksums && serialized && !object.files.any? {|f, _line| changed_files.include?(f) }
351
+ true
352
+ else
353
+ log.debug "Re-generating object #{object.path}..."
354
+ false
355
+ end
356
+ end
357
+ Templates::Engine.generate(objects, options)
358
+ end
359
+
360
+ # Verifies that the markup options are valid before parsing any code.
361
+ # Failing early is better than failing late.
362
+ #
363
+ # @return (see YARD::Templates::Helpers::MarkupHelper#load_markup_provider)
364
+ def verify_markup_options
365
+ result = false
366
+ lvl = has_markup ? log.level : Logger::FATAL
367
+ obj = Struct.new(:options).new(options)
368
+ obj.extend(Templates::Helpers::MarkupHelper)
369
+ options.files.each do |file|
370
+ markup = file.attributes[:markup] || obj.markup_for_file('', file.filename)
371
+ result = obj.load_markup_provider(markup)
372
+ return false if !result && markup != :rdoc
373
+ end
374
+ options.markup = :rdoc unless has_markup
375
+ log.enter_level(lvl) { result = obj.load_markup_provider }
376
+ if !result && !has_markup
377
+ log.warn "Could not load default RDoc formatter, " \
378
+ "ignoring any markup (install RDoc to get default formatting)."
379
+ options.markup = :none
380
+ true
381
+ else
382
+ result
383
+ end
384
+ end
385
+
386
+ # Copies any assets to the output directory
387
+ # @return [void]
388
+ # @since 0.6.0
389
+ def copy_assets
390
+ return unless options.serializer
391
+ outpath = options.serializer.basepath
392
+ assets.each do |from, to|
393
+ to = File.join(outpath, to)
394
+ log.debug "Copying asset '#{from}' to '#{to}'"
395
+ from += '/.' if File.directory?(from)
396
+ FileUtils.cp_r(from, to)
397
+ end
398
+ end
399
+
400
+ # Prints a list of all objects
401
+ # @return [void]
402
+ # @since 0.5.5
403
+ def print_list
404
+ Registry.load_all
405
+ run_verifier(Registry.all).
406
+ sort_by {|item| [item.file || '', item.line || 0] }.each do |item|
407
+ log.puts "#{item.file}:#{item.line}: #{item.path}"
408
+ end
409
+ end
410
+
411
+ # Adds a set of extra documentation files to be processed
412
+ # @param [Array<String>] files the set of documentation files
413
+ def add_extra_files(*files)
414
+ files.map! {|f| f.include?("*") ? Dir.glob(f) : f }.flatten!
415
+ files.each do |file|
416
+ if extra_file_valid?(file)
417
+ options.files << CodeObjects::ExtraFileObject.new(file)
418
+ end
419
+ end
420
+ end
421
+
422
+ # @param file [String] the filename to validate
423
+ # @param check_exists [Boolean] whether the file should exist on disk
424
+ # @return [Boolean] whether the file is allowed to be used
425
+ def extra_file_valid?(file, check_exists = true)
426
+ if file =~ %r{^(?:\.\./|/)}
427
+ log.warn "Invalid file: #{file}"
428
+ false
429
+ elsif check_exists && !File.file?(file)
430
+ log.warn "Could not find file: #{file}"
431
+ false
432
+ else
433
+ true
434
+ end
435
+ end
436
+
437
+ # Parses the file arguments into Ruby files and extra files, which are
438
+ # separated by a '-' element.
439
+ #
440
+ # @example Parses a set of Ruby source files
441
+ # parse_files %w(file1 file2 file3)
442
+ # @example Parses a set of Ruby files with a separator and extra files
443
+ # parse_files %w(file1 file2 - extrafile1 extrafile2)
444
+ # @param [Array<String>] files the list of files to parse
445
+ # @return [void]
446
+ def parse_files(*files)
447
+ seen_extra_files_marker = false
448
+
449
+ files.each do |file|
450
+ if file == "-"
451
+ seen_extra_files_marker = true
452
+ next
453
+ end
454
+
455
+ if seen_extra_files_marker
456
+ add_extra_files(file)
457
+ else
458
+ self.files << file
459
+ end
460
+ end
461
+ end
462
+
463
+ # Adds verifier rule for visibilities
464
+ # @return [void]
465
+ # @since 0.5.6
466
+ def add_visibility_verifier
467
+ vis_expr = "#{visibilities.uniq.inspect}.include?(object.visibility)"
468
+ options.verifier.add_expressions(vis_expr)
469
+ end
470
+
471
+ # Adds verifier rule for APIs
472
+ # @return [void]
473
+ # @since 0.8.1
474
+ def add_api_verifier
475
+ no_api = true if apis.delete('')
476
+ exprs = []
477
+
478
+ exprs << "#{apis.uniq.inspect}.include?(@api.text)" unless apis.empty?
479
+
480
+ unless hidden_apis.empty?
481
+ exprs << "!#{hidden_apis.uniq.inspect}.include?(@api.text)"
482
+ end
483
+
484
+ exprs = !exprs.empty? ? [exprs.join(' && ')] : []
485
+ exprs << "!@api" if no_api
486
+
487
+ expr = exprs.join(' || ')
488
+ options.verifier.add_expressions(expr) unless expr.empty?
489
+ end
490
+
491
+ # Applies the specified locale to collected objects
492
+ # @return [void]
493
+ # @since 0.8.3
494
+ def apply_locale
495
+ YARD::I18n::Locale.default = options.locale
496
+ options.files.each do |file|
497
+ file.locale = options.locale
498
+ end
499
+ end
500
+
501
+ # (see Templates::Helpers::BaseHelper#run_verifier)
502
+ def run_verifier(list)
503
+ options.verifier ? options.verifier.run(list) : list
504
+ end
505
+
506
+ # @since 0.6.0
507
+ def add_tag(tag_data, factory_method = nil)
508
+ tag, title = *tag_data.split(':')
509
+ title ||= tag.capitalize
510
+ Tags::Library.define_tag(title, tag.to_sym, factory_method)
511
+ Tags::Library.visible_tags |= [tag.to_sym]
512
+ end
513
+
514
+ # Parses commandline options.
515
+ # @param [Array<String>] args each tokenized argument
516
+ def optparse(*args)
517
+ opts = OptionParser.new
518
+ opts.banner = "Usage: yard doc [options] [source_files [- extra_files]]"
519
+
520
+ opts.separator "(if a list of source files is omitted, "
521
+ opts.separator " {lib,app}/**/*.rb ext/**/*.{c,rb} is used.)"
522
+ opts.separator ""
523
+ opts.separator "Example: yardoc -o documentation/ - FAQ LICENSE"
524
+ opts.separator " The above example outputs documentation for files in"
525
+ opts.separator " lib/**/*.rb to documentation/ including the extra files"
526
+ opts.separator " FAQ and LICENSE."
527
+ opts.separator ""
528
+ opts.separator "A base set of options can be specified by adding a .yardopts"
529
+ opts.separator "file to your base path containing all extra options separated"
530
+ opts.separator "by whitespace."
531
+
532
+ general_options(opts)
533
+ output_options(opts)
534
+ tag_options(opts)
535
+ common_options(opts)
536
+ parse_options(opts, args)
537
+ parse_files(*args) unless args.empty?
538
+ end
539
+
540
+ # Adds general options
541
+ def general_options(opts)
542
+ opts.separator ""
543
+ opts.separator "General Options:"
544
+
545
+ opts.on('-b', '--db FILE', 'Use a specified .yardoc db to load from or save to',
546
+ ' (defaults to .yardoc)') do |yfile|
547
+ YARD::Registry.yardoc_file = yfile
548
+ end
549
+
550
+ opts.on('--[no-]single-db', 'Whether code objects should be stored to single',
551
+ ' database file (advanced)') do |use_single_db|
552
+ Registry.single_object_db = use_single_db
553
+ end
554
+
555
+ opts.on('-n', '--no-output', 'Only generate .yardoc database, no documentation.') do
556
+ self.generate = false
557
+ end
558
+
559
+ opts.on('-c', '--use-cache [FILE]',
560
+ "Use the cached .yardoc db to generate documentation.",
561
+ " (defaults to no cache)") do |file|
562
+ YARD::Registry.yardoc_file = file if file
563
+ self.use_cache = true
564
+ end
565
+
566
+ opts.on('--no-cache', "Clear .yardoc db before parsing source.") do
567
+ self.use_cache = false
568
+ end
569
+
570
+ yardopts_options(opts)
571
+
572
+ opts.on('--no-save', 'Do not save the parsed data to the yardoc db') do
573
+ self.save_yardoc = false
574
+ end
575
+
576
+ opts.on('--exclude REGEXP', 'Ignores a file if it matches path match (regexp)') do |path|
577
+ excluded << path
578
+ end
579
+
580
+ opts.on('--fail-on-warning', 'Exit with error status code if a warning occurs') do
581
+ self.fail_on_warning = true
582
+ end
583
+ end
584
+
585
+ # Adds output options
586
+ def output_options(opts)
587
+ opts.separator ""
588
+ opts.separator "Output options:"
589
+
590
+ opts.on('--one-file', 'Generates output as a single file') do
591
+ options.onefile = true
592
+ end
593
+
594
+ opts.on('--list', 'List objects to standard out (implies -n)') do |_format|
595
+ self.generate = false
596
+ self.list = true
597
+ end
598
+
599
+ opts.on('--no-public', "Don't show public methods. (default shows public)") do
600
+ visibilities.delete(:public)
601
+ end
602
+
603
+ opts.on('--protected', "Show protected methods. (default hides protected)") do
604
+ visibilities.push(:protected)
605
+ end
606
+
607
+ opts.on('--private', "Show private methods. (default hides private)") do
608
+ visibilities.push(:private)
609
+ end
610
+
611
+ opts.on('--no-private', "Hide objects with @private tag") do
612
+ options.verifier.add_expressions '!object.tag(:private) &&
613
+ (object.namespace.is_a?(CodeObjects::Proxy) || !object.namespace.tag(:private))'
614
+ end
615
+
616
+ opts.on('--[no-]api API', 'Generates documentation for a given API',
617
+ '(objects which define the correct @api tag).',
618
+ 'If --no-api is given, displays objects with',
619
+ 'no @api tag.') do |api|
620
+ api = '' if api == false
621
+ apis.push(api)
622
+ end
623
+
624
+ opts.on('--hide-api API', 'Hides given @api tag from documentation') do |api|
625
+ hidden_apis.push(api)
626
+ end
627
+
628
+ opts.on('--embed-mixins', "Embeds mixin methods into class documentation") do
629
+ options.embed_mixins << '*'
630
+ end
631
+
632
+ opts.on('--embed-mixin [MODULE]', "Embeds mixin methods from a particular",
633
+ " module into class documentation") do |mod|
634
+ options.embed_mixins << mod
635
+ end
636
+
637
+ opts.on('--no-highlight', "Don't highlight code blocks in output.") do
638
+ options.highlight = false
639
+ end
640
+
641
+ opts.on('--default-return TYPE', "Shown if method has no return type. ",
642
+ " (defaults to 'Object')") do |type|
643
+ options.default_return = type
644
+ end
645
+
646
+ opts.on('--hide-void-return', "Hides return types specified as 'void'. ",
647
+ " (default is shown)") do
648
+ options.hide_void_return = true
649
+ end
650
+
651
+ opts.on('--query QUERY', "Only show objects that match a specific query") do |query|
652
+ next if YARD::Config.options[:safe_mode]
653
+ query.taint if query.respond_to?(:taint)
654
+ options.verifier.add_expressions(query)
655
+ end
656
+
657
+ opts.on('--title TITLE', 'Add a specific title to HTML documents') do |title|
658
+ options.title = title
659
+ end
660
+
661
+ opts.on('-r', '--readme FILE', '--main FILE', 'The readme file used as the title page',
662
+ ' of documentation.') do |readme|
663
+ if extra_file_valid?(readme)
664
+ options.readme = CodeObjects::ExtraFileObject.new(readme)
665
+ end
666
+ end
667
+
668
+ opts.on('--files FILE1,FILE2,...', 'Any extra comma separated static files to be ',
669
+ ' included (eg. FAQ)') do |files|
670
+ add_extra_files(*files.split(","))
671
+ end
672
+
673
+ opts.on('--asset FROM[:TO]', 'A file or directory to copy over to output ',
674
+ ' directory after generating') do |asset|
675
+ from, to = *asset.split(':').map {|f| File.cleanpath(f, true) }
676
+ to ||= from
677
+ if extra_file_valid?(from, false) && extra_file_valid?(to, false)
678
+ assets[from] = to
679
+ end
680
+ end
681
+
682
+ opts.on('-o', '--output-dir PATH',
683
+ 'The output directory. (defaults to ./doc)') do |dir|
684
+ options.serializer.basepath = dir
685
+ end
686
+
687
+ opts.on('-m', '--markup MARKUP',
688
+ 'Markup style used in documentation, like textile, ',
689
+ ' markdown or rdoc. (defaults to rdoc)') do |markup|
690
+ self.has_markup = true
691
+ options.markup = markup.to_sym
692
+ end
693
+
694
+ opts.on('-M', '--markup-provider MARKUP_PROVIDER',
695
+ 'Overrides the library used to process markup ',
696
+ ' formatting (specify the gem name)') do |markup_provider|
697
+ options.markup_provider = markup_provider.to_sym
698
+ end
699
+
700
+ opts.on('--charset ENC', 'Character set to use when parsing files ',
701
+ ' (default is system locale)') do |encoding|
702
+ begin
703
+ if defined?(Encoding) && Encoding.respond_to?(:default_external=)
704
+ Encoding.default_external = encoding
705
+ Encoding.default_internal = encoding
706
+ end
707
+ rescue ArgumentError => e
708
+ raise OptionParser::InvalidOption, e
709
+ end
710
+ end
711
+
712
+ opts.on('-t', '--template TEMPLATE',
713
+ 'The template to use. (defaults to "default")') do |template|
714
+ options.template = template.to_sym
715
+ end
716
+
717
+ opts.on('-p', '--template-path PATH',
718
+ 'The template path to look for templates in.',
719
+ ' (used with -t).') do |path|
720
+ next if YARD::Config.options[:safe_mode]
721
+ YARD::Templates::Engine.register_template_path(File.expand_path(path))
722
+ end
723
+
724
+ opts.on('-f', '--format FORMAT',
725
+ 'The output format for the template.',
726
+ ' (defaults to html)') do |format|
727
+ options.format = format.to_sym
728
+ end
729
+
730
+ opts.on('--no-stats', 'Don\'t print statistics') do
731
+ self.statistics = false
732
+ end
733
+
734
+ opts.on('--no-progress', 'Don\'t show progress bar') do
735
+ log.show_progress = false
736
+ end
737
+
738
+ opts.on('--locale LOCALE',
739
+ 'The locale for generated documentation.',
740
+ ' (defaults to en)') do |locale|
741
+ options.locale = locale
742
+ end
743
+
744
+ opts.on('--po-dir DIR',
745
+ 'The directory that has .po files.',
746
+ " (defaults to #{YARD::Registry.po_dir})") do |dir|
747
+ YARD::Registry.po_dir = dir
748
+ end
749
+ end
750
+
751
+ # Adds tag options
752
+ # @since 0.6.0
753
+ def tag_options(opts)
754
+ opts.separator ""
755
+ opts.separator "Tag options: (TAG:TITLE looks like: 'overload:Overloaded Method')"
756
+
757
+ opts.on('--tag TAG:TITLE', 'Registers a new free-form metadata @tag') do |tag|
758
+ add_tag(tag)
759
+ end
760
+
761
+ opts.on('--type-tag TAG:TITLE', 'Tag with an optional types field') do |tag|
762
+ add_tag(tag, :with_types)
763
+ end
764
+
765
+ opts.on('--type-name-tag TAG:TITLE', 'Tag with optional types and a name field') do |tag|
766
+ add_tag(tag, :with_types_and_name)
767
+ end
768
+
769
+ opts.on('--name-tag TAG:TITLE', 'Tag with a name field') do |tag|
770
+ add_tag(tag, :with_name)
771
+ end
772
+
773
+ opts.on('--title-tag TAG:TITLE', 'Tag with first line as title field') do |tag|
774
+ add_tag(tag, :with_title_and_text)
775
+ end
776
+
777
+ opts.on('--hide-tag TAG', 'Hides a previously defined tag from templates') do |tag|
778
+ self.hidden_tags |= [tag.to_sym]
779
+ end
780
+
781
+ opts.on('--transitive-tag TAG', 'Marks a tag as transitive') do |tag|
782
+ Tags::Library.transitive_tags |= [tag.to_sym]
783
+ end
784
+
785
+ opts.on('--non-transitive-tag TAG', 'Marks a tag as not transitive') do |tag|
786
+ Tags::Library.transitive_tags -= [tag.to_sym]
787
+ end
788
+ end
789
+ end
790
+ end
791
+ end