rdoc 8.0.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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -3
- data/RI.md +75 -75
- data/exe/rdoc +2 -2
- data/lib/rdoc/code_object/alias.rb +71 -69
- data/lib/rdoc/code_object/any_method.rb +305 -303
- data/lib/rdoc/code_object/attr.rb +150 -148
- data/lib/rdoc/code_object/class_module.rb +798 -792
- data/lib/rdoc/code_object/constant.rb +175 -173
- data/lib/rdoc/code_object/context/section.rb +142 -138
- data/lib/rdoc/code_object/context.rb +926 -958
- data/lib/rdoc/code_object/extend.rb +7 -5
- data/lib/rdoc/code_object/include.rb +7 -5
- data/lib/rdoc/code_object/method_attr.rb +326 -319
- data/lib/rdoc/code_object/mixin.rb +97 -95
- data/lib/rdoc/code_object/normal_class.rb +77 -78
- data/lib/rdoc/code_object/normal_module.rb +61 -59
- data/lib/rdoc/code_object/require.rb +23 -39
- data/lib/rdoc/code_object/single_class.rb +21 -19
- data/lib/rdoc/code_object/top_level.rb +212 -219
- data/lib/rdoc/code_object.rb +305 -303
- data/lib/rdoc/comment.rb +275 -273
- data/lib/rdoc/cross_reference.rb +192 -190
- data/lib/rdoc/encoding.rb +105 -103
- data/lib/rdoc/erb_partial.rb +13 -11
- data/lib/rdoc/erbio.rb +29 -27
- data/lib/rdoc/generator/aliki.rb +161 -153
- data/lib/rdoc/generator/darkfish.rb +645 -635
- data/lib/rdoc/generator/json_index.rb +233 -229
- data/lib/rdoc/generator/markup.rb +164 -146
- data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
- data/lib/rdoc/generator/pot/po.rb +52 -51
- data/lib/rdoc/generator/pot/po_entry.rb +138 -132
- data/lib/rdoc/generator/pot.rb +85 -81
- data/lib/rdoc/generator/ri.rb +23 -19
- data/lib/rdoc/generator/template/aliki/DESIGN.md +6 -4
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_head.rhtml +10 -10
- data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +4 -4
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +207 -178
- data/lib/rdoc/generator/template/aliki/js/aliki.js +60 -84
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
- data/lib/rdoc/generator.rb +48 -46
- data/lib/rdoc/i18n/locale.rb +99 -95
- data/lib/rdoc/i18n/text.rb +109 -105
- data/lib/rdoc/i18n.rb +7 -5
- data/lib/rdoc/markdown/byte_runtime.rb +80 -0
- data/lib/rdoc/markdown.kpeg +15 -11
- data/lib/rdoc/markdown.rb +40 -47
- data/lib/rdoc/markup/block_quote.rb +12 -8
- data/lib/rdoc/markup/document.rb +127 -123
- data/lib/rdoc/markup/formatter.rb +219 -215
- data/lib/rdoc/markup/include.rb +33 -29
- data/lib/rdoc/markup/indented_paragraph.rb +37 -33
- data/lib/rdoc/markup/inline_parser.rb +281 -277
- data/lib/rdoc/markup/list.rb +80 -88
- data/lib/rdoc/markup/list_item.rb +73 -85
- data/lib/rdoc/markup/paragraph.rb +23 -19
- data/lib/rdoc/markup/parser.rb +501 -497
- data/lib/rdoc/markup/pre_process.rb +283 -279
- data/lib/rdoc/markup/raw.rb +2 -2
- data/lib/rdoc/markup/rule.rb +16 -12
- data/lib/rdoc/markup/to_ansi.rb +143 -139
- data/lib/rdoc/markup/to_bs.rb +72 -68
- data/lib/rdoc/markup/to_html.rb +594 -565
- data/lib/rdoc/markup/to_html_crossref.rb +234 -230
- data/lib/rdoc/markup/to_html_snippet.rb +232 -227
- data/lib/rdoc/markup/to_joined_paragraph.rb +36 -32
- data/lib/rdoc/markup/to_label.rb +63 -59
- data/lib/rdoc/markup/to_markdown.rb +212 -208
- data/lib/rdoc/markup/to_rdoc.rb +336 -332
- data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
- data/lib/rdoc/markup/to_test.rb +60 -56
- data/lib/rdoc/markup/to_tt_only.rb +84 -80
- data/lib/rdoc/markup/verbatim.rb +62 -58
- data/lib/rdoc/markup.rb +198 -196
- data/lib/rdoc/options.rb +1063 -1061
- data/lib/rdoc/parser/c.rb +1039 -1037
- data/lib/rdoc/parser/changelog.rb +319 -315
- data/lib/rdoc/parser/markdown.rb +17 -13
- data/lib/rdoc/parser/rbs.rb +239 -235
- data/lib/rdoc/parser/rd.rb +17 -13
- data/lib/rdoc/parser/ruby.rb +1245 -1124
- data/lib/rdoc/parser/ruby_colorizer.rb +263 -213
- data/lib/rdoc/parser/simple.rb +31 -27
- data/lib/rdoc/parser/text.rb +12 -8
- data/lib/rdoc/parser.rb +228 -220
- data/lib/rdoc/rbs_helper.rb +1 -1
- data/lib/rdoc/rd/inline.rb +57 -53
- data/lib/rdoc/rd.rb +90 -88
- data/lib/rdoc/rdoc.rb +500 -491
- data/lib/rdoc/ri/driver.rb +1140 -1135
- data/lib/rdoc/ri/formatter.rb +7 -3
- data/lib/rdoc/ri/paths.rb +140 -136
- data/lib/rdoc/ri/servlet.rb +354 -350
- data/lib/rdoc/ri/store.rb +4 -2
- data/lib/rdoc/ri/task.rb +55 -51
- data/lib/rdoc/ri.rb +14 -12
- data/lib/rdoc/rubygems_hook.rb +183 -181
- data/lib/rdoc/server.rb +349 -347
- data/lib/rdoc/stats/normal.rb +46 -42
- data/lib/rdoc/stats/quiet.rb +39 -35
- data/lib/rdoc/stats/verbose.rb +35 -31
- data/lib/rdoc/stats.rb +365 -363
- data/lib/rdoc/store.rb +888 -902
- data/lib/rdoc/task.rb +260 -256
- data/lib/rdoc/text.rb +135 -133
- data/lib/rdoc/token_stream.rb +101 -93
- data/lib/rdoc/tom_doc.rb +203 -201
- data/lib/rdoc/version.rb +1 -1
- metadata +4 -5
- data/lib/rdoc/markdown/literals.kpeg +0 -21
- data/lib/rdoc/markdown/literals.rb +0 -454
data/lib/rdoc/options.rb
CHANGED
|
@@ -2,730 +2,731 @@
|
|
|
2
2
|
require 'optparse'
|
|
3
3
|
require 'pathname'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
# RDoc::Options handles the parsing and storage of options
|
|
7
|
-
#
|
|
8
|
-
# == Saved Options
|
|
9
|
-
#
|
|
10
|
-
# You can save some options like the markup format in the
|
|
11
|
-
# <tt>.rdoc_options</tt> file in your gem. The easiest way to do this is:
|
|
12
|
-
#
|
|
13
|
-
# rdoc --markup tomdoc --write-options
|
|
14
|
-
#
|
|
15
|
-
# Which will automatically create the file and fill it with the options you
|
|
16
|
-
# specified.
|
|
17
|
-
#
|
|
18
|
-
# The following options will not be saved since they interfere with the user's
|
|
19
|
-
# preferences or with the normal operation of RDoc:
|
|
20
|
-
#
|
|
21
|
-
# * +--coverage-report+
|
|
22
|
-
# * +--dry-run+
|
|
23
|
-
# * +--encoding+
|
|
24
|
-
# * +--force-update+
|
|
25
|
-
# * +--format+
|
|
26
|
-
# * +--pipe+
|
|
27
|
-
# * +--quiet+
|
|
28
|
-
# * +--template+
|
|
29
|
-
# * +--verbose+
|
|
30
|
-
#
|
|
31
|
-
# == Custom Options
|
|
32
|
-
#
|
|
33
|
-
# Generators can hook into RDoc::Options to add generator-specific command
|
|
34
|
-
# line options.
|
|
35
|
-
#
|
|
36
|
-
# When <tt>--format</tt> is encountered in ARGV, RDoc calls ::setup_options on
|
|
37
|
-
# the generator class to add extra options to the option parser. Options for
|
|
38
|
-
# custom generators must occur after <tt>--format</tt>. <tt>rdoc --help</tt>
|
|
39
|
-
# will list options for all installed generators.
|
|
40
|
-
#
|
|
41
|
-
# Example:
|
|
42
|
-
#
|
|
43
|
-
# class RDoc::Generator::Spellcheck
|
|
44
|
-
# RDoc::RDoc.add_generator self
|
|
45
|
-
#
|
|
46
|
-
# def self.setup_options rdoc_options
|
|
47
|
-
# op = rdoc_options.option_parser
|
|
48
|
-
#
|
|
49
|
-
# op.on('--spell-dictionary DICTIONARY',
|
|
50
|
-
# RDoc::Options::Path) do |dictionary|
|
|
51
|
-
# rdoc_options.spell_dictionary = dictionary
|
|
52
|
-
# end
|
|
53
|
-
# end
|
|
54
|
-
# end
|
|
55
|
-
#
|
|
56
|
-
# Of course, RDoc::Options does not respond to +spell_dictionary+ by default
|
|
57
|
-
# so you will need to add it:
|
|
58
|
-
#
|
|
59
|
-
# class RDoc::Options
|
|
60
|
-
#
|
|
61
|
-
# ##
|
|
62
|
-
# # The spell dictionary used by the spell-checking plugin.
|
|
63
|
-
#
|
|
64
|
-
# attr_accessor :spell_dictionary
|
|
65
|
-
#
|
|
66
|
-
# end
|
|
67
|
-
#
|
|
68
|
-
# == Option Validators
|
|
69
|
-
#
|
|
70
|
-
# OptionParser validators will validate and cast user input values. In
|
|
71
|
-
# addition to the validators that ship with OptionParser (String, Integer,
|
|
72
|
-
# Float, TrueClass, FalseClass, Array, Regexp, Date, Time, URI, etc.),
|
|
73
|
-
# RDoc::Options adds Path, PathArray and Template.
|
|
74
|
-
|
|
75
|
-
class RDoc::Options
|
|
76
|
-
|
|
5
|
+
module RDoc
|
|
77
6
|
##
|
|
78
|
-
# RDoc
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
7
|
+
# RDoc::Options handles the parsing and storage of options
|
|
8
|
+
#
|
|
9
|
+
# == Saved Options
|
|
10
|
+
#
|
|
11
|
+
# You can save some options like the markup format in the
|
|
12
|
+
# <tt>.rdoc_options</tt> file in your gem. The easiest way to do this is:
|
|
13
|
+
#
|
|
14
|
+
# rdoc --markup tomdoc --write-options
|
|
15
|
+
#
|
|
16
|
+
# Which will automatically create the file and fill it with the options you
|
|
17
|
+
# specified.
|
|
18
|
+
#
|
|
19
|
+
# The following options will not be saved since they interfere with the user's
|
|
20
|
+
# preferences or with the normal operation of RDoc:
|
|
21
|
+
#
|
|
22
|
+
# * +--coverage-report+
|
|
23
|
+
# * +--dry-run+
|
|
24
|
+
# * +--encoding+
|
|
25
|
+
# * +--force-update+
|
|
26
|
+
# * +--format+
|
|
27
|
+
# * +--pipe+
|
|
28
|
+
# * +--quiet+
|
|
29
|
+
# * +--template+
|
|
30
|
+
# * +--verbose+
|
|
31
|
+
#
|
|
32
|
+
# == Custom Options
|
|
33
|
+
#
|
|
34
|
+
# Generators can hook into RDoc::Options to add generator-specific command
|
|
35
|
+
# line options.
|
|
36
|
+
#
|
|
37
|
+
# When <tt>--format</tt> is encountered in ARGV, RDoc calls ::setup_options on
|
|
38
|
+
# the generator class to add extra options to the option parser. Options for
|
|
39
|
+
# custom generators must occur after <tt>--format</tt>. <tt>rdoc --help</tt>
|
|
40
|
+
# will list options for all installed generators.
|
|
41
|
+
#
|
|
42
|
+
# Example:
|
|
43
|
+
#
|
|
44
|
+
# class RDoc::Generator::Spellcheck
|
|
45
|
+
# RDoc::RDoc.add_generator self
|
|
46
|
+
#
|
|
47
|
+
# def self.setup_options rdoc_options
|
|
48
|
+
# op = rdoc_options.option_parser
|
|
49
|
+
#
|
|
50
|
+
# op.on('--spell-dictionary DICTIONARY',
|
|
51
|
+
# RDoc::Options::Path) do |dictionary|
|
|
52
|
+
# rdoc_options.spell_dictionary = dictionary
|
|
53
|
+
# end
|
|
54
|
+
# end
|
|
55
|
+
# end
|
|
56
|
+
#
|
|
57
|
+
# Of course, RDoc::Options does not respond to +spell_dictionary+ by default
|
|
58
|
+
# so you will need to add it:
|
|
59
|
+
#
|
|
60
|
+
# class RDoc::Options
|
|
61
|
+
#
|
|
62
|
+
# ##
|
|
63
|
+
# # The spell dictionary used by the spell-checking plugin.
|
|
64
|
+
#
|
|
65
|
+
# attr_accessor :spell_dictionary
|
|
66
|
+
#
|
|
67
|
+
# end
|
|
68
|
+
#
|
|
69
|
+
# == Option Validators
|
|
70
|
+
#
|
|
71
|
+
# OptionParser validators will validate and cast user input values. In
|
|
72
|
+
# addition to the validators that ship with OptionParser (String, Integer,
|
|
73
|
+
# Float, TrueClass, FalseClass, Array, Regexp, Date, Time, URI, etc.),
|
|
74
|
+
# RDoc::Options adds Path, PathArray and Template.
|
|
75
|
+
|
|
76
|
+
class Options
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
# RDoc options ignored (or handled specially) by --write-options
|
|
80
|
+
|
|
81
|
+
SPECIAL = %w[
|
|
82
|
+
coverage_report
|
|
83
|
+
dry_run
|
|
84
|
+
encoding
|
|
85
|
+
files
|
|
86
|
+
force_output
|
|
87
|
+
force_update
|
|
88
|
+
generator
|
|
89
|
+
generator_name
|
|
90
|
+
generator_options
|
|
91
|
+
generators
|
|
92
|
+
locale
|
|
93
|
+
op_dir
|
|
94
|
+
page_dir
|
|
95
|
+
option_parser
|
|
96
|
+
pipe
|
|
97
|
+
rdoc_include
|
|
98
|
+
root
|
|
99
|
+
server_port
|
|
100
|
+
static_path
|
|
101
|
+
template
|
|
102
|
+
template_dir
|
|
103
|
+
update_output_dir
|
|
104
|
+
verbosity
|
|
105
|
+
write_options
|
|
106
|
+
]
|
|
106
107
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
##
|
|
109
|
+
# Option validator for OptionParser that matches a directory that exists on
|
|
110
|
+
# the filesystem.
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
Directory = Object.new
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
##
|
|
115
|
+
# Option validator for OptionParser that matches a file or directory that
|
|
116
|
+
# exists on the filesystem.
|
|
116
117
|
|
|
117
|
-
|
|
118
|
+
Path = Object.new
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
##
|
|
121
|
+
# Option validator for OptionParser that matches a comma-separated list of
|
|
122
|
+
# files or directories that exist on the filesystem.
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
PathArray = Object.new
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
##
|
|
127
|
+
# Option validator for OptionParser that matches a template directory for an
|
|
128
|
+
# installed generator that lives in
|
|
129
|
+
# <tt>"rdoc/generator/template/#{template_name}"</tt>
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
Template = Object.new
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
##
|
|
134
|
+
# Character-set for HTML output. #encoding is preferred over #charset
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
attr_accessor :charset
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
##
|
|
139
|
+
# If true, RDoc will not write any files.
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
attr_accessor :dry_run
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
##
|
|
144
|
+
# The output encoding. All input files will be transcoded to this encoding.
|
|
145
|
+
#
|
|
146
|
+
# The default encoding is UTF-8. This is set via --encoding.
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
attr_accessor :encoding
|
|
148
149
|
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
##
|
|
151
|
+
# Files matching this pattern will be excluded
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
attr_writer :exclude
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
##
|
|
156
|
+
# The list of files to be processed
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
attr_accessor :files
|
|
158
159
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
##
|
|
161
|
+
# Create the output even if the output directory does not look
|
|
162
|
+
# like an rdoc output directory
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
attr_accessor :force_output
|
|
164
165
|
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
##
|
|
167
|
+
# Scan newer sources than the flag file if true.
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
attr_accessor :force_update
|
|
169
170
|
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
##
|
|
172
|
+
# Formatter to mark up text with
|
|
172
173
|
|
|
173
|
-
|
|
174
|
+
attr_accessor :formatter
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
##
|
|
177
|
+
# Description of the output generator (set with the <tt>--format</tt> option)
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
attr_accessor :generator
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
##
|
|
182
|
+
# For #==
|
|
182
183
|
|
|
183
|
-
|
|
184
|
+
attr_reader :generator_name # :nodoc:
|
|
184
185
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
##
|
|
187
|
+
# Loaded generator options. Used to prevent --help from loading the same
|
|
188
|
+
# options multiple times.
|
|
188
189
|
|
|
189
|
-
|
|
190
|
+
attr_accessor :generator_options
|
|
190
191
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
##
|
|
193
|
+
# Old rdoc behavior: hyperlink all words that match a method name,
|
|
194
|
+
# even if not preceded by '#' or '::'
|
|
194
195
|
|
|
195
|
-
|
|
196
|
+
attr_accessor :hyperlink_all
|
|
196
197
|
|
|
197
|
-
|
|
198
|
-
|
|
198
|
+
##
|
|
199
|
+
# Include line numbers in the source code
|
|
199
200
|
|
|
200
|
-
|
|
201
|
+
attr_accessor :line_numbers
|
|
201
202
|
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
##
|
|
204
|
+
# The output locale.
|
|
204
205
|
|
|
205
|
-
|
|
206
|
+
attr_accessor :locale
|
|
206
207
|
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
##
|
|
209
|
+
# The directory where locale data live.
|
|
209
210
|
|
|
210
|
-
|
|
211
|
+
attr_accessor :locale_dir
|
|
211
212
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
##
|
|
214
|
+
# Name of the file, class or module to display in the initial index page (if
|
|
215
|
+
# not specified the first file we encounter is used)
|
|
215
216
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
##
|
|
219
|
-
# The markup format.
|
|
220
|
-
# One of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
|
|
221
|
-
# See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
|
|
222
|
-
attr_accessor :markup
|
|
217
|
+
attr_accessor :main_page
|
|
223
218
|
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
##
|
|
220
|
+
# The markup format.
|
|
221
|
+
# One of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
|
|
222
|
+
# See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
|
|
223
|
+
attr_accessor :markup
|
|
226
224
|
|
|
227
|
-
|
|
225
|
+
##
|
|
226
|
+
# If true, only report on undocumented files
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
# The name of the output directory
|
|
228
|
+
attr_accessor :coverage_report
|
|
231
229
|
|
|
232
|
-
|
|
230
|
+
##
|
|
231
|
+
# The name of the output directory
|
|
233
232
|
|
|
234
|
-
|
|
235
|
-
# The OptionParser for this instance
|
|
233
|
+
attr_accessor :op_dir
|
|
236
234
|
|
|
237
|
-
|
|
235
|
+
##
|
|
236
|
+
# The OptionParser for this instance
|
|
238
237
|
|
|
239
|
-
|
|
240
|
-
# Output heading decorations?
|
|
241
|
-
attr_accessor :output_decoration
|
|
238
|
+
attr_accessor :option_parser
|
|
242
239
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
240
|
+
##
|
|
241
|
+
# Output heading decorations?
|
|
242
|
+
attr_accessor :output_decoration
|
|
246
243
|
|
|
247
|
-
|
|
244
|
+
##
|
|
245
|
+
# Directory where guides, FAQ, and other pages not associated with a class
|
|
246
|
+
# live. You may leave this unset if these are at the root of your project.
|
|
248
247
|
|
|
249
|
-
|
|
250
|
-
# Is RDoc in pipe mode?
|
|
248
|
+
attr_accessor :page_dir
|
|
251
249
|
|
|
252
|
-
|
|
250
|
+
##
|
|
251
|
+
# Is RDoc in pipe mode?
|
|
253
252
|
|
|
254
|
-
|
|
255
|
-
# Array of directories to search for files to satisfy an :include:
|
|
253
|
+
attr_accessor :pipe
|
|
256
254
|
|
|
257
|
-
|
|
255
|
+
##
|
|
256
|
+
# Array of directories to search for files to satisfy an :include:
|
|
258
257
|
|
|
259
|
-
|
|
260
|
-
# Root of the source documentation will be generated for. Set this when
|
|
261
|
-
# building documentation outside the source directory. Defaults to the
|
|
262
|
-
# current directory.
|
|
258
|
+
attr_accessor :rdoc_include
|
|
263
259
|
|
|
264
|
-
|
|
260
|
+
##
|
|
261
|
+
# Root of the source documentation will be generated for. Set this when
|
|
262
|
+
# building documentation outside the source directory. Defaults to the
|
|
263
|
+
# current directory.
|
|
265
264
|
|
|
266
|
-
|
|
267
|
-
# Include the '#' at the front of hyperlinked instance method names
|
|
265
|
+
attr_accessor :root
|
|
268
266
|
|
|
269
|
-
|
|
267
|
+
##
|
|
268
|
+
# Include the '#' at the front of hyperlinked instance method names
|
|
270
269
|
|
|
271
|
-
|
|
272
|
-
# Directory to copy static files from
|
|
270
|
+
attr_accessor :show_hash
|
|
273
271
|
|
|
274
|
-
|
|
272
|
+
##
|
|
273
|
+
# Directory to copy static files from
|
|
275
274
|
|
|
276
|
-
|
|
277
|
-
# The number of columns in a tab
|
|
275
|
+
attr_accessor :static_path
|
|
278
276
|
|
|
279
|
-
|
|
277
|
+
##
|
|
278
|
+
# The number of columns in a tab
|
|
280
279
|
|
|
281
|
-
|
|
282
|
-
# Template to be used when generating output
|
|
280
|
+
attr_accessor :tab_width
|
|
283
281
|
|
|
284
|
-
|
|
282
|
+
##
|
|
283
|
+
# Template to be used when generating output
|
|
285
284
|
|
|
286
|
-
|
|
287
|
-
# Directory the template lives in
|
|
285
|
+
attr_accessor :template
|
|
288
286
|
|
|
289
|
-
|
|
287
|
+
##
|
|
288
|
+
# Directory the template lives in
|
|
290
289
|
|
|
291
|
-
|
|
292
|
-
# Additional template stylesheets
|
|
290
|
+
attr_accessor :template_dir
|
|
293
291
|
|
|
294
|
-
|
|
292
|
+
##
|
|
293
|
+
# Additional template stylesheets
|
|
295
294
|
|
|
296
|
-
|
|
297
|
-
# Documentation title
|
|
295
|
+
attr_accessor :template_stylesheets
|
|
298
296
|
|
|
299
|
-
|
|
297
|
+
##
|
|
298
|
+
# Documentation title
|
|
300
299
|
|
|
301
|
-
|
|
302
|
-
# Should RDoc update the timestamps in the output dir?
|
|
300
|
+
attr_accessor :title
|
|
303
301
|
|
|
304
|
-
|
|
302
|
+
##
|
|
303
|
+
# Should RDoc update the timestamps in the output dir?
|
|
305
304
|
|
|
306
|
-
|
|
307
|
-
# Verbosity, zero means quiet
|
|
305
|
+
attr_accessor :update_output_dir
|
|
308
306
|
|
|
309
|
-
|
|
307
|
+
##
|
|
308
|
+
# Verbosity, zero means quiet
|
|
310
309
|
|
|
311
|
-
|
|
312
|
-
# Warn if rdoc-ref links can't be resolved
|
|
313
|
-
# Default is +true+
|
|
310
|
+
attr_accessor :verbosity
|
|
314
311
|
|
|
315
|
-
|
|
312
|
+
##
|
|
313
|
+
# Warn if rdoc-ref links can't be resolved
|
|
314
|
+
# Default is +true+
|
|
316
315
|
|
|
317
|
-
|
|
318
|
-
# URL of web cvs frontend
|
|
316
|
+
attr_accessor :warn_missing_rdoc_ref
|
|
319
317
|
|
|
320
|
-
|
|
318
|
+
##
|
|
319
|
+
# URL of web cvs frontend
|
|
321
320
|
|
|
322
|
-
|
|
323
|
-
# Minimum visibility of a documented method. One of +:public+, +:protected+,
|
|
324
|
-
# +:private+ or +:nodoc+.
|
|
325
|
-
#
|
|
326
|
-
# The +:nodoc+ visibility ignores all directives related to visibility. The
|
|
327
|
-
# other visibilities may be overridden on a per-method basis with the :doc:
|
|
328
|
-
# directive.
|
|
321
|
+
attr_accessor :webcvs
|
|
329
322
|
|
|
330
|
-
|
|
323
|
+
##
|
|
324
|
+
# Minimum visibility of a documented method. One of +:public+, +:protected+,
|
|
325
|
+
# +:private+ or +:nodoc+.
|
|
326
|
+
#
|
|
327
|
+
# The +:nodoc+ visibility ignores all directives related to visibility. The
|
|
328
|
+
# other visibilities may be overridden on a per-method basis with the :doc:
|
|
329
|
+
# directive.
|
|
331
330
|
|
|
332
|
-
|
|
333
|
-
# When set to a port number, starts a live-reloading server instead of
|
|
334
|
-
# writing files. Defaults to +false+ (no server). Set via
|
|
335
|
-
# <tt>--server[=PORT]</tt>.
|
|
331
|
+
attr_reader :visibility
|
|
336
332
|
|
|
337
|
-
|
|
333
|
+
##
|
|
334
|
+
# When set to a port number, starts a live-reloading server instead of
|
|
335
|
+
# writing files. Defaults to +false+ (no server). Set via
|
|
336
|
+
# <tt>--server[=PORT]</tt>.
|
|
338
337
|
|
|
339
|
-
|
|
340
|
-
# Indicates if files of test suites should be skipped
|
|
341
|
-
attr_accessor :skip_tests
|
|
338
|
+
attr_reader :server_port
|
|
342
339
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
attr_accessor :embed_mixins
|
|
340
|
+
##
|
|
341
|
+
# Indicates if files of test suites should be skipped
|
|
342
|
+
attr_accessor :skip_tests
|
|
347
343
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
344
|
+
##
|
|
345
|
+
# Embed mixin methods, attributes, and constants into class documentation. Set via
|
|
346
|
+
# +--[no-]embed-mixins+ (Default is +false+.)
|
|
347
|
+
attr_accessor :embed_mixins
|
|
351
348
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
349
|
+
##
|
|
350
|
+
# Exclude the default patterns as well if true.
|
|
351
|
+
attr_reader :apply_default_exclude
|
|
355
352
|
|
|
356
|
-
|
|
357
|
-
|
|
353
|
+
##
|
|
354
|
+
# Words to be ignored in autolink cross-references
|
|
355
|
+
attr_accessor :autolink_excluded_words
|
|
358
356
|
|
|
359
|
-
|
|
357
|
+
##
|
|
358
|
+
# The prefix to use for class and module page paths
|
|
360
359
|
|
|
361
|
-
|
|
362
|
-
# The prefix to use for file page paths
|
|
360
|
+
attr_accessor :class_module_path_prefix
|
|
363
361
|
|
|
364
|
-
|
|
362
|
+
##
|
|
363
|
+
# The prefix to use for file page paths
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
# The preferred root URL for the documentation
|
|
365
|
+
attr_accessor :file_path_prefix
|
|
368
366
|
|
|
369
|
-
|
|
367
|
+
##
|
|
368
|
+
# The preferred root URL for the documentation
|
|
370
369
|
|
|
371
|
-
|
|
372
|
-
# Custom footer content configuration for themes that support it.
|
|
373
|
-
# Currently only supported by the Aliki theme.
|
|
374
|
-
#
|
|
375
|
-
# A hash where keys are column titles and values are hashes of link text => URL pairs.
|
|
376
|
-
# Each column will be displayed in the upper footer section.
|
|
377
|
-
#
|
|
378
|
-
# Example:
|
|
379
|
-
# {
|
|
380
|
-
# "DOCUMENTATION" => {"Home" => "/index.html", "Guide" => "/guide.html"},
|
|
381
|
-
# "RESOURCES" => {"RDoc" => "https://ruby.github.io/rdoc/", "GitHub" => "https://github.com/ruby/rdoc"}
|
|
382
|
-
# }
|
|
370
|
+
attr_accessor :canonical_root
|
|
383
371
|
|
|
384
|
-
|
|
372
|
+
##
|
|
373
|
+
# Custom footer content configuration for themes that support it.
|
|
374
|
+
# Currently only supported by the Aliki theme.
|
|
375
|
+
#
|
|
376
|
+
# A hash where keys are column titles and values are hashes of link text => URL pairs.
|
|
377
|
+
# Each column will be displayed in the upper footer section.
|
|
378
|
+
#
|
|
379
|
+
# Example:
|
|
380
|
+
# {
|
|
381
|
+
# "DOCUMENTATION" => {"Home" => "/index.html", "Guide" => "/guide.html"},
|
|
382
|
+
# "RESOURCES" => {"RDoc" => "https://ruby.github.io/rdoc/", "GitHub" => "https://github.com/ruby/rdoc"}
|
|
383
|
+
# }
|
|
385
384
|
|
|
386
|
-
|
|
387
|
-
init_ivars
|
|
388
|
-
override loaded_options if loaded_options
|
|
389
|
-
end
|
|
385
|
+
attr_accessor :footer_content
|
|
390
386
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
def init_ivars # :nodoc:
|
|
397
|
-
@autolink_excluded_words = []
|
|
398
|
-
@dry_run = false
|
|
399
|
-
@embed_mixins = false
|
|
400
|
-
@exclude = []
|
|
401
|
-
@files = nil
|
|
402
|
-
@force_output = false
|
|
403
|
-
@force_update = true
|
|
404
|
-
@generator_name = "aliki"
|
|
405
|
-
@generators = RDoc::RDoc::GENERATORS
|
|
406
|
-
@generator_options = []
|
|
407
|
-
@hyperlink_all = false
|
|
408
|
-
@line_numbers = false
|
|
409
|
-
@locale = nil
|
|
410
|
-
@locale_name = nil
|
|
411
|
-
@locale_dir = 'locale'
|
|
412
|
-
@main_page = nil
|
|
413
|
-
@markup = 'rdoc'
|
|
414
|
-
@coverage_report = false
|
|
415
|
-
@op_dir = nil
|
|
416
|
-
@page_dir = nil
|
|
417
|
-
@pipe = false
|
|
418
|
-
@output_decoration = true
|
|
419
|
-
@rdoc_include = []
|
|
420
|
-
@root = Pathname(Dir.pwd)
|
|
421
|
-
@server_port = false
|
|
422
|
-
@show_hash = false
|
|
423
|
-
@static_path = []
|
|
424
|
-
@tab_width = 8
|
|
425
|
-
@template = nil
|
|
426
|
-
@template_dir = nil
|
|
427
|
-
@template_stylesheets = []
|
|
428
|
-
@title = nil
|
|
429
|
-
@update_output_dir = true
|
|
430
|
-
@verbosity = 1
|
|
431
|
-
@visibility = :protected
|
|
432
|
-
@warn_missing_rdoc_ref = true
|
|
433
|
-
@webcvs = nil
|
|
434
|
-
@write_options = false
|
|
435
|
-
@encoding = Encoding::UTF_8
|
|
436
|
-
@charset = @encoding.name
|
|
437
|
-
@skip_tests = true
|
|
438
|
-
@apply_default_exclude = true
|
|
439
|
-
@class_module_path_prefix = nil
|
|
440
|
-
@file_path_prefix = nil
|
|
441
|
-
@canonical_root = nil
|
|
442
|
-
@footer_content = nil
|
|
443
|
-
end
|
|
387
|
+
def initialize(loaded_options = nil) # :nodoc:
|
|
388
|
+
init_ivars
|
|
389
|
+
override loaded_options if loaded_options
|
|
390
|
+
end
|
|
444
391
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
392
|
+
DEFAULT_EXCLUDE = %w[
|
|
393
|
+
~\z \.orig\z \.rej\z \.bak\z
|
|
394
|
+
\.gemspec\z
|
|
395
|
+
]
|
|
396
|
+
|
|
397
|
+
def init_ivars # :nodoc:
|
|
398
|
+
@autolink_excluded_words = []
|
|
399
|
+
@dry_run = false
|
|
400
|
+
@embed_mixins = false
|
|
401
|
+
@exclude = []
|
|
402
|
+
@files = nil
|
|
403
|
+
@force_output = false
|
|
404
|
+
@force_update = true
|
|
405
|
+
@generator_name = "aliki"
|
|
406
|
+
@generators = RDoc::GENERATORS
|
|
407
|
+
@generator_options = []
|
|
408
|
+
@hyperlink_all = false
|
|
409
|
+
@line_numbers = false
|
|
410
|
+
@locale = nil
|
|
411
|
+
@locale_name = nil
|
|
412
|
+
@locale_dir = 'locale'
|
|
413
|
+
@main_page = nil
|
|
414
|
+
@markup = 'rdoc'
|
|
415
|
+
@coverage_report = false
|
|
416
|
+
@op_dir = nil
|
|
417
|
+
@page_dir = nil
|
|
418
|
+
@pipe = false
|
|
419
|
+
@output_decoration = true
|
|
420
|
+
@rdoc_include = []
|
|
421
|
+
@root = Pathname(Dir.pwd)
|
|
422
|
+
@server_port = false
|
|
423
|
+
@show_hash = false
|
|
424
|
+
@static_path = []
|
|
425
|
+
@tab_width = 8
|
|
426
|
+
@template = nil
|
|
427
|
+
@template_dir = nil
|
|
428
|
+
@template_stylesheets = []
|
|
429
|
+
@title = nil
|
|
430
|
+
@update_output_dir = true
|
|
431
|
+
@verbosity = 1
|
|
432
|
+
@visibility = :protected
|
|
433
|
+
@warn_missing_rdoc_ref = true
|
|
434
|
+
@webcvs = nil
|
|
435
|
+
@write_options = false
|
|
436
|
+
@encoding = ::Encoding::UTF_8
|
|
437
|
+
@charset = @encoding.name
|
|
438
|
+
@skip_tests = true
|
|
439
|
+
@apply_default_exclude = true
|
|
440
|
+
@class_module_path_prefix = nil
|
|
441
|
+
@file_path_prefix = nil
|
|
442
|
+
@canonical_root = nil
|
|
443
|
+
@footer_content = nil
|
|
444
|
+
end
|
|
476
445
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
end
|
|
446
|
+
def init_with(map) # :nodoc:
|
|
447
|
+
init_ivars
|
|
480
448
|
|
|
481
|
-
def override(map) # :nodoc:
|
|
482
|
-
if map.has_key?('encoding')
|
|
483
449
|
encoding = map['encoding']
|
|
484
|
-
@encoding = encoding ? Encoding.find(encoding) : encoding
|
|
485
|
-
|
|
450
|
+
@encoding = encoding ? ::Encoding.find(encoding) : encoding
|
|
451
|
+
|
|
452
|
+
@charset = map['charset']
|
|
453
|
+
@embed_mixins = map['embed_mixins']
|
|
454
|
+
@exclude = map['exclude']
|
|
455
|
+
@generator_name = map['generator_name']
|
|
456
|
+
@hyperlink_all = map['hyperlink_all']
|
|
457
|
+
@line_numbers = map['line_numbers']
|
|
458
|
+
@locale_name = map['locale_name']
|
|
459
|
+
@locale_dir = map['locale_dir']
|
|
460
|
+
@main_page = map['main_page']
|
|
461
|
+
@markup = map['markup']
|
|
462
|
+
@op_dir = map['op_dir']
|
|
463
|
+
@show_hash = map['show_hash']
|
|
464
|
+
@tab_width = map['tab_width']
|
|
465
|
+
@template_dir = map['template_dir']
|
|
466
|
+
@title = map['title']
|
|
467
|
+
@visibility = map['visibility']
|
|
468
|
+
@webcvs = map['webcvs']
|
|
469
|
+
|
|
470
|
+
@apply_default_exclude = map['apply_default_exclude']
|
|
471
|
+
@autolink_excluded_words = map['autolink_excluded_words']
|
|
472
|
+
@footer_content = map['footer_content']
|
|
486
473
|
|
|
487
|
-
@charset = map['charset'] if map.has_key?('charset')
|
|
488
|
-
@embed_mixins = map['embed_mixins'] if map.has_key?('embed_mixins')
|
|
489
|
-
@exclude = map['exclude'] if map.has_key?('exclude')
|
|
490
|
-
@generator_name = map['generator_name'] if map.has_key?('generator_name')
|
|
491
|
-
@hyperlink_all = map['hyperlink_all'] if map.has_key?('hyperlink_all')
|
|
492
|
-
@line_numbers = map['line_numbers'] if map.has_key?('line_numbers')
|
|
493
|
-
@locale_name = map['locale_name'] if map.has_key?('locale_name')
|
|
494
|
-
@locale_dir = map['locale_dir'] if map.has_key?('locale_dir')
|
|
495
|
-
@main_page = map['main_page'] if map.has_key?('main_page')
|
|
496
|
-
@markup = map['markup'] if map.has_key?('markup')
|
|
497
|
-
@op_dir = map['op_dir'] if map.has_key?('op_dir')
|
|
498
|
-
@page_dir = map['page_dir'] if map.has_key?('page_dir')
|
|
499
|
-
@show_hash = map['show_hash'] if map.has_key?('show_hash')
|
|
500
|
-
@tab_width = map['tab_width'] if map.has_key?('tab_width')
|
|
501
|
-
@template_dir = map['template_dir'] if map.has_key?('template_dir')
|
|
502
|
-
@title = map['title'] if map.has_key?('title')
|
|
503
|
-
@visibility = map['visibility'] if map.has_key?('visibility')
|
|
504
|
-
@webcvs = map['webcvs'] if map.has_key?('webcvs')
|
|
505
|
-
@autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
|
|
506
|
-
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
|
|
507
|
-
@canonical_root = map['canonical_root'] if map.has_key?('canonical_root')
|
|
508
|
-
@footer_content = map['footer_content'] if map.has_key?('footer_content')
|
|
509
|
-
|
|
510
|
-
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
|
|
511
|
-
|
|
512
|
-
if map.has_key?('rdoc_include')
|
|
513
474
|
@rdoc_include = sanitize_path map['rdoc_include']
|
|
514
|
-
end
|
|
515
|
-
if map.has_key?('static_path')
|
|
516
475
|
@static_path = sanitize_path map['static_path']
|
|
517
476
|
end
|
|
518
|
-
end
|
|
519
477
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
@embed_mixins == other.embed_mixins and
|
|
524
|
-
@generator_name == other.generator_name and
|
|
525
|
-
@hyperlink_all == other.hyperlink_all and
|
|
526
|
-
@line_numbers == other.line_numbers and
|
|
527
|
-
@locale == other.locale and
|
|
528
|
-
@locale_dir == other.locale_dir and
|
|
529
|
-
@main_page == other.main_page and
|
|
530
|
-
@markup == other.markup and
|
|
531
|
-
@op_dir == other.op_dir and
|
|
532
|
-
@rdoc_include == other.rdoc_include and
|
|
533
|
-
@show_hash == other.show_hash and
|
|
534
|
-
@static_path == other.static_path and
|
|
535
|
-
@tab_width == other.tab_width and
|
|
536
|
-
@template == other.template and
|
|
537
|
-
@title == other.title and
|
|
538
|
-
@visibility == other.visibility and
|
|
539
|
-
@webcvs == other.webcvs and
|
|
540
|
-
@apply_default_exclude == other.apply_default_exclude and
|
|
541
|
-
@autolink_excluded_words == other.autolink_excluded_words
|
|
542
|
-
end
|
|
478
|
+
def yaml_initialize(tag, map) # :nodoc:
|
|
479
|
+
init_with map
|
|
480
|
+
end
|
|
543
481
|
|
|
544
|
-
|
|
545
|
-
|
|
482
|
+
def override(map) # :nodoc:
|
|
483
|
+
if map.has_key?('encoding')
|
|
484
|
+
encoding = map['encoding']
|
|
485
|
+
@encoding = encoding ? ::Encoding.find(encoding) : encoding
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
@charset = map['charset'] if map.has_key?('charset')
|
|
489
|
+
@embed_mixins = map['embed_mixins'] if map.has_key?('embed_mixins')
|
|
490
|
+
@exclude = map['exclude'] if map.has_key?('exclude')
|
|
491
|
+
@generator_name = map['generator_name'] if map.has_key?('generator_name')
|
|
492
|
+
@hyperlink_all = map['hyperlink_all'] if map.has_key?('hyperlink_all')
|
|
493
|
+
@line_numbers = map['line_numbers'] if map.has_key?('line_numbers')
|
|
494
|
+
@locale_name = map['locale_name'] if map.has_key?('locale_name')
|
|
495
|
+
@locale_dir = map['locale_dir'] if map.has_key?('locale_dir')
|
|
496
|
+
@main_page = map['main_page'] if map.has_key?('main_page')
|
|
497
|
+
@markup = map['markup'] if map.has_key?('markup')
|
|
498
|
+
@op_dir = map['op_dir'] if map.has_key?('op_dir')
|
|
499
|
+
@page_dir = map['page_dir'] if map.has_key?('page_dir')
|
|
500
|
+
@show_hash = map['show_hash'] if map.has_key?('show_hash')
|
|
501
|
+
@tab_width = map['tab_width'] if map.has_key?('tab_width')
|
|
502
|
+
@template_dir = map['template_dir'] if map.has_key?('template_dir')
|
|
503
|
+
@title = map['title'] if map.has_key?('title')
|
|
504
|
+
@visibility = map['visibility'] if map.has_key?('visibility')
|
|
505
|
+
@webcvs = map['webcvs'] if map.has_key?('webcvs')
|
|
506
|
+
@autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
|
|
507
|
+
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
|
|
508
|
+
@canonical_root = map['canonical_root'] if map.has_key?('canonical_root')
|
|
509
|
+
@footer_content = map['footer_content'] if map.has_key?('footer_content')
|
|
510
|
+
|
|
511
|
+
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
|
|
512
|
+
|
|
513
|
+
if map.has_key?('rdoc_include')
|
|
514
|
+
@rdoc_include = sanitize_path map['rdoc_include']
|
|
515
|
+
end
|
|
516
|
+
if map.has_key?('static_path')
|
|
517
|
+
@static_path = sanitize_path map['static_path']
|
|
518
|
+
end
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
def ==(other) # :nodoc:
|
|
522
|
+
self.class === other and
|
|
523
|
+
@encoding == other.encoding and
|
|
524
|
+
@embed_mixins == other.embed_mixins and
|
|
525
|
+
@generator_name == other.generator_name and
|
|
526
|
+
@hyperlink_all == other.hyperlink_all and
|
|
527
|
+
@line_numbers == other.line_numbers and
|
|
528
|
+
@locale == other.locale and
|
|
529
|
+
@locale_dir == other.locale_dir and
|
|
530
|
+
@main_page == other.main_page and
|
|
531
|
+
@markup == other.markup and
|
|
532
|
+
@op_dir == other.op_dir and
|
|
533
|
+
@rdoc_include == other.rdoc_include and
|
|
534
|
+
@show_hash == other.show_hash and
|
|
535
|
+
@static_path == other.static_path and
|
|
536
|
+
@tab_width == other.tab_width and
|
|
537
|
+
@template == other.template and
|
|
538
|
+
@title == other.title and
|
|
539
|
+
@visibility == other.visibility and
|
|
540
|
+
@webcvs == other.webcvs and
|
|
541
|
+
@apply_default_exclude == other.apply_default_exclude and
|
|
542
|
+
@autolink_excluded_words == other.autolink_excluded_words
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
##
|
|
546
|
+
# Check that the files on the command line exist
|
|
546
547
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
548
|
+
def check_files
|
|
549
|
+
@files.delete_if do |file|
|
|
550
|
+
if File.exist? file
|
|
551
|
+
if File.readable? file
|
|
552
|
+
false
|
|
553
|
+
else
|
|
554
|
+
warn "file '#{file}' not readable"
|
|
555
|
+
|
|
556
|
+
true
|
|
557
|
+
end
|
|
552
558
|
else
|
|
553
|
-
warn "file '#{file}' not
|
|
559
|
+
warn "file '#{file}' not found"
|
|
554
560
|
|
|
555
561
|
true
|
|
556
562
|
end
|
|
557
|
-
else
|
|
558
|
-
warn "file '#{file}' not found"
|
|
559
|
-
|
|
560
|
-
true
|
|
561
563
|
end
|
|
562
564
|
end
|
|
563
|
-
end
|
|
564
565
|
|
|
565
|
-
|
|
566
|
-
|
|
566
|
+
##
|
|
567
|
+
# Ensure only one generator is loaded
|
|
567
568
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
569
|
+
def check_generator
|
|
570
|
+
if @generator
|
|
571
|
+
raise OptionParser::InvalidOption,
|
|
572
|
+
"generator already set to #{@generator_name}"
|
|
573
|
+
end
|
|
572
574
|
end
|
|
573
|
-
end
|
|
574
575
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
576
|
+
##
|
|
577
|
+
# Set the title, but only if not already set. Used to set the title
|
|
578
|
+
# from a source file, so that a title set from the command line
|
|
579
|
+
# will have the priority.
|
|
579
580
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
581
|
+
def default_title=(string)
|
|
582
|
+
@title ||= string
|
|
583
|
+
end
|
|
583
584
|
|
|
584
|
-
|
|
585
|
-
|
|
585
|
+
##
|
|
586
|
+
# For dumping YAML
|
|
586
587
|
|
|
587
|
-
|
|
588
|
-
|
|
588
|
+
def to_yaml(*options) # :nodoc:
|
|
589
|
+
encoding = @encoding ? @encoding.name : nil
|
|
589
590
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
591
|
+
yaml = {}
|
|
592
|
+
yaml['encoding'] = encoding
|
|
593
|
+
yaml['static_path'] = sanitize_path(@static_path)
|
|
594
|
+
yaml['rdoc_include'] = sanitize_path(@rdoc_include)
|
|
595
|
+
yaml['page_dir'] = (sanitize_path([@page_dir]).first if @page_dir)
|
|
595
596
|
|
|
596
|
-
|
|
597
|
-
|
|
597
|
+
ivars = instance_variables.map { |ivar| ivar.to_s[1..-1] }
|
|
598
|
+
ivars -= SPECIAL
|
|
598
599
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
600
|
+
ivars.sort.each do |ivar|
|
|
601
|
+
yaml[ivar] = instance_variable_get("@#{ivar}")
|
|
602
|
+
end
|
|
602
603
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
604
|
+
if yaml.respond_to?(:to_yaml)
|
|
605
|
+
yaml.to_yaml
|
|
606
|
+
else
|
|
607
|
+
::RDoc.yaml_serializer.dump(yaml)
|
|
608
|
+
end
|
|
607
609
|
end
|
|
608
|
-
end
|
|
609
610
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
611
|
+
##
|
|
612
|
+
# Create a regexp for #exclude
|
|
613
|
+
|
|
614
|
+
def exclude
|
|
615
|
+
if @exclude.nil? or Regexp === @exclude
|
|
616
|
+
# done, #finish is being re-run
|
|
617
|
+
@exclude
|
|
618
|
+
elsif !@apply_default_exclude and @exclude.empty?
|
|
619
|
+
nil
|
|
620
|
+
else
|
|
621
|
+
exclude = @exclude
|
|
622
|
+
exclude |= DEFAULT_EXCLUDE if @apply_default_exclude
|
|
623
|
+
Regexp.new(exclude.join("|"))
|
|
624
|
+
end
|
|
623
625
|
end
|
|
624
|
-
end
|
|
625
626
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
627
|
+
##
|
|
628
|
+
# Completes any unfinished option setup business such as filtering for
|
|
629
|
+
# existent files, creating a regexp for #exclude and setting a default
|
|
630
|
+
# #template.
|
|
630
631
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
632
|
+
def finish
|
|
633
|
+
if @write_options
|
|
634
|
+
write_options
|
|
635
|
+
exit
|
|
636
|
+
end
|
|
636
637
|
|
|
637
|
-
|
|
638
|
+
@op_dir ||= 'doc'
|
|
638
639
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
640
|
+
root = @root.to_s
|
|
641
|
+
if @rdoc_include.empty? || !@rdoc_include.include?(root)
|
|
642
|
+
@rdoc_include << root
|
|
643
|
+
end
|
|
643
644
|
|
|
644
|
-
|
|
645
|
+
@exclude = self.exclude
|
|
645
646
|
|
|
646
|
-
|
|
647
|
+
finish_page_dir
|
|
647
648
|
|
|
648
|
-
|
|
649
|
+
check_files
|
|
649
650
|
|
|
650
|
-
|
|
651
|
-
|
|
651
|
+
# If no template was specified, use the default template for the output
|
|
652
|
+
# formatter
|
|
652
653
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
654
|
+
unless @template
|
|
655
|
+
@template = @generator_name
|
|
656
|
+
@template_dir = template_dir_for @template
|
|
657
|
+
end
|
|
657
658
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
659
|
+
if @locale_name
|
|
660
|
+
@locale = I18n::Locale[@locale_name]
|
|
661
|
+
@locale.load(@locale_dir)
|
|
662
|
+
else
|
|
663
|
+
@locale = nil
|
|
664
|
+
end
|
|
665
|
+
|
|
666
|
+
self
|
|
663
667
|
end
|
|
664
668
|
|
|
665
|
-
|
|
666
|
-
|
|
669
|
+
##
|
|
670
|
+
# Fixes the page_dir to be relative to the root_dir and adds the page_dir to
|
|
671
|
+
# the files list.
|
|
667
672
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
# the files list.
|
|
673
|
+
def finish_page_dir
|
|
674
|
+
return unless @page_dir
|
|
671
675
|
|
|
672
|
-
|
|
673
|
-
return unless @page_dir
|
|
676
|
+
@files << @page_dir
|
|
674
677
|
|
|
675
|
-
|
|
678
|
+
page_dir = Pathname(@page_dir)
|
|
679
|
+
begin
|
|
680
|
+
page_dir = page_dir.expand_path.relative_path_from @root
|
|
681
|
+
rescue ArgumentError
|
|
682
|
+
# On Windows, sometimes crosses different drive letters.
|
|
683
|
+
page_dir = page_dir.expand_path
|
|
684
|
+
end
|
|
676
685
|
|
|
677
|
-
|
|
678
|
-
begin
|
|
679
|
-
page_dir = page_dir.expand_path.relative_path_from @root
|
|
680
|
-
rescue ArgumentError
|
|
681
|
-
# On Windows, sometimes crosses different drive letters.
|
|
682
|
-
page_dir = page_dir.expand_path
|
|
686
|
+
@page_dir = page_dir
|
|
683
687
|
end
|
|
684
688
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
##
|
|
689
|
-
# Returns a properly-space list of generators and their descriptions.
|
|
689
|
+
##
|
|
690
|
+
# Returns a properly-space list of generators and their descriptions.
|
|
690
691
|
|
|
691
|
-
|
|
692
|
-
|
|
692
|
+
def generator_descriptions
|
|
693
|
+
lengths = []
|
|
693
694
|
|
|
694
|
-
|
|
695
|
-
|
|
695
|
+
generators = RDoc::GENERATORS.map do |name, generator|
|
|
696
|
+
lengths << name.length
|
|
696
697
|
|
|
697
|
-
|
|
698
|
-
|
|
698
|
+
description = generator::DESCRIPTION if
|
|
699
|
+
generator.const_defined? :DESCRIPTION
|
|
699
700
|
|
|
700
|
-
|
|
701
|
-
|
|
701
|
+
[name, description]
|
|
702
|
+
end
|
|
702
703
|
|
|
703
|
-
|
|
704
|
+
longest = lengths.max
|
|
704
705
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
706
|
+
generators.sort.map do |name, description|
|
|
707
|
+
if description
|
|
708
|
+
" %-*s - %s" % [longest, name, description]
|
|
709
|
+
else
|
|
710
|
+
" #{name}"
|
|
711
|
+
end
|
|
712
|
+
end.join "\n"
|
|
713
|
+
end
|
|
713
714
|
|
|
714
|
-
|
|
715
|
-
|
|
715
|
+
##
|
|
716
|
+
# Parses command line options.
|
|
716
717
|
|
|
717
|
-
|
|
718
|
-
|
|
718
|
+
def parse(argv)
|
|
719
|
+
ignore_invalid = true
|
|
719
720
|
|
|
720
|
-
|
|
721
|
+
argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']
|
|
721
722
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
723
|
+
opts = OptionParser.new do |opt|
|
|
724
|
+
@option_parser = opt
|
|
725
|
+
opt.program_name = File.basename $0
|
|
726
|
+
opt.version = VERSION
|
|
727
|
+
opt.release = nil
|
|
728
|
+
opt.summary_indent = ' ' * 4
|
|
729
|
+
opt.banner = <<-EOF
|
|
729
730
|
Usage: #{opt.program_name} [options] [names...]
|
|
730
731
|
|
|
731
732
|
Files are parsed, and the information they contain collected, before any
|
|
@@ -753,660 +754,661 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
753
754
|
|
|
754
755
|
EOF
|
|
755
756
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
RDoc::Parser.parsers.each do |regexp, parser|
|
|
759
|
-
parsers[parser.name.sub('RDoc::Parser::', '')] << regexp.source
|
|
760
|
-
end
|
|
761
|
-
|
|
762
|
-
parsers.sort.each do |parser, regexp|
|
|
763
|
-
opt.banner += " - #{parser}: #{regexp.join ', '}\n"
|
|
764
|
-
end
|
|
765
|
-
opt.banner += " - TomDoc: Only in ruby files\n"
|
|
766
|
-
|
|
767
|
-
opt.accept Template do |template|
|
|
768
|
-
template_dir = template_dir_for template
|
|
757
|
+
parsers = Hash.new { |h, parser| h[parser] = [] }
|
|
769
758
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
nil
|
|
773
|
-
else
|
|
774
|
-
[template, template_dir]
|
|
759
|
+
Parser.parsers.each do |regexp, parser|
|
|
760
|
+
parsers[parser.name.sub('RDoc::Parser::', '')] << regexp.source
|
|
775
761
|
end
|
|
776
|
-
end
|
|
777
|
-
|
|
778
|
-
opt.accept Directory do |directory|
|
|
779
|
-
directory = File.expand_path directory
|
|
780
762
|
|
|
781
|
-
|
|
763
|
+
parsers.sort.each do |parser, regexp|
|
|
764
|
+
opt.banner += " - #{parser}: #{regexp.join ', '}\n"
|
|
765
|
+
end
|
|
766
|
+
opt.banner += " - TomDoc: Only in ruby files\n"
|
|
782
767
|
|
|
783
|
-
|
|
784
|
-
|
|
768
|
+
opt.accept Template do |template|
|
|
769
|
+
template_dir = template_dir_for template
|
|
785
770
|
|
|
786
|
-
|
|
787
|
-
|
|
771
|
+
unless template_dir
|
|
772
|
+
$stderr.puts "could not find template #{template}"
|
|
773
|
+
nil
|
|
774
|
+
else
|
|
775
|
+
[template, template_dir]
|
|
776
|
+
end
|
|
777
|
+
end
|
|
788
778
|
|
|
789
|
-
|
|
779
|
+
opt.accept Directory do |directory|
|
|
780
|
+
directory = File.expand_path directory
|
|
790
781
|
|
|
791
|
-
|
|
792
|
-
end
|
|
782
|
+
raise OptionParser::InvalidArgument unless File.directory? directory
|
|
793
783
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
paths.split(',').map { |d| d unless d.empty? }
|
|
797
|
-
end
|
|
784
|
+
directory
|
|
785
|
+
end
|
|
798
786
|
|
|
799
|
-
|
|
787
|
+
opt.accept Path do |path|
|
|
800
788
|
path = File.expand_path path
|
|
801
789
|
|
|
802
790
|
raise OptionParser::InvalidArgument unless File.exist? path
|
|
803
791
|
|
|
804
792
|
path
|
|
805
793
|
end
|
|
806
|
-
end
|
|
807
794
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
795
|
+
opt.accept PathArray do |paths,|
|
|
796
|
+
paths = if paths
|
|
797
|
+
paths.split(',').map { |d| d unless d.empty? }
|
|
798
|
+
end
|
|
811
799
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
"read will be converted to this encoding.",
|
|
815
|
-
"The default encoding is UTF-8.",
|
|
816
|
-
"--encoding is preferred over --charset") do |value|
|
|
817
|
-
@encoding = Encoding.find value
|
|
818
|
-
@charset = @encoding.name # may not be valid value
|
|
819
|
-
end
|
|
800
|
+
paths.map do |path|
|
|
801
|
+
path = File.expand_path path
|
|
820
802
|
|
|
821
|
-
|
|
803
|
+
raise OptionParser::InvalidArgument unless File.exist? path
|
|
822
804
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
end
|
|
805
|
+
path
|
|
806
|
+
end
|
|
807
|
+
end
|
|
827
808
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
end
|
|
809
|
+
opt.separator nil
|
|
810
|
+
opt.separator "Parsing options:"
|
|
811
|
+
opt.separator nil
|
|
832
812
|
|
|
833
|
-
|
|
813
|
+
opt.on("--encoding=ENCODING", "-e", ::Encoding.list.map { |e| e.name },
|
|
814
|
+
"Specifies the output encoding. All files",
|
|
815
|
+
"read will be converted to this encoding.",
|
|
816
|
+
"The default encoding is UTF-8.",
|
|
817
|
+
"--encoding is preferred over --charset") do |value|
|
|
818
|
+
@encoding = ::Encoding.find value
|
|
819
|
+
@charset = @encoding.name # may not be valid value
|
|
820
|
+
end
|
|
834
821
|
|
|
835
|
-
|
|
836
|
-
"Synonym for --visibility=private.") do |value|
|
|
837
|
-
@visibility = :private
|
|
838
|
-
end
|
|
822
|
+
opt.separator nil
|
|
839
823
|
|
|
840
|
-
|
|
824
|
+
opt.on("--locale=NAME",
|
|
825
|
+
"Specifies the output locale.") do |value|
|
|
826
|
+
@locale_name = value
|
|
827
|
+
end
|
|
841
828
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
end
|
|
829
|
+
opt.on("--locale-data-dir=DIR",
|
|
830
|
+
"Specifies the directory where locale data live.") do |value|
|
|
831
|
+
@locale_dir = value
|
|
832
|
+
end
|
|
847
833
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
834
|
+
opt.separator nil
|
|
835
|
+
|
|
836
|
+
opt.on("--all", "-a",
|
|
837
|
+
"Synonym for --visibility=private.") do |value|
|
|
838
|
+
@visibility = :private
|
|
839
|
+
end
|
|
852
840
|
|
|
853
|
-
|
|
841
|
+
opt.separator nil
|
|
854
842
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
843
|
+
opt.on("--exclude=PATTERN", "-x", Regexp,
|
|
844
|
+
"Do not process files or directories",
|
|
845
|
+
"matching PATTERN.") do |value|
|
|
846
|
+
@exclude << value
|
|
847
|
+
end
|
|
859
848
|
|
|
860
|
-
|
|
849
|
+
opt.on("--[no-]apply-default-exclude",
|
|
850
|
+
"Use default PATTERN to exclude.") do |value|
|
|
851
|
+
@apply_default_exclude = value
|
|
852
|
+
end
|
|
861
853
|
|
|
862
|
-
|
|
863
|
-
"Treat files ending with .new as if they",
|
|
864
|
-
"ended with .old. Using '-E cgi=rb' will",
|
|
865
|
-
"cause xxx.cgi to be parsed as a Ruby file.") do |value|
|
|
866
|
-
new, old = value.split(/=/, 2)
|
|
854
|
+
opt.separator nil
|
|
867
855
|
|
|
868
|
-
|
|
869
|
-
|
|
856
|
+
opt.on("--no-skipping-tests", nil,
|
|
857
|
+
"Don't skip generating documentation for test and spec files") do |value|
|
|
858
|
+
@skip_tests = false
|
|
870
859
|
end
|
|
871
860
|
|
|
872
|
-
|
|
873
|
-
|
|
861
|
+
opt.separator nil
|
|
862
|
+
|
|
863
|
+
opt.on("--extension=NEW=OLD", "-E",
|
|
864
|
+
"Treat files ending with .new as if they",
|
|
865
|
+
"ended with .old. Using '-E cgi=rb' will",
|
|
866
|
+
"cause xxx.cgi to be parsed as a Ruby file.") do |value|
|
|
867
|
+
new, old = value.split(/=/, 2)
|
|
868
|
+
|
|
869
|
+
unless new and old
|
|
870
|
+
raise OptionParser::InvalidArgument, "Invalid parameter to '-E'"
|
|
871
|
+
end
|
|
872
|
+
|
|
873
|
+
unless Parser.alias_extension old, new
|
|
874
|
+
raise OptionParser::InvalidArgument, "Unknown extension .#{old} to -E"
|
|
875
|
+
end
|
|
874
876
|
end
|
|
875
|
-
end
|
|
876
877
|
|
|
877
|
-
|
|
878
|
+
opt.separator nil
|
|
878
879
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
880
|
+
opt.on("--[no-]force-update", "-U",
|
|
881
|
+
"Forces rdoc to scan all sources even if",
|
|
882
|
+
"no files are newer than the flag file.") do |value|
|
|
883
|
+
@force_update = value
|
|
884
|
+
end
|
|
884
885
|
|
|
885
|
-
|
|
886
|
+
opt.separator nil
|
|
886
887
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
888
|
+
opt.on("--pipe", "-p",
|
|
889
|
+
"Convert RDoc on stdin to HTML") do
|
|
890
|
+
@pipe = true
|
|
891
|
+
end
|
|
891
892
|
|
|
892
|
-
|
|
893
|
+
opt.separator nil
|
|
893
894
|
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
895
|
+
opt.on("--tab-width=WIDTH", "-w", Integer,
|
|
896
|
+
"Set the width of tab characters.") do |value|
|
|
897
|
+
raise OptionParser::InvalidArgument,
|
|
898
|
+
"#{value} is an invalid tab width" if value <= 0
|
|
899
|
+
@tab_width = value
|
|
900
|
+
end
|
|
900
901
|
|
|
901
|
-
|
|
902
|
+
opt.separator nil
|
|
902
903
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
904
|
+
opt.on("--visibility=VISIBILITY", VISIBILITIES + [:nodoc],
|
|
905
|
+
"Minimum visibility to document a method.",
|
|
906
|
+
"One of 'public', 'protected' (the default),",
|
|
907
|
+
"'private' or 'nodoc' (show everything)") do |value|
|
|
908
|
+
@visibility = value
|
|
909
|
+
end
|
|
909
910
|
|
|
910
|
-
|
|
911
|
+
opt.separator nil
|
|
911
912
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
913
|
+
opt.on("--[no-]embed-mixins",
|
|
914
|
+
"Embed mixin methods, attributes, and constants",
|
|
915
|
+
"into class documentation. (default false)") do |value|
|
|
916
|
+
@embed_mixins = value
|
|
917
|
+
end
|
|
917
918
|
|
|
918
|
-
|
|
919
|
+
opt.separator nil
|
|
919
920
|
|
|
920
|
-
|
|
921
|
+
markup_formats = Text::MARKUP_FORMAT.keys.sort
|
|
921
922
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
923
|
+
opt.on("--markup=MARKUP", markup_formats,
|
|
924
|
+
"The markup format for the named files.",
|
|
925
|
+
"The default is rdoc. Valid values are:",
|
|
926
|
+
markup_formats.join(', ')) do |value|
|
|
927
|
+
@markup = value
|
|
928
|
+
end
|
|
928
929
|
|
|
929
|
-
|
|
930
|
+
opt.separator nil
|
|
930
931
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
932
|
+
opt.on("--root=ROOT", Directory,
|
|
933
|
+
"Root of the source tree documentation",
|
|
934
|
+
"will be generated for. Set this when",
|
|
935
|
+
"building documentation outside the",
|
|
936
|
+
"source directory. Default is the",
|
|
937
|
+
"current directory.") do |root|
|
|
938
|
+
@root = Pathname(root)
|
|
939
|
+
end
|
|
939
940
|
|
|
940
|
-
|
|
941
|
+
opt.separator nil
|
|
941
942
|
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
943
|
+
opt.on("--page-dir=DIR", Directory,
|
|
944
|
+
"Directory where guides, your FAQ or",
|
|
945
|
+
"other pages not associated with a class",
|
|
946
|
+
"live. Set this when you don't store",
|
|
947
|
+
"such files at your project root.",
|
|
948
|
+
"NOTE: Do not use the same file name in",
|
|
949
|
+
"the page dir and the root of your project") do |page_dir|
|
|
950
|
+
@page_dir = page_dir
|
|
951
|
+
end
|
|
951
952
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
953
|
+
opt.separator nil
|
|
954
|
+
opt.separator "Common generator options:"
|
|
955
|
+
opt.separator nil
|
|
955
956
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
957
|
+
opt.on("--force-output", "-O",
|
|
958
|
+
"Forces rdoc to write the output files,",
|
|
959
|
+
"even if the output directory exists",
|
|
960
|
+
"and does not seem to have been created",
|
|
961
|
+
"by rdoc.") do |value|
|
|
962
|
+
@force_output = value
|
|
963
|
+
end
|
|
963
964
|
|
|
964
|
-
|
|
965
|
+
opt.separator nil
|
|
965
966
|
|
|
966
|
-
|
|
967
|
+
generator_text = @generators.keys.map { |name| " #{name}" }.sort
|
|
967
968
|
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
969
|
+
opt.on("-f", "--fmt=FORMAT", "--format=FORMAT", @generators.keys,
|
|
970
|
+
"Set the output formatter. One of:", *generator_text) do |value|
|
|
971
|
+
check_generator
|
|
971
972
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
973
|
+
@generator_name = value.downcase
|
|
974
|
+
setup_generator
|
|
975
|
+
end
|
|
975
976
|
|
|
976
|
-
|
|
977
|
+
opt.separator nil
|
|
977
978
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
979
|
+
opt.on("--include=DIRECTORIES", "-i", PathArray,
|
|
980
|
+
"Set (or add to) the list of directories to",
|
|
981
|
+
"be searched when satisfying :include:",
|
|
982
|
+
"requests. Can be used more than once.") do |value|
|
|
983
|
+
@rdoc_include.concat value.map { |dir| dir.strip }
|
|
984
|
+
end
|
|
984
985
|
|
|
985
|
-
|
|
986
|
+
opt.separator nil
|
|
986
987
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
988
|
+
opt.on("--[no-]coverage-report=[LEVEL]", "--[no-]dcov", "-C", Integer,
|
|
989
|
+
"Prints a report on undocumented items.",
|
|
990
|
+
"Does not generate files.") do |value|
|
|
991
|
+
value = 0 if value.nil? # Integer converts -C to nil
|
|
991
992
|
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
993
|
+
@coverage_report = value
|
|
994
|
+
@force_update = true if value
|
|
995
|
+
end
|
|
995
996
|
|
|
996
|
-
|
|
997
|
+
opt.separator nil
|
|
997
998
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
999
|
+
opt.on("--output=DIR", "--op", "-o",
|
|
1000
|
+
"Set the output directory.") do |value|
|
|
1001
|
+
@op_dir = value
|
|
1002
|
+
end
|
|
1002
1003
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1004
|
+
opt.separator nil
|
|
1005
|
+
opt.separator 'HTML generator options:'
|
|
1006
|
+
opt.separator nil
|
|
1006
1007
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1008
|
+
opt.on("--charset=CHARSET", "-c",
|
|
1009
|
+
"Specifies the output HTML character-set.",
|
|
1010
|
+
"Use --encoding instead of --charset if",
|
|
1011
|
+
"available.") do |value|
|
|
1012
|
+
@charset = value
|
|
1013
|
+
end
|
|
1013
1014
|
|
|
1014
|
-
|
|
1015
|
+
opt.separator nil
|
|
1015
1016
|
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1017
|
+
opt.on("--autolink-excluded-words=WORDS", Array,
|
|
1018
|
+
"Words to be ignored in autolink cross-references") do |value|
|
|
1019
|
+
@autolink_excluded_words.concat value
|
|
1020
|
+
end
|
|
1020
1021
|
|
|
1021
|
-
|
|
1022
|
+
opt.separator nil
|
|
1022
1023
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1024
|
+
opt.on("--hyperlink-all", "-A",
|
|
1025
|
+
"Generate hyperlinks for all words that",
|
|
1026
|
+
"correspond to known methods, even if they",
|
|
1027
|
+
"do not start with '#' or '::' (legacy",
|
|
1028
|
+
"behavior).") do |value|
|
|
1029
|
+
@hyperlink_all = value
|
|
1030
|
+
end
|
|
1030
1031
|
|
|
1031
|
-
|
|
1032
|
+
opt.separator nil
|
|
1032
1033
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1034
|
+
opt.on("--main=NAME", "-m",
|
|
1035
|
+
"NAME will be the initial page displayed.") do |value|
|
|
1036
|
+
@main_page = value
|
|
1037
|
+
end
|
|
1037
1038
|
|
|
1038
|
-
|
|
1039
|
+
opt.separator nil
|
|
1039
1040
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1041
|
+
opt.on("--[no-]line-numbers", "-N",
|
|
1042
|
+
"Include line numbers in the source code.",
|
|
1043
|
+
"By default, only the number of the first",
|
|
1044
|
+
"line is displayed, in a leading comment.") do |value|
|
|
1045
|
+
@line_numbers = value
|
|
1046
|
+
end
|
|
1046
1047
|
|
|
1047
|
-
|
|
1048
|
+
opt.separator nil
|
|
1048
1049
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1050
|
+
opt.on("--show-hash", "-H",
|
|
1051
|
+
"A name of the form #name in a comment is a",
|
|
1052
|
+
"possible hyperlink to an instance method",
|
|
1053
|
+
"name. When displayed, the '#' is removed",
|
|
1054
|
+
"unless this option is specified.") do |value|
|
|
1055
|
+
@show_hash = value
|
|
1056
|
+
end
|
|
1056
1057
|
|
|
1057
|
-
|
|
1058
|
+
opt.separator nil
|
|
1058
1059
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1060
|
+
opt.on("--template=NAME", "-T", Template,
|
|
1061
|
+
"Set the template used when generating",
|
|
1062
|
+
"output. The default depends on the",
|
|
1063
|
+
"formatter used.") do |(template, template_dir)|
|
|
1064
|
+
@template = template
|
|
1065
|
+
@template_dir = template_dir
|
|
1066
|
+
end
|
|
1066
1067
|
|
|
1067
|
-
|
|
1068
|
+
opt.separator nil
|
|
1068
1069
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1070
|
+
opt.on("--template-stylesheets=FILES", PathArray,
|
|
1071
|
+
"Set (or add to) the list of files to",
|
|
1072
|
+
"include with the html template.") do |value|
|
|
1073
|
+
@template_stylesheets.concat value
|
|
1074
|
+
end
|
|
1074
1075
|
|
|
1075
|
-
|
|
1076
|
+
opt.separator nil
|
|
1076
1077
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1078
|
+
opt.on("--title=TITLE", "-t",
|
|
1079
|
+
"Set TITLE as the title for HTML output.") do |value|
|
|
1080
|
+
@title = value
|
|
1081
|
+
end
|
|
1081
1082
|
|
|
1082
|
-
|
|
1083
|
+
opt.separator nil
|
|
1083
1084
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1085
|
+
opt.on("--copy-files=PATH", Path,
|
|
1086
|
+
"Specify a file or directory to copy static",
|
|
1087
|
+
"files from.",
|
|
1088
|
+
"If a file is given it will be copied into",
|
|
1089
|
+
"the output dir. If a directory is given the",
|
|
1090
|
+
"entire directory will be copied.",
|
|
1091
|
+
"You can use this multiple times") do |value|
|
|
1092
|
+
@static_path << value
|
|
1093
|
+
end
|
|
1093
1094
|
|
|
1094
|
-
|
|
1095
|
+
opt.separator nil
|
|
1095
1096
|
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1097
|
+
opt.on("--webcvs=URL", "-W",
|
|
1098
|
+
"Specify a URL for linking to a web frontend",
|
|
1099
|
+
"to CVS. If the URL contains a '\%s', the",
|
|
1100
|
+
"name of the current file will be",
|
|
1101
|
+
"substituted; if the URL doesn't contain a",
|
|
1102
|
+
"'\%s', the filename will be appended to it.") do |value|
|
|
1103
|
+
@webcvs = value
|
|
1104
|
+
end
|
|
1104
1105
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1106
|
+
opt.separator nil
|
|
1107
|
+
opt.separator "ri generator options:"
|
|
1108
|
+
opt.separator nil
|
|
1109
|
+
|
|
1110
|
+
opt.on("--ri", "-r",
|
|
1111
|
+
"Generate output for use by `ri`. The files",
|
|
1112
|
+
"are stored in the '.rdoc' directory under",
|
|
1113
|
+
"your home directory unless overridden by a",
|
|
1114
|
+
"subsequent --op parameter, so no special",
|
|
1115
|
+
"privileges are needed.") do |value|
|
|
1116
|
+
check_generator
|
|
1117
|
+
|
|
1118
|
+
@generator_name = "ri"
|
|
1119
|
+
@op_dir ||= RI::Paths::HOMEDIR
|
|
1120
|
+
setup_generator
|
|
1121
|
+
end
|
|
1121
1122
|
|
|
1122
|
-
|
|
1123
|
+
opt.separator nil
|
|
1123
1124
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1125
|
+
opt.on("--ri-site", "-R",
|
|
1126
|
+
"Generate output for use by `ri`. The files",
|
|
1127
|
+
"are stored in a site-wide directory,",
|
|
1128
|
+
"making them accessible to others, so",
|
|
1129
|
+
"special privileges are needed.") do |value|
|
|
1130
|
+
check_generator
|
|
1130
1131
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1132
|
+
@generator_name = "ri"
|
|
1133
|
+
@op_dir = RI::Paths.site_dir
|
|
1134
|
+
setup_generator
|
|
1135
|
+
end
|
|
1135
1136
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1137
|
+
opt.separator nil
|
|
1138
|
+
opt.separator "Generic options:"
|
|
1139
|
+
opt.separator nil
|
|
1139
1140
|
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1141
|
+
opt.on("--server[=PORT]", Integer,
|
|
1142
|
+
"Start a web server to preview",
|
|
1143
|
+
"documentation with live reload.",
|
|
1144
|
+
"Defaults to port 4000.") do |port|
|
|
1145
|
+
@server_port = port || 4000
|
|
1146
|
+
end
|
|
1146
1147
|
|
|
1147
|
-
|
|
1148
|
+
opt.separator nil
|
|
1148
1149
|
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1150
|
+
opt.on("--write-options",
|
|
1151
|
+
"Write .rdoc_options to the current",
|
|
1152
|
+
"directory with the given options. Not all",
|
|
1153
|
+
"options will be used. See RDoc::Options",
|
|
1154
|
+
"for details.") do |value|
|
|
1155
|
+
@write_options = true
|
|
1156
|
+
end
|
|
1156
1157
|
|
|
1157
|
-
|
|
1158
|
+
opt.separator nil
|
|
1158
1159
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1160
|
+
opt.on("--[no-]dry-run",
|
|
1161
|
+
"Don't write any files") do |value|
|
|
1162
|
+
@dry_run = value
|
|
1163
|
+
end
|
|
1163
1164
|
|
|
1164
|
-
|
|
1165
|
+
opt.separator nil
|
|
1165
1166
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1167
|
+
opt.on("-D", "--[no-]debug",
|
|
1168
|
+
"Displays lots on internal stuff.") do |value|
|
|
1169
|
+
$DEBUG_RDOC = value
|
|
1170
|
+
end
|
|
1170
1171
|
|
|
1171
|
-
|
|
1172
|
+
opt.separator nil
|
|
1172
1173
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1174
|
+
opt.on("--warn-missing-rdoc-ref",
|
|
1175
|
+
"Warn if rdoc-ref links can't be resolved") do |value|
|
|
1176
|
+
@warn_missing_rdoc_ref = value
|
|
1177
|
+
end
|
|
1177
1178
|
|
|
1178
|
-
|
|
1179
|
+
opt.separator nil
|
|
1179
1180
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1181
|
+
opt.on("--[no-]ignore-invalid",
|
|
1182
|
+
"Ignore invalid options and continue",
|
|
1183
|
+
"(default true).") do |value|
|
|
1184
|
+
ignore_invalid = value
|
|
1185
|
+
end
|
|
1185
1186
|
|
|
1186
|
-
|
|
1187
|
+
opt.separator nil
|
|
1187
1188
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1189
|
+
opt.on("--quiet", "-q",
|
|
1190
|
+
"Don't show progress as we parse.") do |value|
|
|
1191
|
+
@verbosity = 0
|
|
1192
|
+
end
|
|
1192
1193
|
|
|
1193
|
-
|
|
1194
|
+
opt.separator nil
|
|
1194
1195
|
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1196
|
+
opt.on("--verbose", "-V",
|
|
1197
|
+
"Display extra progress as RDoc parses") do |value|
|
|
1198
|
+
@verbosity = 2
|
|
1199
|
+
end
|
|
1199
1200
|
|
|
1200
|
-
|
|
1201
|
+
opt.separator nil
|
|
1201
1202
|
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1203
|
+
opt.on("--version", "-v", "print the version") do
|
|
1204
|
+
puts opt.version
|
|
1205
|
+
exit
|
|
1206
|
+
end
|
|
1206
1207
|
|
|
1207
|
-
|
|
1208
|
+
opt.separator nil
|
|
1208
1209
|
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1210
|
+
opt.on("--help", "-h", "Display this help") do
|
|
1211
|
+
RDoc::GENERATORS.each_key do |generator|
|
|
1212
|
+
setup_generator generator
|
|
1213
|
+
end
|
|
1214
|
+
|
|
1215
|
+
puts opt.help
|
|
1216
|
+
exit
|
|
1212
1217
|
end
|
|
1213
1218
|
|
|
1214
|
-
|
|
1215
|
-
exit
|
|
1219
|
+
opt.separator nil
|
|
1216
1220
|
end
|
|
1217
1221
|
|
|
1218
|
-
|
|
1219
|
-
end
|
|
1222
|
+
invalid = []
|
|
1220
1223
|
|
|
1221
|
-
|
|
1224
|
+
begin
|
|
1225
|
+
opts.parse! argv
|
|
1226
|
+
rescue OptionParser::ParseError => e
|
|
1227
|
+
if %w[--format --ri -r --ri-site -R].include? e.args.first
|
|
1228
|
+
raise
|
|
1229
|
+
else
|
|
1230
|
+
invalid << e.args.join(' ')
|
|
1231
|
+
end
|
|
1222
1232
|
|
|
1223
|
-
|
|
1224
|
-
opts.parse! argv
|
|
1225
|
-
rescue OptionParser::ParseError => e
|
|
1226
|
-
if %w[--format --ri -r --ri-site -R].include? e.args.first then
|
|
1227
|
-
raise
|
|
1228
|
-
else
|
|
1229
|
-
invalid << e.args.join(' ')
|
|
1233
|
+
retry
|
|
1230
1234
|
end
|
|
1231
1235
|
|
|
1232
|
-
|
|
1233
|
-
end
|
|
1236
|
+
setup_generator unless @generator
|
|
1234
1237
|
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
invalid << '-p (with files)'
|
|
1240
|
-
end
|
|
1238
|
+
if @pipe and not argv.empty?
|
|
1239
|
+
@pipe = false
|
|
1240
|
+
invalid << '-p (with files)'
|
|
1241
|
+
end
|
|
1241
1242
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1243
|
+
unless invalid.empty?
|
|
1244
|
+
invalid = "invalid options: #{invalid.join ', '}"
|
|
1244
1245
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1246
|
+
if ignore_invalid
|
|
1247
|
+
unless quiet
|
|
1248
|
+
$stderr.puts invalid
|
|
1249
|
+
$stderr.puts '(invalid options are ignored)'
|
|
1250
|
+
end
|
|
1251
|
+
else
|
|
1252
|
+
unless quiet
|
|
1253
|
+
$stderr.puts opts
|
|
1254
|
+
end
|
|
1247
1255
|
$stderr.puts invalid
|
|
1248
|
-
|
|
1249
|
-
end
|
|
1250
|
-
else
|
|
1251
|
-
unless quiet then
|
|
1252
|
-
$stderr.puts opts
|
|
1256
|
+
exit 1
|
|
1253
1257
|
end
|
|
1254
|
-
$stderr.puts invalid
|
|
1255
|
-
exit 1
|
|
1256
1258
|
end
|
|
1257
|
-
end
|
|
1258
|
-
|
|
1259
|
-
@files = argv.dup
|
|
1260
1259
|
|
|
1261
|
-
|
|
1262
|
-
end
|
|
1263
|
-
|
|
1264
|
-
##
|
|
1265
|
-
# Don't display progress as we process the files
|
|
1260
|
+
@files = argv.dup
|
|
1266
1261
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
end
|
|
1262
|
+
self
|
|
1263
|
+
end
|
|
1270
1264
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1265
|
+
##
|
|
1266
|
+
# Don't display progress as we process the files
|
|
1273
1267
|
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1268
|
+
def quiet
|
|
1269
|
+
@verbosity.zero?
|
|
1270
|
+
end
|
|
1277
1271
|
|
|
1278
|
-
|
|
1279
|
-
|
|
1272
|
+
##
|
|
1273
|
+
# Set quietness to +bool+
|
|
1280
1274
|
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1275
|
+
def quiet=(bool)
|
|
1276
|
+
@verbosity = bool ? 0 : 1
|
|
1277
|
+
end
|
|
1284
1278
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1279
|
+
##
|
|
1280
|
+
# Removes directories from +path+ that are outside the current directory
|
|
1281
|
+
|
|
1282
|
+
def sanitize_path(path)
|
|
1283
|
+
require 'pathname'
|
|
1284
|
+
dot = Pathname.new('.').expand_path
|
|
1285
|
+
|
|
1286
|
+
path.reject do |item|
|
|
1287
|
+
path = Pathname.new(item).expand_path
|
|
1288
|
+
is_reject = nil
|
|
1289
|
+
relative = nil
|
|
1290
|
+
begin
|
|
1291
|
+
relative = path.relative_path_from(dot).to_s
|
|
1292
|
+
rescue ArgumentError
|
|
1293
|
+
# On Windows, sometimes crosses different drive letters.
|
|
1294
|
+
is_reject = true
|
|
1295
|
+
else
|
|
1296
|
+
is_reject = relative.start_with? '..'
|
|
1297
|
+
end
|
|
1298
|
+
is_reject
|
|
1296
1299
|
end
|
|
1297
|
-
is_reject
|
|
1298
1300
|
end
|
|
1299
|
-
end
|
|
1300
1301
|
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1302
|
+
##
|
|
1303
|
+
# Set up an output generator for the named +generator_name+.
|
|
1304
|
+
#
|
|
1305
|
+
# If the found generator responds to :setup_options it will be called with
|
|
1306
|
+
# the options instance. This allows generators to add custom options or set
|
|
1307
|
+
# default options.
|
|
1307
1308
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1309
|
+
def setup_generator(generator_name = @generator_name)
|
|
1310
|
+
@generator = @generators[generator_name]
|
|
1310
1311
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1312
|
+
unless @generator
|
|
1313
|
+
raise OptionParser::InvalidArgument,
|
|
1314
|
+
"Invalid output formatter #{generator_name}"
|
|
1315
|
+
end
|
|
1315
1316
|
|
|
1316
|
-
|
|
1317
|
+
return if @generator_options.include? @generator
|
|
1317
1318
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1319
|
+
@generator_name = generator_name
|
|
1320
|
+
@generator_options << @generator
|
|
1320
1321
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1322
|
+
if @generator.respond_to? :setup_options
|
|
1323
|
+
@option_parser ||= OptionParser.new
|
|
1324
|
+
@generator.setup_options self
|
|
1325
|
+
end
|
|
1324
1326
|
end
|
|
1325
|
-
end
|
|
1326
1327
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1328
|
+
##
|
|
1329
|
+
# Finds the template dir for +template+
|
|
1329
1330
|
|
|
1330
|
-
|
|
1331
|
-
|
|
1331
|
+
def template_dir_for(template)
|
|
1332
|
+
template_path = File.join 'rdoc', 'generator', 'template', template
|
|
1332
1333
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1334
|
+
$LOAD_PATH.map do |path|
|
|
1335
|
+
File.join File.expand_path(path), template_path
|
|
1336
|
+
end.find do |dir|
|
|
1337
|
+
File.directory? dir
|
|
1338
|
+
end
|
|
1337
1339
|
end
|
|
1338
|
-
end
|
|
1339
1340
|
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1341
|
+
# Sets the minimum visibility of a documented method.
|
|
1342
|
+
#
|
|
1343
|
+
# Accepts +:public+, +:protected+, +:private+, +:nodoc+, or +:all+.
|
|
1344
|
+
#
|
|
1345
|
+
# When +:all+ is passed, visibility is set to +:private+, similarly to
|
|
1346
|
+
# RDOCOPT="--all", see #visibility for more information.
|
|
1347
|
+
|
|
1348
|
+
def visibility=(visibility)
|
|
1349
|
+
case visibility
|
|
1350
|
+
when :all
|
|
1351
|
+
@visibility = :private
|
|
1352
|
+
else
|
|
1353
|
+
@visibility = visibility
|
|
1354
|
+
end
|
|
1353
1355
|
end
|
|
1354
|
-
end
|
|
1355
1356
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1357
|
+
##
|
|
1358
|
+
# Displays a warning using Kernel#warn if we're being verbose
|
|
1358
1359
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1360
|
+
def warn(message)
|
|
1361
|
+
super message if @verbosity > 1
|
|
1362
|
+
end
|
|
1362
1363
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1364
|
+
##
|
|
1365
|
+
# Writes the YAML file .rdoc_options to the current directory containing the
|
|
1366
|
+
# parsed options.
|
|
1366
1367
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1368
|
+
def write_options
|
|
1369
|
+
::RDoc.load_yaml
|
|
1369
1370
|
|
|
1370
|
-
|
|
1371
|
-
|
|
1371
|
+
File.open '.rdoc_options', 'w' do |io|
|
|
1372
|
+
io.set_encoding ::Encoding::UTF_8
|
|
1372
1373
|
|
|
1373
|
-
|
|
1374
|
+
io.print to_yaml
|
|
1375
|
+
end
|
|
1374
1376
|
end
|
|
1375
|
-
end
|
|
1376
1377
|
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1378
|
+
##
|
|
1379
|
+
# Loads options from .rdoc_options if the file exists, otherwise creates a
|
|
1380
|
+
# new RDoc::Options instance.
|
|
1380
1381
|
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1382
|
+
def self.load_options
|
|
1383
|
+
options_file = File.expand_path '.rdoc_options'
|
|
1384
|
+
return Options.new unless File.exist? options_file
|
|
1384
1385
|
|
|
1385
|
-
|
|
1386
|
+
::RDoc.load_yaml
|
|
1386
1387
|
|
|
1387
|
-
|
|
1388
|
+
content = File.read('.rdoc_options')
|
|
1388
1389
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1390
|
+
if defined?(Psych)
|
|
1391
|
+
begin
|
|
1392
|
+
options = Psych.safe_load content, permitted_classes: [Options, Symbol]
|
|
1393
|
+
rescue Psych::SyntaxError
|
|
1394
|
+
raise Error, "#{options_file} is not a valid rdoc options file"
|
|
1395
|
+
end
|
|
1396
|
+
else
|
|
1397
|
+
options = ::RDoc.yaml_serializer.load(content)
|
|
1394
1398
|
end
|
|
1395
|
-
else
|
|
1396
|
-
options = RDoc.yaml_serializer.load(content)
|
|
1397
|
-
end
|
|
1398
1399
|
|
|
1399
|
-
|
|
1400
|
+
return Options.new unless options # Allow empty file.
|
|
1400
1401
|
|
|
1401
|
-
|
|
1402
|
-
|
|
1402
|
+
raise Error, "#{options_file} is not a valid rdoc options file" unless
|
|
1403
|
+
Options === options or Hash === options
|
|
1403
1404
|
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1405
|
+
if Hash === options
|
|
1406
|
+
# Override the default values with the contents of YAML file.
|
|
1407
|
+
options = Options.new options
|
|
1408
|
+
end
|
|
1409
|
+
|
|
1410
|
+
options
|
|
1407
1411
|
end
|
|
1408
1412
|
|
|
1409
|
-
options
|
|
1410
1413
|
end
|
|
1411
|
-
|
|
1412
1414
|
end
|