super-quick-rb 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 (218) hide show
  1. checksums.yaml +7 -0
  2. data/rdoc-8.0.0/CONTRIBUTING.md +195 -0
  3. data/rdoc-8.0.0/CVE-2013-0256.rdoc +49 -0
  4. data/rdoc-8.0.0/History.rdoc +1668 -0
  5. data/rdoc-8.0.0/LEGAL.rdoc +56 -0
  6. data/rdoc-8.0.0/LICENSE.rdoc +63 -0
  7. data/rdoc-8.0.0/README.md +236 -0
  8. data/rdoc-8.0.0/RI.md +842 -0
  9. data/rdoc-8.0.0/TODO.rdoc +60 -0
  10. data/rdoc-8.0.0/doc/markup_reference/markdown.md +659 -0
  11. data/rdoc-8.0.0/doc/markup_reference/rdoc.rdoc +1169 -0
  12. data/rdoc-8.0.0/exe/rdoc +43 -0
  13. data/rdoc-8.0.0/exe/ri +12 -0
  14. data/rdoc-8.0.0/lib/rdoc/code_object/alias.rb +98 -0
  15. data/rdoc-8.0.0/lib/rdoc/code_object/any_method.rb +387 -0
  16. data/rdoc-8.0.0/lib/rdoc/code_object/attr.rb +178 -0
  17. data/rdoc-8.0.0/lib/rdoc/code_object/class_module.rb +969 -0
  18. data/rdoc-8.0.0/lib/rdoc/code_object/constant.rb +221 -0
  19. data/rdoc-8.0.0/lib/rdoc/code_object/context/section.rb +182 -0
  20. data/rdoc-8.0.0/lib/rdoc/code_object/context.rb +1238 -0
  21. data/rdoc-8.0.0/lib/rdoc/code_object/extend.rb +9 -0
  22. data/rdoc-8.0.0/lib/rdoc/code_object/include.rb +9 -0
  23. data/rdoc-8.0.0/lib/rdoc/code_object/method_attr.rb +417 -0
  24. data/rdoc-8.0.0/lib/rdoc/code_object/mixin.rb +123 -0
  25. data/rdoc-8.0.0/lib/rdoc/code_object/normal_class.rb +92 -0
  26. data/rdoc-8.0.0/lib/rdoc/code_object/normal_module.rb +73 -0
  27. data/rdoc-8.0.0/lib/rdoc/code_object/require.rb +51 -0
  28. data/rdoc-8.0.0/lib/rdoc/code_object/single_class.rb +30 -0
  29. data/rdoc-8.0.0/lib/rdoc/code_object/top_level.rb +286 -0
  30. data/rdoc-8.0.0/lib/rdoc/code_object.rb +393 -0
  31. data/rdoc-8.0.0/lib/rdoc/code_objects.rb +5 -0
  32. data/rdoc-8.0.0/lib/rdoc/comment.rb +353 -0
  33. data/rdoc-8.0.0/lib/rdoc/cross_reference.rb +215 -0
  34. data/rdoc-8.0.0/lib/rdoc/encoding.rb +120 -0
  35. data/rdoc-8.0.0/lib/rdoc/erb_partial.rb +18 -0
  36. data/rdoc-8.0.0/lib/rdoc/erbio.rb +37 -0
  37. data/rdoc-8.0.0/lib/rdoc/generator/aliki.rb +200 -0
  38. data/rdoc-8.0.0/lib/rdoc/generator/darkfish.rb +824 -0
  39. data/rdoc-8.0.0/lib/rdoc/generator/json_index.rb +284 -0
  40. data/rdoc-8.0.0/lib/rdoc/generator/markup.rb +196 -0
  41. data/rdoc-8.0.0/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  42. data/rdoc-8.0.0/lib/rdoc/generator/pot/po.rb +84 -0
  43. data/rdoc-8.0.0/lib/rdoc/generator/pot/po_entry.rb +141 -0
  44. data/rdoc-8.0.0/lib/rdoc/generator/pot.rb +94 -0
  45. data/rdoc-8.0.0/lib/rdoc/generator/ri.rb +30 -0
  46. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  47. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  48. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  49. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  50. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  51. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  52. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  53. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  54. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  55. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  56. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  57. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  58. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  59. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  60. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  61. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  62. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  63. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  64. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  65. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  66. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  67. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  68. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  69. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  70. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  71. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  72. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  73. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  74. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  75. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  76. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_head.rhtml +43 -0
  77. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +5 -0
  78. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +17 -0
  79. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +17 -0
  80. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +16 -0
  81. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +21 -0
  82. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
  83. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +32 -0
  84. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +6 -0
  85. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +15 -0
  86. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
  87. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +39 -0
  88. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  89. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/class.rhtml +220 -0
  90. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
  91. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/rdoc.css +701 -0
  92. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  93. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  94. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  95. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  96. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  97. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  98. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  99. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  100. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  101. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  102. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  103. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  104. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  105. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  106. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  107. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  108. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  109. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  110. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  111. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  112. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  113. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  114. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  115. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  116. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  117. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  118. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  119. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  120. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  121. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  122. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  123. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/index.rhtml +24 -0
  124. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/darkfish.js +140 -0
  125. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/search.js +120 -0
  126. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/page.rhtml +19 -0
  127. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +21 -0
  128. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +65 -0
  129. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +72 -0
  130. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
  131. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/searcher.js +271 -0
  132. data/rdoc-8.0.0/lib/rdoc/generator.rb +52 -0
  133. data/rdoc-8.0.0/lib/rdoc/i18n/locale.rb +102 -0
  134. data/rdoc-8.0.0/lib/rdoc/i18n/text.rb +126 -0
  135. data/rdoc-8.0.0/lib/rdoc/i18n.rb +10 -0
  136. data/rdoc-8.0.0/lib/rdoc/known_classes.rb +74 -0
  137. data/rdoc-8.0.0/lib/rdoc/markdown/entities.rb +2131 -0
  138. data/rdoc-8.0.0/lib/rdoc/markdown/literals.kpeg +21 -0
  139. data/rdoc-8.0.0/lib/rdoc/markdown/literals.rb +454 -0
  140. data/rdoc-8.0.0/lib/rdoc/markdown.kpeg +1315 -0
  141. data/rdoc-8.0.0/lib/rdoc/markdown.rb +16865 -0
  142. data/rdoc-8.0.0/lib/rdoc/markup/blank_line.rb +29 -0
  143. data/rdoc-8.0.0/lib/rdoc/markup/block_quote.rb +14 -0
  144. data/rdoc-8.0.0/lib/rdoc/markup/document.rb +164 -0
  145. data/rdoc-8.0.0/lib/rdoc/markup/element.rb +21 -0
  146. data/rdoc-8.0.0/lib/rdoc/markup/formatter.rb +285 -0
  147. data/rdoc-8.0.0/lib/rdoc/markup/hard_break.rb +34 -0
  148. data/rdoc-8.0.0/lib/rdoc/markup/heading.rb +170 -0
  149. data/rdoc-8.0.0/lib/rdoc/markup/include.rb +42 -0
  150. data/rdoc-8.0.0/lib/rdoc/markup/indented_paragraph.rb +47 -0
  151. data/rdoc-8.0.0/lib/rdoc/markup/inline_parser.rb +312 -0
  152. data/rdoc-8.0.0/lib/rdoc/markup/list.rb +101 -0
  153. data/rdoc-8.0.0/lib/rdoc/markup/list_item.rb +99 -0
  154. data/rdoc-8.0.0/lib/rdoc/markup/paragraph.rb +28 -0
  155. data/rdoc-8.0.0/lib/rdoc/markup/parser.rb +585 -0
  156. data/rdoc-8.0.0/lib/rdoc/markup/pre_process.rb +317 -0
  157. data/rdoc-8.0.0/lib/rdoc/markup/raw.rb +66 -0
  158. data/rdoc-8.0.0/lib/rdoc/markup/rule.rb +20 -0
  159. data/rdoc-8.0.0/lib/rdoc/markup/table.rb +64 -0
  160. data/rdoc-8.0.0/lib/rdoc/markup/to_ansi.rb +144 -0
  161. data/rdoc-8.0.0/lib/rdoc/markup/to_bs.rb +86 -0
  162. data/rdoc-8.0.0/lib/rdoc/markup/to_html.rb +682 -0
  163. data/rdoc-8.0.0/lib/rdoc/markup/to_html_crossref.rb +261 -0
  164. data/rdoc-8.0.0/lib/rdoc/markup/to_html_snippet.rb +287 -0
  165. data/rdoc-8.0.0/lib/rdoc/markup/to_joined_paragraph.rb +41 -0
  166. data/rdoc-8.0.0/lib/rdoc/markup/to_label.rb +84 -0
  167. data/rdoc-8.0.0/lib/rdoc/markup/to_markdown.rb +215 -0
  168. data/rdoc-8.0.0/lib/rdoc/markup/to_rdoc.rb +421 -0
  169. data/rdoc-8.0.0/lib/rdoc/markup/to_table_of_contents.rb +88 -0
  170. data/rdoc-8.0.0/lib/rdoc/markup/to_test.rb +77 -0
  171. data/rdoc-8.0.0/lib/rdoc/markup/to_tt_only.rb +107 -0
  172. data/rdoc-8.0.0/lib/rdoc/markup/verbatim.rb +83 -0
  173. data/rdoc-8.0.0/lib/rdoc/markup.rb +219 -0
  174. data/rdoc-8.0.0/lib/rdoc/options.rb +1412 -0
  175. data/rdoc-8.0.0/lib/rdoc/parser/c.rb +1227 -0
  176. data/rdoc-8.0.0/lib/rdoc/parser/changelog.rb +379 -0
  177. data/rdoc-8.0.0/lib/rdoc/parser/markdown.rb +22 -0
  178. data/rdoc-8.0.0/lib/rdoc/parser/rbs.rb +275 -0
  179. data/rdoc-8.0.0/lib/rdoc/parser/rd.rb +22 -0
  180. data/rdoc-8.0.0/lib/rdoc/parser/ruby.rb +1266 -0
  181. data/rdoc-8.0.0/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  182. data/rdoc-8.0.0/lib/rdoc/parser/simple.rb +44 -0
  183. data/rdoc-8.0.0/lib/rdoc/parser/text.rb +11 -0
  184. data/rdoc-8.0.0/lib/rdoc/parser.rb +298 -0
  185. data/rdoc-8.0.0/lib/rdoc/rbs_helper.rb +186 -0
  186. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.rb +1706 -0
  187. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.ry +643 -0
  188. data/rdoc-8.0.0/lib/rdoc/rd/inline.rb +71 -0
  189. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.rb +1854 -0
  190. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.ry +593 -0
  191. data/rdoc-8.0.0/lib/rdoc/rd.rb +99 -0
  192. data/rdoc-8.0.0/lib/rdoc/rdoc.rb +724 -0
  193. data/rdoc-8.0.0/lib/rdoc/ri/driver.rb +1572 -0
  194. data/rdoc-8.0.0/lib/rdoc/ri/formatter.rb +6 -0
  195. data/rdoc-8.0.0/lib/rdoc/ri/paths.rb +171 -0
  196. data/rdoc-8.0.0/lib/rdoc/ri/servlet.rb +452 -0
  197. data/rdoc-8.0.0/lib/rdoc/ri/store.rb +6 -0
  198. data/rdoc-8.0.0/lib/rdoc/ri/task.rb +71 -0
  199. data/rdoc-8.0.0/lib/rdoc/ri.rb +21 -0
  200. data/rdoc-8.0.0/lib/rdoc/rubygems_hook.rb +327 -0
  201. data/rdoc-8.0.0/lib/rdoc/server.rb +460 -0
  202. data/rdoc-8.0.0/lib/rdoc/stats/normal.rb +58 -0
  203. data/rdoc-8.0.0/lib/rdoc/stats/quiet.rb +59 -0
  204. data/rdoc-8.0.0/lib/rdoc/stats/verbose.rb +44 -0
  205. data/rdoc-8.0.0/lib/rdoc/stats.rb +484 -0
  206. data/rdoc-8.0.0/lib/rdoc/store.rb +1205 -0
  207. data/rdoc-8.0.0/lib/rdoc/task.rb +355 -0
  208. data/rdoc-8.0.0/lib/rdoc/text.rb +244 -0
  209. data/rdoc-8.0.0/lib/rdoc/token_stream.rb +104 -0
  210. data/rdoc-8.0.0/lib/rdoc/tom_doc.rb +257 -0
  211. data/rdoc-8.0.0/lib/rdoc/version.rb +10 -0
  212. data/rdoc-8.0.0/lib/rdoc.rb +239 -0
  213. data/rdoc-8.0.0/lib/rubygems_plugin.rb +14 -0
  214. data/rdoc-8.0.0/man/ri.1 +249 -0
  215. data/rdoc-8.0.0/rdoc-logo.svg +43 -0
  216. data/rdoc-8.0.0/rdoc.gemspec +74 -0
  217. data/super-quick-rb.gemspec +12 -0
  218. metadata +257 -0
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # For RubyGems backwards compatibility
4
+
5
+ module RDoc::RI::Formatter # :nodoc:
6
+ end
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+ require_relative '../rdoc'
3
+
4
+ ##
5
+ # The directories where ri data lives. Paths can be enumerated via ::each, or
6
+ # queried individually via ::system_dir, ::site_dir, ::home_dir and ::gem_dir.
7
+
8
+ module RDoc::RI::Paths
9
+
10
+ #:stopdoc:
11
+ require 'rbconfig'
12
+
13
+ version = RbConfig::CONFIG['ruby_version']
14
+
15
+ BASE = File.join RbConfig::CONFIG['ridir'], version
16
+
17
+ HOMEDIR = RDoc.home
18
+ #:startdoc:
19
+
20
+ ##
21
+ # Iterates over each selected path yielding the directory and type.
22
+ #
23
+ # Yielded types:
24
+ # :system:: Where Ruby's ri data is stored. Yielded when +system+ is
25
+ # true
26
+ # :site:: Where ri for installed libraries are stored. Yielded when
27
+ # +site+ is true. Normally no ri data is stored here.
28
+ # :home:: ~/.rdoc. Yielded when +home+ is true.
29
+ # :gem:: ri data for an installed gem. Yielded when +gems+ is true.
30
+ # :extra:: ri data directory from the command line. Yielded for each
31
+ # entry in +extra_dirs+
32
+
33
+ def self.each(system = true, site = true, home = true, gems = :latest, *extra_dirs) # :yields: directory, type
34
+ return enum_for __method__, system, site, home, gems, *extra_dirs unless
35
+ block_given?
36
+
37
+ extra_dirs.each do |dir|
38
+ yield dir, :extra
39
+ end
40
+
41
+ yield system_dir, :system if system
42
+ yield site_dir, :site if site
43
+ yield home_dir, :home if home and HOMEDIR
44
+
45
+ gemdirs(gems).each do |dir|
46
+ yield dir, :gem
47
+ end if gems
48
+
49
+ nil
50
+ end
51
+
52
+ ##
53
+ # The ri directory for the gem with +gem_name+.
54
+
55
+ def self.gem_dir(name, version)
56
+ req = Gem::Requirement.new "= #{version}"
57
+
58
+ spec = Gem::Specification.find_by_name name, req
59
+
60
+ File.join spec.doc_dir, 'ri'
61
+ end
62
+
63
+ ##
64
+ # The latest installed gems' ri directories. +filter+ can be :all or
65
+ # :latest.
66
+ #
67
+ # A +filter+ :all includes all versions of gems and includes gems without
68
+ # ri documentation.
69
+
70
+ def self.gemdirs(filter = :latest)
71
+ ri_paths = {}
72
+
73
+ all = Gem::Specification.map do |spec|
74
+ [File.join(spec.doc_dir, 'ri'), spec.name, spec.version]
75
+ end
76
+
77
+ if filter == :all then
78
+ gemdirs = []
79
+
80
+ all.group_by do |_, name, _|
81
+ name
82
+ end.sort_by do |group, _|
83
+ group
84
+ end.map do |group, items|
85
+ items.sort_by do |_, _, version|
86
+ version
87
+ end.reverse_each do |dir,|
88
+ gemdirs << dir
89
+ end
90
+ end
91
+
92
+ return gemdirs
93
+ end
94
+
95
+ all.each do |dir, name, ver|
96
+ next unless File.exist? dir
97
+
98
+ if ri_paths[name].nil? or ver > ri_paths[name].first then
99
+ ri_paths[name] = [ver, name, dir]
100
+ end
101
+ end
102
+
103
+ ri_paths.sort_by { |_, (_, name, _)| name }.map { |k, v| v.last }
104
+ rescue LoadError
105
+ []
106
+ end
107
+
108
+ ##
109
+ # The location of the rdoc data in the user's home directory.
110
+ #
111
+ # Like ::system, ri data in the user's home directory is rare and predates
112
+ # libraries distributed via RubyGems. ri data is rarely generated into this
113
+ # directory.
114
+
115
+ def self.home_dir
116
+ HOMEDIR
117
+ end
118
+
119
+ ##
120
+ # Returns existing directories from the selected documentation directories
121
+ # as an Array.
122
+ #
123
+ # See also ::each
124
+
125
+ def self.path(system = true, site = true, home = true, gems = :latest, *extra_dirs)
126
+ path = raw_path system, site, home, gems, *extra_dirs
127
+
128
+ path.select { |directory| File.directory? directory }
129
+ end
130
+
131
+ ##
132
+ # Returns selected documentation directories including nonexistent
133
+ # directories.
134
+ #
135
+ # See also ::each
136
+
137
+ def self.raw_path(system, site, home, gems, *extra_dirs)
138
+ path = []
139
+
140
+ each(system, site, home, gems, *extra_dirs) do |dir, type|
141
+ path << dir
142
+ end
143
+
144
+ path.compact
145
+ end
146
+
147
+ ##
148
+ # The location of ri data installed into the site dir.
149
+ #
150
+ # Historically this was available for documentation installed by Ruby
151
+ # libraries predating RubyGems. It is unlikely to contain any content for
152
+ # modern Ruby installations.
153
+
154
+ def self.site_dir
155
+ File.join BASE, 'site'
156
+ end
157
+
158
+ ##
159
+ # The location of the built-in ri data.
160
+ #
161
+ # This data is built automatically when `make` is run when Ruby is
162
+ # installed. If you did not install Ruby by hand you may need to install
163
+ # the documentation yourself. Please consult the documentation for your
164
+ # package manager or Ruby installer for details. You can also use the
165
+ # rdoc-data gem to install system ri data for common versions of Ruby.
166
+
167
+ def self.system_dir
168
+ File.join BASE, 'system'
169
+ end
170
+
171
+ end
@@ -0,0 +1,452 @@
1
+ # frozen_string_literal: true
2
+ require_relative '../../rdoc'
3
+ require 'erb'
4
+ require 'time'
5
+ require 'json'
6
+
7
+ begin
8
+ require 'webrick'
9
+ rescue LoadError
10
+ abort "webrick is not found. You may need to `gem install webrick` to install webrick."
11
+ end
12
+
13
+ ##
14
+ # This is a WEBrick servlet that allows you to browse ri documentation.
15
+ #
16
+ # You can show documentation through either `ri --server` or, with RubyGems
17
+ # 2.0 or newer, `gem server`. For ri, the server runs on port 8214 by
18
+ # default. For RubyGems the server runs on port 8808 by default.
19
+ #
20
+ # You can use this servlet in your own project by mounting it on a WEBrick
21
+ # server:
22
+ #
23
+ # require 'webrick'
24
+ #
25
+ # server = WEBrick::HTTPServer.new Port: 8000
26
+ #
27
+ # server.mount '/', RDoc::RI::Servlet
28
+ #
29
+ # If you want to mount the servlet some other place than the root, provide the
30
+ # base path when mounting:
31
+ #
32
+ # server.mount '/rdoc', RDoc::RI::Servlet, '/rdoc'
33
+
34
+ class RDoc::RI::Servlet < WEBrick::HTTPServlet::AbstractServlet
35
+
36
+ @server_stores = Hash.new { |hash, server| hash[server] = {} }
37
+ @cache = Hash.new { |hash, store| hash[store] = {} }
38
+
39
+ ##
40
+ # Maps an asset type to its path on the filesystem
41
+
42
+ attr_reader :asset_dirs
43
+
44
+ ##
45
+ # An RDoc::Options instance used for rendering options
46
+
47
+ attr_reader :options
48
+
49
+ ##
50
+ # Creates an instance of this servlet that shares cached data between
51
+ # requests.
52
+
53
+ def self.get_instance(server, *options) # :nodoc:
54
+ stores = @server_stores[server]
55
+
56
+ new server, stores, @cache, *options
57
+ end
58
+
59
+ ##
60
+ # Creates a new WEBrick servlet.
61
+ #
62
+ # Use +mount_path+ when mounting the servlet somewhere other than /.
63
+ #
64
+ # Use +extra_doc_dirs+ for additional documentation directories.
65
+ #
66
+ # +server+ is provided automatically by WEBrick when mounting. +stores+ and
67
+ # +cache+ are provided automatically by the servlet.
68
+
69
+ def initialize(server, stores, cache, mount_path = nil, extra_doc_dirs = [])
70
+ super server
71
+
72
+ @cache = cache
73
+ @mount_path = mount_path
74
+ @extra_doc_dirs = extra_doc_dirs
75
+ @stores = stores
76
+
77
+ @options = RDoc::Options.new
78
+ @options.op_dir = '.'
79
+
80
+ darkfish_dir = nil
81
+
82
+ # HACK dup
83
+ $LOAD_PATH.each do |path|
84
+ darkfish_dir = File.join path, 'rdoc/generator/template/darkfish/'
85
+ next unless File.directory? darkfish_dir
86
+ @options.template_dir = darkfish_dir
87
+ break
88
+ end
89
+
90
+ @asset_dirs = {
91
+ :darkfish => darkfish_dir,
92
+ :json_index =>
93
+ File.expand_path('../generator/template/json_index/', __FILE__),
94
+ }
95
+ end
96
+
97
+ ##
98
+ # Serves the asset at the path in +req+ for +generator_name+ via +res+.
99
+
100
+ def asset(generator_name, req, res)
101
+ asset_dir = @asset_dirs[generator_name]
102
+
103
+ asset_path = File.join asset_dir, req.path
104
+
105
+ if_modified_since req, res, asset_path
106
+
107
+ res.body = File.read asset_path
108
+
109
+ res.content_type = case req.path
110
+ when /\.css\z/ then 'text/css'
111
+ when /\.js\z/ then 'application/javascript'
112
+ else 'application/octet-stream'
113
+ end
114
+ end
115
+
116
+ ##
117
+ # GET request entry point. Fills in +res+ for the path, etc. in +req+.
118
+
119
+ def do_GET(req, res)
120
+ req.path.sub!(/\A#{Regexp.escape @mount_path}/, '') if @mount_path
121
+
122
+ case req.path
123
+ when '/' then
124
+ root req, res
125
+ when '/js/darkfish.js', '/js/jquery.js', '/js/search.js',
126
+ %r%^/css/%, %r%^/images/%, %r%^/fonts/% then
127
+ asset :darkfish, req, res
128
+ when '/js/navigation.js', '/js/searcher.js' then
129
+ asset :json_index, req, res
130
+ when '/js/search_index.js' then
131
+ root_search req, res
132
+ else
133
+ show_documentation req, res
134
+ end
135
+ rescue WEBrick::HTTPStatus::NotFound => e
136
+ generator = generator_for RDoc::Store.new(@options)
137
+
138
+ not_found generator, req, res, e.message
139
+ rescue WEBrick::HTTPStatus::Status
140
+ raise
141
+ rescue => e
142
+ error e, req, res
143
+ end
144
+
145
+ ##
146
+ # Fills in +res+ with the class, module or page for +req+ from +store+.
147
+ #
148
+ # +path+ is relative to the mount_path and is used to determine the class,
149
+ # module or page name (/RDoc/Servlet.html becomes RDoc::Servlet).
150
+ # +generator+ is used to create the page.
151
+
152
+ def documentation_page(store, generator, path, req, res)
153
+ text_name = path.chomp '.html'
154
+ name = text_name.gsub '/', '::'
155
+
156
+ if klass = store.find_class_or_module(name) then
157
+ res.body = generator.generate_class klass
158
+ elsif page = store.find_text_page(name.sub(/_([^_]*)\z/, '.\1')) then
159
+ res.body = generator.generate_page page
160
+ elsif page = store.find_text_page(text_name.sub(/_([^_]*)\z/, '.\1')) then
161
+ res.body = generator.generate_page page
162
+ else
163
+ not_found generator, req, res
164
+ end
165
+ end
166
+
167
+ ##
168
+ # Creates the JSON search index on +res+ for the given +store+. +generator+
169
+ # must respond to \#json_index to build. +req+ is ignored.
170
+
171
+ def documentation_search(store, generator, req, res)
172
+ json_index = @cache[store].fetch :json_index do
173
+ @cache[store][:json_index] =
174
+ JSON.dump generator.json_index.build_index
175
+ end
176
+
177
+ res.content_type = 'application/javascript'
178
+ res.body = "var search_data = #{json_index}"
179
+ end
180
+
181
+ ##
182
+ # Returns the RDoc::Store and path relative to +mount_path+ for
183
+ # documentation at +path+.
184
+
185
+ def documentation_source(path)
186
+ _, source_name, path = path.split '/', 3
187
+
188
+ store = @stores[source_name]
189
+ return store, path if store
190
+
191
+ store = store_for source_name
192
+
193
+ store.load_all
194
+
195
+ @stores[source_name] = store
196
+
197
+ return store, path
198
+ end
199
+
200
+ ##
201
+ # Generates an error page for the +exception+ while handling +req+ on +res+.
202
+
203
+ def error(exception, req, res)
204
+ backtrace = exception.backtrace.join "\n"
205
+
206
+ res.content_type = 'text/html'
207
+ res.status = 500
208
+ res.body = <<-BODY
209
+ <!DOCTYPE html>
210
+ <html>
211
+ <head>
212
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
213
+
214
+ <title>Error - #{ERB::Util.html_escape exception.class}</title>
215
+
216
+ <link type="text/css" media="screen" href="#{@mount_path}/css/rdoc.css" rel="stylesheet">
217
+ </head>
218
+ <body>
219
+ <h1>Error</h1>
220
+
221
+ <p>While processing <code>#{ERB::Util.html_escape req.request_uri}</code> the
222
+ RDoc (#{ERB::Util.html_escape RDoc::VERSION}) server has encountered a
223
+ <code>#{ERB::Util.html_escape exception.class}</code>
224
+ exception:
225
+
226
+ <pre>#{ERB::Util.html_escape exception.message}</pre>
227
+
228
+ <p>Please report this to the
229
+ <a href="https://github.com/ruby/rdoc/issues">RDoc issues tracker</a>. Please
230
+ include the RDoc version, the URI above and exception class, message and
231
+ backtrace. If you're viewing a gem's documentation, include the gem name and
232
+ version. If you're viewing Ruby's documentation, include the version of ruby.
233
+
234
+ <p>Backtrace:
235
+
236
+ <pre>#{ERB::Util.html_escape backtrace}</pre>
237
+
238
+ </body>
239
+ </html>
240
+ BODY
241
+ end
242
+
243
+ ##
244
+ # Instantiates a Darkfish generator for +store+
245
+
246
+ def generator_for(store)
247
+ generator = RDoc::Generator::Darkfish.new store, @options
248
+ generator.file_output = false
249
+ generator.asset_rel_path = '..'
250
+ generator.setup
251
+
252
+ rdoc = RDoc::RDoc.new
253
+ rdoc.store = store
254
+ rdoc.generator = generator
255
+ rdoc.options = @options
256
+
257
+ @options.main_page = store.main
258
+ @options.title = store.title
259
+
260
+ generator
261
+ end
262
+
263
+ ##
264
+ # Handles the If-Modified-Since HTTP header on +req+ for +path+. If the
265
+ # file has not been modified a Not Modified response is returned. If the
266
+ # file has been modified a Last-Modified header is added to +res+.
267
+
268
+ def if_modified_since(req, res, path = nil)
269
+ last_modified = File.stat(path).mtime if path
270
+
271
+ res['last-modified'] = last_modified.httpdate
272
+
273
+ return unless ims = req['if-modified-since']
274
+
275
+ ims = Time.parse ims
276
+
277
+ unless ims < last_modified then
278
+ res.body = ''
279
+ raise WEBrick::HTTPStatus::NotModified
280
+ end
281
+ end
282
+
283
+ ##
284
+ # Returns an Array of installed documentation.
285
+ #
286
+ # Each entry contains the documentation name (gem name, 'Ruby
287
+ # Documentation', etc.), the path relative to the mount point, whether the
288
+ # documentation exists, the type of documentation (See RDoc::RI::Paths#each)
289
+ # and the filesystem to the RDoc::Store for the documentation.
290
+
291
+ def installed_docs
292
+ extra_counter = 0
293
+ ri_paths.map do |path, type|
294
+ store = RDoc::Store.new(@options, path: path, type: type)
295
+ exists = File.exist? store.cache_path
296
+
297
+ case type
298
+ when :gem then
299
+ gem_path = path[%r%/([^/]*)/ri$%, 1]
300
+ [gem_path, "#{gem_path}/", exists, type, path]
301
+ when :system then
302
+ ['Ruby Documentation', 'ruby/', exists, type, path]
303
+ when :site then
304
+ ['Site Documentation', 'site/', exists, type, path]
305
+ when :home then
306
+ ['Home Documentation', 'home/', exists, type, path]
307
+ when :extra then
308
+ extra_counter += 1
309
+ store.load_cache if exists
310
+ title = store.title || "Extra Documentation"
311
+ [title, "extra-#{extra_counter}/", exists, type, path]
312
+ end
313
+ end
314
+ end
315
+
316
+ ##
317
+ # Returns a 404 page built by +generator+ for +req+ on +res+.
318
+
319
+ def not_found(generator, req, res, message = nil)
320
+ message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found"
321
+ res.body = generator.generate_servlet_not_found message
322
+ res.status = 404
323
+ end
324
+
325
+ ##
326
+ # Enumerates the ri paths. See RDoc::RI::Paths#each
327
+
328
+ def ri_paths(&block)
329
+ RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs
330
+ end
331
+
332
+ ##
333
+ # Generates the root page on +res+. +req+ is ignored.
334
+
335
+ def root(req, res)
336
+ generator = RDoc::Generator::Darkfish.new nil, @options
337
+
338
+ res.body = generator.generate_servlet_root installed_docs
339
+
340
+ res.content_type = 'text/html'
341
+ end
342
+
343
+ ##
344
+ # Generates a search index for the root page on +res+. +req+ is ignored.
345
+
346
+ def root_search(req, res)
347
+ search_index = []
348
+ info = []
349
+
350
+ installed_docs.map do |name, href, exists, type, path|
351
+ next unless exists
352
+
353
+ search_index << name
354
+
355
+ case type
356
+ when :gem
357
+ gemspec = path.gsub(%r%/doc/([^/]*?)/ri$%,
358
+ '/specifications/\1.gemspec')
359
+
360
+ spec = Gem::Specification.load gemspec
361
+
362
+ path = spec.full_name
363
+ comment = spec.summary
364
+ when :system then
365
+ path = 'ruby'
366
+ comment = 'Documentation for the Ruby standard library'
367
+ when :site then
368
+ path = 'site'
369
+ comment = 'Documentation for non-gem libraries'
370
+ when :home then
371
+ path = 'home'
372
+ comment = 'Documentation from your home directory'
373
+ when :extra
374
+ comment = name
375
+ end
376
+
377
+ info << [name, '', path, '', comment]
378
+ end
379
+
380
+ index = {
381
+ :index => {
382
+ :searchIndex => search_index,
383
+ :longSearchIndex => search_index,
384
+ :info => info,
385
+ }
386
+ }
387
+
388
+ res.body = "var search_data = #{JSON.dump index};"
389
+ res.content_type = 'application/javascript'
390
+ end
391
+
392
+ ##
393
+ # Displays documentation for +req+ on +res+, whether that be HTML or some
394
+ # asset.
395
+
396
+ def show_documentation(req, res)
397
+ store, path = documentation_source req.path
398
+
399
+ if_modified_since req, res, store.cache_path
400
+
401
+ generator = generator_for store
402
+
403
+ case path
404
+ when nil, '', 'index.html' then
405
+ res.body = generator.generate_index
406
+ when 'table_of_contents.html' then
407
+ res.body = generator.generate_table_of_contents
408
+ when 'js/search_index.js' then
409
+ documentation_search store, generator, req, res
410
+ else
411
+ documentation_page store, generator, path, req, res
412
+ end
413
+ ensure
414
+ res.content_type ||= 'text/html'
415
+ end
416
+
417
+ ##
418
+ # Returns an RDoc::Store for the given +source_name+ ('ruby' or a gem name).
419
+
420
+ def store_for(source_name)
421
+ case source_name
422
+ when 'home' then
423
+ RDoc::Store.new(@options, path: RDoc::RI::Paths.home_dir, type: :home)
424
+ when 'ruby' then
425
+ RDoc::Store.new(@options, path: RDoc::RI::Paths.system_dir, type: :system)
426
+ when 'site' then
427
+ RDoc::Store.new(@options, path: RDoc::RI::Paths.site_dir, type: :site)
428
+ when /\Aextra-(\d+)\z/ then
429
+ index = $1.to_i - 1
430
+ ri_dir = installed_docs[index][4]
431
+ RDoc::Store.new(@options, path: ri_dir, type: :extra)
432
+ else
433
+ ri_dir, type = ri_paths.find do |dir, dir_type|
434
+ next unless dir_type == :gem
435
+
436
+ source_name == dir[%r%/([^/]*)/ri$%, 1]
437
+ end
438
+
439
+ raise WEBrick::HTTPStatus::NotFound,
440
+ "Could not find gem \"#{ERB::Util.html_escape(source_name)}\". Are you sure you installed it?" unless ri_dir
441
+
442
+ store = RDoc::Store.new(@options, path: ri_dir, type: type)
443
+
444
+ return store if File.exist? store.cache_path
445
+
446
+ raise WEBrick::HTTPStatus::NotFound,
447
+ "Could not find documentation for \"#{ERB::Util.html_escape(source_name)}\". Please run `gem rdoc --ri gem_name`"
448
+
449
+ end
450
+ end
451
+
452
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ module RDoc::RI
3
+
4
+ Store = RDoc::Store # :nodoc:
5
+
6
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+ begin
3
+ gem 'rdoc'
4
+ rescue Gem::LoadError
5
+ end unless defined?(RDoc)
6
+
7
+ require_relative '../task'
8
+
9
+ ##
10
+ # RDoc::RI::Task creates ri data in <code>./.rdoc</code> for your project.
11
+ #
12
+ # It contains the following tasks:
13
+ #
14
+ # [ri]
15
+ # Build ri data
16
+ #
17
+ # [clobber_ri]
18
+ # Delete ri data files. This target is automatically added to the main
19
+ # clobber target.
20
+ #
21
+ # [reri]
22
+ # Rebuild the ri data from scratch even if they are not out of date.
23
+ #
24
+ # Simple example:
25
+ #
26
+ # require 'rdoc/ri/task'
27
+ #
28
+ # RDoc::RI::Task.new do |ri|
29
+ # ri.main = 'README.md'
30
+ # ri.rdoc_files.include 'README.md', 'lib/**/*.rb'
31
+ # end
32
+ #
33
+ # For further configuration details see RDoc::Task.
34
+
35
+ class RDoc::RI::Task < RDoc::Task
36
+
37
+ DEFAULT_NAMES = { # :nodoc:
38
+ :clobber_rdoc => :clobber_ri,
39
+ :rdoc => :ri,
40
+ :rerdoc => :reri,
41
+ }
42
+
43
+ ##
44
+ # Create an ri task with the given name. See RDoc::Task for documentation on
45
+ # setting names.
46
+
47
+ def initialize(name = DEFAULT_NAMES) # :yield: self
48
+ super
49
+ end
50
+
51
+ def clobber_task_description # :nodoc:
52
+ "Remove RI data files"
53
+ end
54
+
55
+ ##
56
+ # Sets default task values
57
+
58
+ def defaults
59
+ super
60
+
61
+ @rdoc_dir = '.rdoc'
62
+ end
63
+
64
+ def rdoc_task_description # :nodoc:
65
+ 'Build RI data files'
66
+ end
67
+
68
+ def rerdoc_task_description # :nodoc:
69
+ 'Rebuild RI data files'
70
+ end
71
+ end