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