rdoc 7.2.0 → 8.1.0

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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +4 -7
  3. data/LICENSE.rdoc +4 -0
  4. data/README.md +43 -2
  5. data/RI.md +75 -75
  6. data/doc/markup_reference/markdown.md +104 -3
  7. data/exe/rdoc +2 -2
  8. data/lib/rdoc/code_object/alias.rb +70 -74
  9. data/lib/rdoc/code_object/any_method.rb +305 -298
  10. data/lib/rdoc/code_object/attr.rb +150 -143
  11. data/lib/rdoc/code_object/class_module.rb +801 -765
  12. data/lib/rdoc/code_object/constant.rb +178 -150
  13. data/lib/rdoc/code_object/context/section.rb +133 -160
  14. data/lib/rdoc/code_object/context.rb +925 -952
  15. data/lib/rdoc/code_object/extend.rb +7 -5
  16. data/lib/rdoc/code_object/include.rb +7 -5
  17. data/lib/rdoc/code_object/method_attr.rb +325 -324
  18. data/lib/rdoc/code_object/mixin.rb +97 -95
  19. data/lib/rdoc/code_object/normal_class.rb +77 -78
  20. data/lib/rdoc/code_object/normal_module.rb +61 -59
  21. data/lib/rdoc/code_object/require.rb +23 -39
  22. data/lib/rdoc/code_object/single_class.rb +21 -19
  23. data/lib/rdoc/code_object/top_level.rb +212 -213
  24. data/lib/rdoc/code_object.rb +305 -305
  25. data/lib/rdoc/comment.rb +274 -337
  26. data/lib/rdoc/cross_reference.rb +194 -212
  27. data/lib/rdoc/encoding.rb +105 -103
  28. data/lib/rdoc/erb_partial.rb +13 -11
  29. data/lib/rdoc/erbio.rb +29 -27
  30. data/lib/rdoc/generator/aliki.rb +165 -140
  31. data/lib/rdoc/generator/darkfish.rb +647 -631
  32. data/lib/rdoc/generator/json_index.rb +233 -229
  33. data/lib/rdoc/generator/markup.rb +165 -122
  34. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  35. data/lib/rdoc/generator/pot/po.rb +52 -51
  36. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  37. data/lib/rdoc/generator/pot.rb +85 -81
  38. data/lib/rdoc/generator/ri.rb +23 -19
  39. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  40. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  41. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  42. data/lib/rdoc/generator/template/aliki/_head.rhtml +11 -11
  43. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  44. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  45. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  46. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  47. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +2 -2
  48. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
  49. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  50. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  51. data/lib/rdoc/generator/template/aliki/class.rhtml +56 -46
  52. data/lib/rdoc/generator/template/aliki/css/rdoc.css +538 -283
  53. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  54. data/lib/rdoc/generator/template/aliki/js/aliki.js +80 -102
  55. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  57. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  58. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  65. data/lib/rdoc/generator/template/darkfish/class.rhtml +18 -21
  66. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +0 -1
  67. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  68. data/lib/rdoc/generator.rb +48 -46
  69. data/lib/rdoc/i18n/locale.rb +99 -95
  70. data/lib/rdoc/i18n/text.rb +109 -105
  71. data/lib/rdoc/i18n.rb +7 -5
  72. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  73. data/lib/rdoc/markdown.kpeg +30 -21
  74. data/lib/rdoc/markdown.rb +329 -151
  75. data/lib/rdoc/markup/block_quote.rb +12 -8
  76. data/lib/rdoc/markup/document.rb +127 -123
  77. data/lib/rdoc/markup/formatter.rb +215 -221
  78. data/lib/rdoc/markup/heading.rb +1 -4
  79. data/lib/rdoc/markup/include.rb +33 -29
  80. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  81. data/lib/rdoc/markup/inline_parser.rb +281 -277
  82. data/lib/rdoc/markup/list.rb +80 -88
  83. data/lib/rdoc/markup/list_item.rb +73 -85
  84. data/lib/rdoc/markup/paragraph.rb +23 -19
  85. data/lib/rdoc/markup/parser.rb +501 -497
  86. data/lib/rdoc/markup/pre_process.rb +284 -305
  87. data/lib/rdoc/markup/raw.rb +2 -2
  88. data/lib/rdoc/markup/rule.rb +16 -12
  89. data/lib/rdoc/markup/to_ansi.rb +143 -139
  90. data/lib/rdoc/markup/to_bs.rb +72 -68
  91. data/lib/rdoc/markup/to_html.rb +600 -493
  92. data/lib/rdoc/markup/to_html_crossref.rb +221 -191
  93. data/lib/rdoc/markup/to_html_snippet.rb +232 -227
  94. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  95. data/lib/rdoc/markup/to_label.rb +63 -59
  96. data/lib/rdoc/markup/to_markdown.rb +212 -208
  97. data/lib/rdoc/markup/to_rdoc.rb +336 -332
  98. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  99. data/lib/rdoc/markup/to_test.rb +60 -56
  100. data/lib/rdoc/markup/to_tt_only.rb +83 -86
  101. data/lib/rdoc/markup/verbatim.rb +62 -58
  102. data/lib/rdoc/markup.rb +198 -196
  103. data/lib/rdoc/options.rb +1063 -1076
  104. data/lib/rdoc/parser/c.rb +1039 -1036
  105. data/lib/rdoc/parser/changelog.rb +319 -315
  106. data/lib/rdoc/parser/markdown.rb +17 -13
  107. data/lib/rdoc/parser/rbs.rb +279 -0
  108. data/lib/rdoc/parser/rd.rb +17 -13
  109. data/lib/rdoc/parser/ruby.rb +1231 -2222
  110. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  111. data/lib/rdoc/parser/simple.rb +31 -27
  112. data/lib/rdoc/parser/text.rb +12 -8
  113. data/lib/rdoc/parser.rb +230 -221
  114. data/lib/rdoc/rbs_helper.rb +186 -0
  115. data/lib/rdoc/rd/inline.rb +57 -53
  116. data/lib/rdoc/rd.rb +90 -88
  117. data/lib/rdoc/rdoc.rb +547 -366
  118. data/lib/rdoc/ri/driver.rb +1141 -1130
  119. data/lib/rdoc/ri/formatter.rb +7 -3
  120. data/lib/rdoc/ri/paths.rb +140 -136
  121. data/lib/rdoc/ri/servlet.rb +456 -0
  122. data/lib/rdoc/ri/store.rb +4 -2
  123. data/lib/rdoc/ri/task.rb +55 -51
  124. data/lib/rdoc/ri.rb +14 -11
  125. data/lib/rdoc/rubygems_hook.rb +194 -192
  126. data/lib/rdoc/server.rb +462 -0
  127. data/lib/rdoc/stats/normal.rb +46 -42
  128. data/lib/rdoc/stats/quiet.rb +39 -35
  129. data/lib/rdoc/stats/verbose.rb +35 -31
  130. data/lib/rdoc/stats.rb +363 -338
  131. data/lib/rdoc/store.rb +919 -725
  132. data/lib/rdoc/task.rb +260 -255
  133. data/lib/rdoc/text.rb +130 -245
  134. data/lib/rdoc/token_stream.rb +101 -115
  135. data/lib/rdoc/tom_doc.rb +203 -201
  136. data/lib/rdoc/version.rb +1 -1
  137. data/lib/rdoc.rb +35 -7
  138. data/lib/rubygems_plugin.rb +2 -11
  139. data/rdoc-logo.svg +43 -0
  140. data/rdoc.gemspec +6 -4
  141. metadata +36 -20
  142. data/lib/rdoc/code_object/anon_class.rb +0 -10
  143. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  144. data/lib/rdoc/code_object/meta_method.rb +0 -6
  145. data/lib/rdoc/markdown/literals.kpeg +0 -21
  146. data/lib/rdoc/markdown/literals.rb +0 -454
  147. data/lib/rdoc/parser/prism_ruby.rb +0 -1112
  148. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  149. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  150. data/lib/rdoc/servlet.rb +0 -452
data/lib/rdoc/task.rb CHANGED
@@ -36,310 +36,315 @@ require_relative '../rdoc'
36
36
  require 'rake'
37
37
  require 'rake/tasklib'
38
38
 
39
- ##
40
- # RDoc::Task creates the following rake tasks to generate and clean up RDoc
41
- # output:
42
- #
43
- # [rdoc]
44
- # Main task for this RDoc task.
45
- #
46
- # [clobber_rdoc]
47
- # Delete all the rdoc files. This target is automatically added to the main
48
- # clobber target.
49
- #
50
- # [rerdoc]
51
- # Rebuild the rdoc files from scratch, even if they are not out of date.
52
- #
53
- # [rdoc:coverage]
54
- # Print RDoc coverage report for all rdoc files.
55
- #
56
- # Simple Example:
57
- #
58
- # require 'rdoc/task'
59
- #
60
- # RDoc::Task.new do |rdoc|
61
- # rdoc.main = "README.md"
62
- # rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
63
- # end
64
- #
65
- # The +rdoc+ object passed to the block is an RDoc::Task object. See the
66
- # attributes list for the RDoc::Task class for available customization options.
67
- #
68
- # == Specifying different task names
69
- #
70
- # You may wish to give the task a different name, such as if you are
71
- # generating two sets of documentation. For instance, if you want to have a
72
- # development set of documentation including private methods:
73
- #
74
- # require 'rdoc/task'
75
- #
76
- # RDoc::Task.new :rdoc_dev do |rdoc|
77
- # rdoc.main = "README.md"
78
- # rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
79
- # rdoc.options << "--all"
80
- # end
81
- #
82
- # The tasks would then be named :<em>rdoc_dev</em>,
83
- # :clobber_<em>rdoc_dev</em>, and :re<em>rdoc_dev</em>.
84
- #
85
- # If you wish to have completely different task names, then pass a Hash as
86
- # first argument. With the <tt>:rdoc</tt>, <tt>:clobber_rdoc</tt> and
87
- # <tt>:rerdoc</tt> options, you can customize the task names to your liking.
88
- #
89
- # For example:
90
- #
91
- # require 'rdoc/task'
92
- #
93
- # RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
94
- # :rerdoc => "rdoc:force")
95
- #
96
- # This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt>,
97
- # <tt>:rdoc:force</tt>, and <tt>:rdoc:coverage</tt>.
98
-
99
- class RDoc::Task < Rake::TaskLib
100
-
39
+ module RDoc
101
40
  ##
102
- # Name of the main, top level task. (default is :rdoc)
41
+ # RDoc::Task creates the following rake tasks to generate and clean up RDoc
42
+ # output:
43
+ #
44
+ # [rdoc]
45
+ # Main task for this RDoc task.
46
+ #
47
+ # [clobber_rdoc]
48
+ # Delete all the rdoc files. This target is automatically added to the main
49
+ # clobber target.
50
+ #
51
+ # [rerdoc]
52
+ # Rebuild the rdoc files from scratch, even if they are not out of date.
53
+ #
54
+ # [rdoc:coverage]
55
+ # Print RDoc coverage report for all rdoc files.
56
+ #
57
+ # Simple Example:
58
+ #
59
+ # require 'rdoc/task'
60
+ #
61
+ # RDoc::Task.new do |rdoc|
62
+ # rdoc.main = "README.md"
63
+ # rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
64
+ # end
65
+ #
66
+ # The +rdoc+ object passed to the block is an RDoc::Task object. See the
67
+ # attributes list for the RDoc::Task class for available customization options.
68
+ #
69
+ # == Specifying different task names
70
+ #
71
+ # You may wish to give the task a different name, such as if you are
72
+ # generating two sets of documentation. For instance, if you want to have a
73
+ # development set of documentation including private methods:
74
+ #
75
+ # require 'rdoc/task'
76
+ #
77
+ # RDoc::Task.new :rdoc_dev do |rdoc|
78
+ # rdoc.main = "README.md"
79
+ # rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
80
+ # rdoc.options << "--all"
81
+ # end
82
+ #
83
+ # The tasks would then be named :<em>rdoc_dev</em>,
84
+ # :clobber_<em>rdoc_dev</em>, and :re<em>rdoc_dev</em>.
85
+ #
86
+ # If you wish to have completely different task names, then pass a Hash as
87
+ # first argument. With the <tt>:rdoc</tt>, <tt>:clobber_rdoc</tt> and
88
+ # <tt>:rerdoc</tt> options, you can customize the task names to your liking.
89
+ #
90
+ # For example:
91
+ #
92
+ # require 'rdoc/task'
93
+ #
94
+ # RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
95
+ # :rerdoc => "rdoc:force")
96
+ #
97
+ # This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt>,
98
+ # <tt>:rdoc:force</tt>, and <tt>:rdoc:coverage</tt>.
99
+
100
+ class Task < Rake::TaskLib
101
+
102
+ ##
103
+ # Name of the main, top level task. (default is :rdoc)
104
+
105
+ attr_accessor :name
106
+
107
+ ##
108
+ # The markup format; one of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
109
+ # See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
110
+ attr_accessor :markup
111
+
112
+ ##
113
+ # Name of directory to receive the html output files. (default is "html")
114
+
115
+ attr_accessor :rdoc_dir
116
+
117
+ ##
118
+ # Title of RDoc documentation. (defaults to rdoc's default)
119
+
120
+ attr_accessor :title
121
+
122
+ ##
123
+ # Name of file to be used as the main, top level file of the RDoc. (default
124
+ # is none)
125
+
126
+ attr_accessor :main
127
+
128
+ ##
129
+ # Name of template to be used by rdoc. (defaults to rdoc's default)
130
+
131
+ attr_accessor :template
132
+
133
+ ##
134
+ # Name of format generator (<tt>--format</tt>) used by rdoc. (defaults to
135
+ # rdoc's default)
136
+
137
+ attr_accessor :generator
138
+
139
+ ##
140
+ # List of files to be included in the rdoc generation. (default is [])
141
+
142
+ attr_accessor :rdoc_files
143
+
144
+ ##
145
+ # Additional list of options to be passed rdoc. (default is [])
146
+
147
+ attr_accessor :options
148
+
149
+ ##
150
+ # Whether to run the rdoc process as an external shell (default is false)
151
+
152
+ attr_accessor :external
153
+
154
+ ##
155
+ # Create an RDoc task with the given name. See the RDoc::Task class overview
156
+ # for documentation.
157
+
158
+ def initialize(name = :rdoc) # :yield: self
159
+ defaults
160
+
161
+ check_names name
103
162
 
104
- attr_accessor :name
163
+ @name = name
105
164
 
106
- ##
107
- # The markup format; one of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
108
- # See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
109
- attr_accessor :markup
110
-
111
- ##
112
- # Name of directory to receive the html output files. (default is "html")
113
-
114
- attr_accessor :rdoc_dir
115
-
116
- ##
117
- # Title of RDoc documentation. (defaults to rdoc's default)
165
+ yield self if block_given?
118
166
 
119
- attr_accessor :title
120
-
121
- ##
122
- # Name of file to be used as the main, top level file of the RDoc. (default
123
- # is none)
124
-
125
- attr_accessor :main
126
-
127
- ##
128
- # Name of template to be used by rdoc. (defaults to rdoc's default)
167
+ define
168
+ end
129
169
 
130
- attr_accessor :template
170
+ ##
171
+ # Ensures that +names+ only includes names for the :rdoc, :clobber_rdoc and
172
+ # :rerdoc. If other names are given an ArgumentError is raised.
131
173
 
132
- ##
133
- # Name of format generator (<tt>--format</tt>) used by rdoc. (defaults to
134
- # rdoc's default)
174
+ def check_names(names)
175
+ return unless Hash === names
135
176
 
136
- attr_accessor :generator
177
+ invalid_options =
178
+ names.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc]
137
179
 
138
- ##
139
- # List of files to be included in the rdoc generation. (default is [])
140
-
141
- attr_accessor :rdoc_files
180
+ unless invalid_options.empty?
181
+ raise ArgumentError, "invalid options: #{invalid_options.join ', '}"
182
+ end
183
+ end
142
184
 
143
- ##
144
- # Additional list of options to be passed rdoc. (default is [])
185
+ ##
186
+ # Task description for the clobber rdoc task or its renamed equivalent
145
187
 
146
- attr_accessor :options
188
+ def clobber_task_description
189
+ "Remove RDoc HTML files"
190
+ end
147
191
 
148
- ##
149
- # Whether to run the rdoc process as an external shell (default is false)
192
+ ##
193
+ # Sets default task values
194
+
195
+ def defaults
196
+ @name = :rdoc
197
+ @rdoc_files = Rake::FileList.new
198
+ @rdoc_dir = 'html'
199
+ @main = nil
200
+ @title = nil
201
+ @template = nil
202
+ @generator = nil
203
+ @options = []
204
+ end
150
205
 
151
- attr_accessor :external
206
+ ##
207
+ # Create the tasks defined by this task lib.
152
208
 
153
- ##
154
- # Create an RDoc task with the given name. See the RDoc::Task class overview
155
- # for documentation.
209
+ def define
210
+ desc rdoc_task_description
211
+ task rdoc_task_name
156
212
 
157
- def initialize(name = :rdoc) # :yield: self
158
- defaults
213
+ desc rerdoc_task_description
214
+ task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
159
215
 
160
- check_names name
216
+ desc clobber_task_description
217
+ task clobber_task_name do
218
+ rm_r @rdoc_dir rescue nil
219
+ end
161
220
 
162
- @name = name
221
+ task :clobber => [clobber_task_name]
163
222
 
164
- yield self if block_given?
223
+ directory @rdoc_dir
165
224
 
166
- define
167
- end
225
+ rdoc_target_deps = [
226
+ @rdoc_files,
227
+ Rake.application.rakefile
228
+ ].flatten.compact
168
229
 
169
- ##
170
- # Ensures that +names+ only includes names for the :rdoc, :clobber_rdoc and
171
- # :rerdoc. If other names are given an ArgumentError is raised.
230
+ task rdoc_task_name => [rdoc_target]
231
+ file rdoc_target => rdoc_target_deps do
232
+ @before_running_rdoc.call if @before_running_rdoc
233
+ args = option_list + @rdoc_files
172
234
 
173
- def check_names(names)
174
- return unless Hash === names
235
+ $stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
236
+ RDoc.new.document args
237
+ end
175
238
 
176
- invalid_options =
177
- names.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc]
239
+ namespace rdoc_task_name do
240
+ desc coverage_task_description
241
+ task coverage_task_name do
242
+ @before_running_rdoc.call if @before_running_rdoc
243
+ opts = option_list << "-C"
244
+ args = opts + @rdoc_files
245
+
246
+ $stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
247
+ RDoc.new.document args
248
+ rescue SystemExit => exit
249
+ raise "RDoc coverage is incomplete" unless exit.success?
250
+ end
251
+
252
+ desc server_task_description
253
+ task "server" do
254
+ @before_running_rdoc.call if @before_running_rdoc
255
+ args = option_list + ["--server"] + @rdoc_files
256
+
257
+ $stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
258
+ RDoc.new.document args
259
+ end
260
+ end
178
261
 
179
- unless invalid_options.empty? then
180
- raise ArgumentError, "invalid options: #{invalid_options.join ', '}"
262
+ self
181
263
  end
182
- end
183
-
184
- ##
185
- # Task description for the clobber rdoc task or its renamed equivalent
186
-
187
- def clobber_task_description
188
- "Remove RDoc HTML files"
189
- end
190
264
 
191
- ##
192
- # Sets default task values
193
-
194
- def defaults
195
- @name = :rdoc
196
- @rdoc_files = Rake::FileList.new
197
- @rdoc_dir = 'html'
198
- @main = nil
199
- @title = nil
200
- @template = nil
201
- @generator = nil
202
- @options = []
203
- end
265
+ ##
266
+ # List of options that will be supplied to RDoc
267
+
268
+ def option_list
269
+ result = @options.dup
270
+ result << "-o" << @rdoc_dir
271
+ result << "--main" << main if main
272
+ result << "--markup" << markup if markup
273
+ result << "--title" << title if title
274
+ result << "-T" << template if template
275
+ result << '-f' << generator if generator
276
+ result
277
+ end
204
278
 
205
- ##
206
- # All source is inline now. This method is deprecated
279
+ ##
280
+ # The block passed to this method will be called just before running the
281
+ # RDoc generator. It is allowed to modify RDoc::Task attributes inside the
282
+ # block.
207
283
 
208
- def inline_source # :nodoc:
209
- warn "RDoc::Task#inline_source is deprecated"
210
- true
211
- end
284
+ def before_running_rdoc(&block)
285
+ @before_running_rdoc = block
286
+ end
212
287
 
213
- ##
214
- # All source is inline now. This method is deprecated
288
+ ##
289
+ # Task description for the rdoc task or its renamed equivalent
215
290
 
216
- def inline_source=(value) # :nodoc:
217
- warn "RDoc::Task#inline_source is deprecated"
218
- end
291
+ def rdoc_task_description
292
+ 'Build RDoc HTML files'
293
+ end
219
294
 
220
- ##
221
- # Create the tasks defined by this task lib.
295
+ ##
296
+ # Task description for the rerdoc task or its renamed description
222
297
 
223
- def define
224
- desc rdoc_task_description
225
- task rdoc_task_name
298
+ def rerdoc_task_description
299
+ "Rebuild RDoc HTML files"
300
+ end
226
301
 
227
- desc rerdoc_task_description
228
- task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
302
+ ##
303
+ # Task description for the coverage task or its renamed description
229
304
 
230
- desc clobber_task_description
231
- task clobber_task_name do
232
- rm_r @rdoc_dir rescue nil
305
+ def coverage_task_description
306
+ "Print RDoc coverage report"
233
307
  end
234
308
 
235
- task :clobber => [clobber_task_name]
236
-
237
- directory @rdoc_dir
309
+ ##
310
+ # Task description for the server task
238
311
 
239
- rdoc_target_deps = [
240
- @rdoc_files,
241
- Rake.application.rakefile
242
- ].flatten.compact
312
+ def server_task_description
313
+ "Start a live-reloading documentation server"
314
+ end
243
315
 
244
- task rdoc_task_name => [rdoc_target]
245
- file rdoc_target => rdoc_target_deps do
246
- @before_running_rdoc.call if @before_running_rdoc
247
- args = option_list + @rdoc_files
316
+ private
248
317
 
249
- $stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
250
- RDoc::RDoc.new.document args
318
+ def rdoc_target
319
+ "#{rdoc_dir}/created.rid"
251
320
  end
252
321
 
253
- namespace rdoc_task_name do
254
- desc coverage_task_description
255
- task coverage_task_name do
256
- @before_running_rdoc.call if @before_running_rdoc
257
- opts = option_list << "-C"
258
- args = opts + @rdoc_files
259
-
260
- $stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
261
- RDoc::RDoc.new.document args
322
+ def rdoc_task_name
323
+ case name
324
+ when Hash then (name[:rdoc] || "rdoc").to_s
325
+ else name.to_s
262
326
  end
263
327
  end
264
328
 
265
- self
266
- end
267
-
268
- ##
269
- # List of options that will be supplied to RDoc
270
-
271
- def option_list
272
- result = @options.dup
273
- result << "-o" << @rdoc_dir
274
- result << "--main" << main if main
275
- result << "--markup" << markup if markup
276
- result << "--title" << title if title
277
- result << "-T" << template if template
278
- result << '-f' << generator if generator
279
- result
280
- end
281
-
282
- ##
283
- # The block passed to this method will be called just before running the
284
- # RDoc generator. It is allowed to modify RDoc::Task attributes inside the
285
- # block.
286
-
287
- def before_running_rdoc(&block)
288
- @before_running_rdoc = block
289
- end
290
-
291
- ##
292
- # Task description for the rdoc task or its renamed equivalent
293
-
294
- def rdoc_task_description
295
- 'Build RDoc HTML files'
296
- end
297
-
298
- ##
299
- # Task description for the rerdoc task or its renamed description
300
-
301
- def rerdoc_task_description
302
- "Rebuild RDoc HTML files"
303
- end
304
-
305
- ##
306
- # Task description for the coverage task or its renamed description
307
-
308
- def coverage_task_description
309
- "Print RDoc coverage report"
310
- end
311
-
312
- private
313
-
314
- def rdoc_target
315
- "#{rdoc_dir}/created.rid"
316
- end
317
-
318
- def rdoc_task_name
319
- case name
320
- when Hash then (name[:rdoc] || "rdoc").to_s
321
- else name.to_s
329
+ def clobber_task_name
330
+ case name
331
+ when Hash then (name[:clobber_rdoc] || "clobber_rdoc").to_s
332
+ else "clobber_#{name}"
333
+ end
322
334
  end
323
- end
324
335
 
325
- def clobber_task_name
326
- case name
327
- when Hash then (name[:clobber_rdoc] || "clobber_rdoc").to_s
328
- else "clobber_#{name}"
336
+ def rerdoc_task_name
337
+ case name
338
+ when Hash then (name[:rerdoc] || "rerdoc").to_s
339
+ else "re#{name}"
340
+ end
329
341
  end
330
- end
331
342
 
332
- def rerdoc_task_name
333
- case name
334
- when Hash then (name[:rerdoc] || "rerdoc").to_s
335
- else "re#{name}"
343
+ def coverage_task_name
344
+ "coverage"
336
345
  end
337
- end
338
346
 
339
- def coverage_task_name
340
- "coverage"
341
347
  end
342
-
343
348
  end
344
349
 
345
350
  # :stopdoc: