rdoc 6.12.0 → 6.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +3 -1
- data/lib/rdoc/code_object/alias.rb +2 -9
- data/lib/rdoc/code_object/any_method.rb +9 -14
- data/lib/rdoc/code_object/attr.rb +6 -9
- data/lib/rdoc/code_object/class_module.rb +40 -23
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +8 -7
- data/lib/rdoc/code_object/context.rb +23 -65
- data/lib/rdoc/code_object/method_attr.rb +9 -28
- data/lib/rdoc/code_object/mixin.rb +3 -3
- data/lib/rdoc/code_object/normal_class.rb +1 -1
- data/lib/rdoc/code_object/normal_module.rb +1 -1
- data/lib/rdoc/code_object/require.rb +1 -1
- data/lib/rdoc/code_object/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +12 -30
- data/lib/rdoc/code_object.rb +6 -37
- data/lib/rdoc/comment.rb +7 -10
- data/lib/rdoc/cross_reference.rb +3 -3
- data/lib/rdoc/encoding.rb +4 -4
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +2 -2
- data/lib/rdoc/generator/darkfish.rb +97 -109
- data/lib/rdoc/generator/json_index.rb +4 -20
- data/lib/rdoc/generator/markup.rb +14 -2
- data/lib/rdoc/generator/pot/message_extractor.rb +6 -6
- data/lib/rdoc/generator/pot/po.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +7 -7
- data/lib/rdoc/generator/pot.rb +1 -6
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +15 -0
- data/lib/rdoc/markdown.kpeg +7 -5
- data/lib/rdoc/markdown.rb +34 -21
- data/lib/rdoc/markup/attribute_manager.rb +5 -5
- data/lib/rdoc/markup/attributes.rb +3 -3
- data/lib/rdoc/markup/blank_line.rb +2 -2
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +8 -8
- data/lib/rdoc/markup/formatter.rb +12 -12
- data/lib/rdoc/markup/hard_break.rb +3 -3
- data/lib/rdoc/markup/heading.rb +11 -5
- data/lib/rdoc/markup/include.rb +3 -3
- data/lib/rdoc/markup/indented_paragraph.rb +3 -3
- data/lib/rdoc/markup/list.rb +4 -4
- data/lib/rdoc/markup/list_item.rb +4 -4
- data/lib/rdoc/markup/paragraph.rb +2 -2
- data/lib/rdoc/markup/parser.rb +11 -11
- data/lib/rdoc/markup/pre_process.rb +6 -6
- data/lib/rdoc/markup/raw.rb +5 -5
- data/lib/rdoc/markup/rule.rb +2 -2
- data/lib/rdoc/markup/table.rb +4 -4
- data/lib/rdoc/markup/to_ansi.rb +3 -3
- data/lib/rdoc/markup/to_bs.rb +6 -6
- data/lib/rdoc/markup/to_html.rb +25 -16
- data/lib/rdoc/markup/to_html_crossref.rb +5 -5
- data/lib/rdoc/markup/to_html_snippet.rb +17 -17
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_label.rb +6 -5
- data/lib/rdoc/markup/to_markdown.rb +12 -12
- data/lib/rdoc/markup/to_rdoc.rb +29 -28
- data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +8 -8
- data/lib/rdoc/markup/verbatim.rb +3 -3
- data/lib/rdoc/markup.rb +3 -3
- data/lib/rdoc/options.rb +31 -12
- data/lib/rdoc/parser/c.rb +20 -23
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +9 -16
- data/lib/rdoc/parser/ruby.rb +50 -53
- data/lib/rdoc/parser/simple.rb +2 -2
- data/lib/rdoc/parser.rb +8 -8
- data/lib/rdoc/rd/inline.rb +4 -4
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +11 -26
- data/lib/rdoc/ri/driver.rb +60 -52
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +14 -17
- data/lib/rdoc/servlet.rb +23 -22
- data/lib/rdoc/stats/normal.rb +1 -1
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +3 -3
- data/lib/rdoc/stats.rb +14 -14
- data/lib/rdoc/store.rb +39 -43
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +13 -13
- data/lib/rdoc/token_stream.rb +1 -1
- data/lib/rdoc/tom_doc.rb +7 -7
- data/lib/rdoc/version.rb +1 -1
- data/man/ri.1 +2 -0
- data/rdoc.gemspec +69 -0
- metadata +18 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
data/lib/rdoc/servlet.rb
CHANGED
@@ -66,7 +66,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
66
66
|
# +server+ is provided automatically by WEBrick when mounting. +stores+ and
|
67
67
|
# +cache+ are provided automatically by the servlet.
|
68
68
|
|
69
|
-
def initialize
|
69
|
+
def initialize(server, stores, cache, mount_path = nil, extra_doc_dirs = [])
|
70
70
|
super server
|
71
71
|
|
72
72
|
@cache = cache
|
@@ -97,7 +97,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
97
97
|
##
|
98
98
|
# Serves the asset at the path in +req+ for +generator_name+ via +res+.
|
99
99
|
|
100
|
-
def asset
|
100
|
+
def asset(generator_name, req, res)
|
101
101
|
asset_dir = @asset_dirs[generator_name]
|
102
102
|
|
103
103
|
asset_path = File.join asset_dir, req.path
|
@@ -116,7 +116,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
116
116
|
##
|
117
117
|
# GET request entry point. Fills in +res+ for the path, etc. in +req+.
|
118
118
|
|
119
|
-
def do_GET
|
119
|
+
def do_GET(req, res)
|
120
120
|
req.path.sub!(/\A#{Regexp.escape @mount_path}/, '') if @mount_path
|
121
121
|
|
122
122
|
case req.path
|
@@ -133,7 +133,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
133
133
|
show_documentation req, res
|
134
134
|
end
|
135
135
|
rescue WEBrick::HTTPStatus::NotFound => e
|
136
|
-
generator = generator_for RDoc::Store.new
|
136
|
+
generator = generator_for RDoc::Store.new(@options)
|
137
137
|
|
138
138
|
not_found generator, req, res, e.message
|
139
139
|
rescue WEBrick::HTTPStatus::Status
|
@@ -149,7 +149,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
149
149
|
# module or page name (/RDoc/Servlet.html becomes RDoc::Servlet).
|
150
150
|
# +generator+ is used to create the page.
|
151
151
|
|
152
|
-
def documentation_page
|
152
|
+
def documentation_page(store, generator, path, req, res)
|
153
153
|
text_name = path.chomp '.html'
|
154
154
|
name = text_name.gsub '/', '::'
|
155
155
|
|
@@ -168,7 +168,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
168
168
|
# Creates the JSON search index on +res+ for the given +store+. +generator+
|
169
169
|
# must respond to \#json_index to build. +req+ is ignored.
|
170
170
|
|
171
|
-
def documentation_search
|
171
|
+
def documentation_search(store, generator, req, res)
|
172
172
|
json_index = @cache[store].fetch :json_index do
|
173
173
|
@cache[store][:json_index] =
|
174
174
|
JSON.dump generator.json_index.build_index
|
@@ -182,7 +182,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
182
182
|
# Returns the RDoc::Store and path relative to +mount_path+ for
|
183
183
|
# documentation at +path+.
|
184
184
|
|
185
|
-
def documentation_source
|
185
|
+
def documentation_source(path)
|
186
186
|
_, source_name, path = path.split '/', 3
|
187
187
|
|
188
188
|
store = @stores[source_name]
|
@@ -200,7 +200,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
200
200
|
##
|
201
201
|
# Generates an error page for the +exception+ while handling +req+ on +res+.
|
202
202
|
|
203
|
-
def error
|
203
|
+
def error(exception, req, res)
|
204
204
|
backtrace = exception.backtrace.join "\n"
|
205
205
|
|
206
206
|
res.content_type = 'text/html'
|
@@ -243,10 +243,11 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
243
243
|
##
|
244
244
|
# Instantiates a Darkfish generator for +store+
|
245
245
|
|
246
|
-
def generator_for
|
246
|
+
def generator_for(store)
|
247
247
|
generator = RDoc::Generator::Darkfish.new store, @options
|
248
248
|
generator.file_output = false
|
249
249
|
generator.asset_rel_path = '..'
|
250
|
+
generator.setup
|
250
251
|
|
251
252
|
rdoc = RDoc::RDoc.new
|
252
253
|
rdoc.store = store
|
@@ -264,7 +265,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
264
265
|
# file has not been modified a Not Modified response is returned. If the
|
265
266
|
# file has been modified a Last-Modified header is added to +res+.
|
266
267
|
|
267
|
-
def if_modified_since
|
268
|
+
def if_modified_since(req, res, path = nil)
|
268
269
|
last_modified = File.stat(path).mtime if path
|
269
270
|
|
270
271
|
res['last-modified'] = last_modified.httpdate
|
@@ -290,7 +291,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
290
291
|
def installed_docs
|
291
292
|
extra_counter = 0
|
292
293
|
ri_paths.map do |path, type|
|
293
|
-
store = RDoc::Store.new path, type
|
294
|
+
store = RDoc::Store.new(@options, path: path, type: type)
|
294
295
|
exists = File.exist? store.cache_path
|
295
296
|
|
296
297
|
case type
|
@@ -315,7 +316,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
315
316
|
##
|
316
317
|
# Returns a 404 page built by +generator+ for +req+ on +res+.
|
317
318
|
|
318
|
-
def not_found
|
319
|
+
def not_found(generator, req, res, message = nil)
|
319
320
|
message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found"
|
320
321
|
res.body = generator.generate_servlet_not_found message
|
321
322
|
res.status = 404
|
@@ -324,14 +325,14 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
324
325
|
##
|
325
326
|
# Enumerates the ri paths. See RDoc::RI::Paths#each
|
326
327
|
|
327
|
-
def ri_paths
|
328
|
+
def ri_paths(&block)
|
328
329
|
RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs
|
329
330
|
end
|
330
331
|
|
331
332
|
##
|
332
333
|
# Generates the root page on +res+. +req+ is ignored.
|
333
334
|
|
334
|
-
def root
|
335
|
+
def root(req, res)
|
335
336
|
generator = RDoc::Generator::Darkfish.new nil, @options
|
336
337
|
|
337
338
|
res.body = generator.generate_servlet_root installed_docs
|
@@ -342,7 +343,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
342
343
|
##
|
343
344
|
# Generates a search index for the root page on +res+. +req+ is ignored.
|
344
345
|
|
345
|
-
def root_search
|
346
|
+
def root_search(req, res)
|
346
347
|
search_index = []
|
347
348
|
info = []
|
348
349
|
|
@@ -392,7 +393,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
392
393
|
# Displays documentation for +req+ on +res+, whether that be HTML or some
|
393
394
|
# asset.
|
394
395
|
|
395
|
-
def show_documentation
|
396
|
+
def show_documentation(req, res)
|
396
397
|
store, path = documentation_source req.path
|
397
398
|
|
398
399
|
if_modified_since req, res, store.cache_path
|
@@ -416,18 +417,18 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
416
417
|
##
|
417
418
|
# Returns an RDoc::Store for the given +source_name+ ('ruby' or a gem name).
|
418
419
|
|
419
|
-
def store_for
|
420
|
+
def store_for(source_name)
|
420
421
|
case source_name
|
421
422
|
when 'home' then
|
422
|
-
RDoc::Store.new RDoc::RI::Paths.home_dir, :home
|
423
|
+
RDoc::Store.new(@options, path: RDoc::RI::Paths.home_dir, type: :home)
|
423
424
|
when 'ruby' then
|
424
|
-
RDoc::Store.new RDoc::RI::Paths.system_dir, :system
|
425
|
+
RDoc::Store.new(@options, path: RDoc::RI::Paths.system_dir, type: :system)
|
425
426
|
when 'site' then
|
426
|
-
RDoc::Store.new RDoc::RI::Paths.site_dir, :site
|
427
|
+
RDoc::Store.new(@options, path: RDoc::RI::Paths.site_dir, type: :site)
|
427
428
|
when /\Aextra-(\d+)\z/ then
|
428
429
|
index = $1.to_i - 1
|
429
430
|
ri_dir = installed_docs[index][4]
|
430
|
-
RDoc::Store.new ri_dir, :extra
|
431
|
+
RDoc::Store.new(@options, path: ri_dir, type: :extra)
|
431
432
|
else
|
432
433
|
ri_dir, type = ri_paths.find do |dir, dir_type|
|
433
434
|
next unless dir_type == :gem
|
@@ -438,7 +439,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
438
439
|
raise WEBrick::HTTPStatus::NotFound,
|
439
440
|
"Could not find gem \"#{ERB::Util.html_escape(source_name)}\". Are you sure you installed it?" unless ri_dir
|
440
441
|
|
441
|
-
store = RDoc::Store.new ri_dir, type
|
442
|
+
store = RDoc::Store.new(@options, path: ri_dir, type: type)
|
442
443
|
|
443
444
|
return store if File.exist? store.cache_path
|
444
445
|
|
data/lib/rdoc/stats/normal.rb
CHANGED
@@ -20,7 +20,7 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
|
|
20
20
|
##
|
21
21
|
# Prints a file with a progress bar
|
22
22
|
|
23
|
-
def print_file
|
23
|
+
def print_file(files_so_far, filename)
|
24
24
|
progress_bar = sprintf("%3d%% [%2d/%2d] ",
|
25
25
|
100 * files_so_far / @num_files,
|
26
26
|
files_so_far,
|
data/lib/rdoc/stats/quiet.rb
CHANGED
data/lib/rdoc/stats/verbose.rb
CHANGED
@@ -8,15 +8,15 @@ class RDoc::Stats::Verbose < RDoc::Stats::Normal
|
|
8
8
|
##
|
9
9
|
# Returns a marker for RDoc::CodeObject +co+ being undocumented
|
10
10
|
|
11
|
-
def nodoc
|
11
|
+
def nodoc(co)
|
12
12
|
" (undocumented)" unless co.documented?
|
13
13
|
end
|
14
14
|
|
15
|
-
def print_alias
|
15
|
+
def print_alias(as) # :nodoc:
|
16
16
|
puts " alias #{as.new_name} #{as.old_name}#{nodoc as}"
|
17
17
|
end
|
18
18
|
|
19
|
-
def print_attribute
|
19
|
+
def print_attribute(attribute) # :nodoc:
|
20
20
|
puts " #{attribute.definition} #{attribute.name}#{nodoc attribute}"
|
21
21
|
end
|
22
22
|
|
data/lib/rdoc/stats.rb
CHANGED
@@ -26,7 +26,7 @@ class RDoc::Stats
|
|
26
26
|
# Creates a new Stats that will have +num_files+. +verbosity+ defaults to 1
|
27
27
|
# which will create an RDoc::Stats::Normal outputter.
|
28
28
|
|
29
|
-
def initialize
|
29
|
+
def initialize(store, num_files, verbosity = 1)
|
30
30
|
@num_files = num_files
|
31
31
|
@store = store
|
32
32
|
|
@@ -49,28 +49,28 @@ class RDoc::Stats
|
|
49
49
|
##
|
50
50
|
# Records the parsing of an alias +as+.
|
51
51
|
|
52
|
-
def add_alias
|
52
|
+
def add_alias(as)
|
53
53
|
@display.print_alias as
|
54
54
|
end
|
55
55
|
|
56
56
|
##
|
57
57
|
# Records the parsing of an attribute +attribute+
|
58
58
|
|
59
|
-
def add_attribute
|
59
|
+
def add_attribute(attribute)
|
60
60
|
@display.print_attribute attribute
|
61
61
|
end
|
62
62
|
|
63
63
|
##
|
64
64
|
# Records the parsing of a class +klass+
|
65
65
|
|
66
|
-
def add_class
|
66
|
+
def add_class(klass)
|
67
67
|
@display.print_class klass
|
68
68
|
end
|
69
69
|
|
70
70
|
##
|
71
71
|
# Records the parsing of +constant+
|
72
72
|
|
73
|
-
def add_constant
|
73
|
+
def add_constant(constant)
|
74
74
|
@display.print_constant constant
|
75
75
|
end
|
76
76
|
|
@@ -155,7 +155,7 @@ class RDoc::Stats
|
|
155
155
|
# 0:: Classes, modules, constants, attributes, methods
|
156
156
|
# 1:: Level 0 + method parameters
|
157
157
|
|
158
|
-
def coverage_level=
|
158
|
+
def coverage_level=(level)
|
159
159
|
level = -1 unless level
|
160
160
|
|
161
161
|
@coverage_level = level
|
@@ -164,7 +164,7 @@ class RDoc::Stats
|
|
164
164
|
##
|
165
165
|
# Returns the length and number of undocumented items in +collection+.
|
166
166
|
|
167
|
-
def doc_stats
|
167
|
+
def doc_stats(collection)
|
168
168
|
visible = collection.select { |item| item.display? }
|
169
169
|
[visible.length, visible.count { |item| not item.documented? }]
|
170
170
|
end
|
@@ -256,12 +256,12 @@ class RDoc::Stats
|
|
256
256
|
##
|
257
257
|
# Returns a report on undocumented attributes in ClassModule +cm+
|
258
258
|
|
259
|
-
def report_attributes
|
259
|
+
def report_attributes(cm)
|
260
260
|
return if cm.attributes.empty?
|
261
261
|
|
262
262
|
report = []
|
263
263
|
|
264
|
-
cm.
|
264
|
+
cm.attributes.each do |attr|
|
265
265
|
next if attr.documented?
|
266
266
|
line = attr.line ? ":#{attr.line}" : nil
|
267
267
|
report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
|
@@ -274,7 +274,7 @@ class RDoc::Stats
|
|
274
274
|
##
|
275
275
|
# Returns a report on undocumented items in ClassModule +cm+
|
276
276
|
|
277
|
-
def report_class_module
|
277
|
+
def report_class_module(cm)
|
278
278
|
return if cm.fully_documented? and @coverage_level.zero?
|
279
279
|
return unless cm.display?
|
280
280
|
|
@@ -326,12 +326,12 @@ class RDoc::Stats
|
|
326
326
|
##
|
327
327
|
# Returns a report on undocumented constants in ClassModule +cm+
|
328
328
|
|
329
|
-
def report_constants
|
329
|
+
def report_constants(cm)
|
330
330
|
return if cm.constants.empty?
|
331
331
|
|
332
332
|
report = []
|
333
333
|
|
334
|
-
cm.
|
334
|
+
cm.constants.each do |constant|
|
335
335
|
# TODO constant aliases are listed in the summary but not reported
|
336
336
|
# figure out what to do here
|
337
337
|
next if constant.documented? || constant.is_alias_for
|
@@ -348,7 +348,7 @@ class RDoc::Stats
|
|
348
348
|
##
|
349
349
|
# Returns a report on undocumented methods in ClassModule +cm+
|
350
350
|
|
351
|
-
def report_methods
|
351
|
+
def report_methods(cm)
|
352
352
|
return if cm.method_list.empty?
|
353
353
|
|
354
354
|
report = []
|
@@ -436,7 +436,7 @@ class RDoc::Stats
|
|
436
436
|
# Determines which parameters in +method+ were not documented. Returns a
|
437
437
|
# total parameter count and an Array of undocumented methods.
|
438
438
|
|
439
|
-
def undoc_params
|
439
|
+
def undoc_params(method)
|
440
440
|
@formatter ||= RDoc::Markup::ToTtOnly.new
|
441
441
|
|
442
442
|
params = method.param_list
|
data/lib/rdoc/store.rb
CHANGED
@@ -54,7 +54,7 @@ class RDoc::Store
|
|
54
54
|
# Creates a new MissingFileError for the missing +file+ for the given
|
55
55
|
# +name+ that should have been in the +store+.
|
56
56
|
|
57
|
-
def initialize
|
57
|
+
def initialize(store, file, name)
|
58
58
|
@store = store
|
59
59
|
@file = file
|
60
60
|
@name = name
|
@@ -94,11 +94,7 @@ class RDoc::Store
|
|
94
94
|
|
95
95
|
attr_accessor :path
|
96
96
|
|
97
|
-
|
98
|
-
# The RDoc::RDoc driver for this parse tree. This allows classes consulting
|
99
|
-
# the documentation tree to access user-set options, for example.
|
100
|
-
|
101
|
-
attr_accessor :rdoc
|
97
|
+
attr_reader :options
|
102
98
|
|
103
99
|
##
|
104
100
|
# Type of ri datastore this was loaded from. See RDoc::RI::Driver,
|
@@ -124,11 +120,11 @@ class RDoc::Store
|
|
124
120
|
##
|
125
121
|
# Creates a new Store of +type+ that will load or save to +path+
|
126
122
|
|
127
|
-
def initialize path
|
128
|
-
@
|
129
|
-
@
|
130
|
-
@
|
131
|
-
@
|
123
|
+
def initialize(options, path: nil, type: nil)
|
124
|
+
@options = options
|
125
|
+
@dry_run = options.dry_run
|
126
|
+
@encoding = options.encoding
|
127
|
+
@path = path || options.op_dir
|
132
128
|
@type = type
|
133
129
|
|
134
130
|
@cache = {
|
@@ -139,10 +135,10 @@ class RDoc::Store
|
|
139
135
|
:c_singleton_class_variables => {},
|
140
136
|
:encoding => @encoding,
|
141
137
|
:instance_methods => {},
|
142
|
-
:main =>
|
138
|
+
:main => options.main_page,
|
143
139
|
:modules => [],
|
144
140
|
:pages => [],
|
145
|
-
:title =>
|
141
|
+
:title => options.title,
|
146
142
|
}
|
147
143
|
|
148
144
|
@classes_hash = {}
|
@@ -166,14 +162,14 @@ class RDoc::Store
|
|
166
162
|
# Adds +module+ as an enclosure (namespace) for the given +variable+ for C
|
167
163
|
# files.
|
168
164
|
|
169
|
-
def add_c_enclosure
|
165
|
+
def add_c_enclosure(variable, namespace)
|
170
166
|
@c_enclosure_classes[variable] = namespace
|
171
167
|
end
|
172
168
|
|
173
169
|
##
|
174
170
|
# Adds C variables from an RDoc::Parser::C
|
175
171
|
|
176
|
-
def add_c_variables
|
172
|
+
def add_c_variables(c_parser)
|
177
173
|
filename = c_parser.top_level.relative_name
|
178
174
|
|
179
175
|
@c_class_variables[filename] = make_variable_map c_parser.classes
|
@@ -185,7 +181,7 @@ class RDoc::Store
|
|
185
181
|
# Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the
|
186
182
|
# created RDoc::TopLevel.
|
187
183
|
|
188
|
-
def add_file
|
184
|
+
def add_file(absolute_name, relative_name: absolute_name, parser: nil)
|
189
185
|
unless top_level = @files_hash[relative_name] then
|
190
186
|
top_level = RDoc::TopLevel.new absolute_name, relative_name
|
191
187
|
top_level.parser = parser if parser
|
@@ -272,7 +268,7 @@ class RDoc::Store
|
|
272
268
|
##
|
273
269
|
# Path to the ri data for +klass_name+
|
274
270
|
|
275
|
-
def class_file
|
271
|
+
def class_file(klass_name)
|
276
272
|
name = klass_name.split('::').last
|
277
273
|
File.join class_path(klass_name), "cdesc-#{name}.ri"
|
278
274
|
end
|
@@ -288,7 +284,7 @@ class RDoc::Store
|
|
288
284
|
##
|
289
285
|
# Path where data for +klass_name+ will be stored (methods or class data)
|
290
286
|
|
291
|
-
def class_path
|
287
|
+
def class_path(klass_name)
|
292
288
|
File.join @path, *klass_name.split('::')
|
293
289
|
end
|
294
290
|
|
@@ -303,7 +299,7 @@ class RDoc::Store
|
|
303
299
|
# Removes empty items and ensures item in each collection are unique and
|
304
300
|
# sorted
|
305
301
|
|
306
|
-
def clean_cache_collection
|
302
|
+
def clean_cache_collection(collection) # :nodoc:
|
307
303
|
collection.each do |name, item|
|
308
304
|
if item.empty? then
|
309
305
|
collection.delete name
|
@@ -331,7 +327,7 @@ class RDoc::Store
|
|
331
327
|
#
|
332
328
|
# See also RDoc::Context#remove_from_documentation?
|
333
329
|
|
334
|
-
def complete
|
330
|
+
def complete(min_visibility)
|
335
331
|
fix_basic_object_inheritance
|
336
332
|
|
337
333
|
# cache included modules before they are removed from the documentation
|
@@ -378,7 +374,7 @@ class RDoc::Store
|
|
378
374
|
##
|
379
375
|
# Finds the enclosure (namespace) for the given C +variable+.
|
380
376
|
|
381
|
-
def find_c_enclosure
|
377
|
+
def find_c_enclosure(variable)
|
382
378
|
@c_enclosure_classes.fetch variable do
|
383
379
|
break unless name = @c_enclosure_names[variable]
|
384
380
|
|
@@ -403,14 +399,14 @@ class RDoc::Store
|
|
403
399
|
##
|
404
400
|
# Finds the class with +name+ in all discovered classes
|
405
401
|
|
406
|
-
def find_class_named
|
402
|
+
def find_class_named(name)
|
407
403
|
@classes_hash[name]
|
408
404
|
end
|
409
405
|
|
410
406
|
##
|
411
407
|
# Finds the class with +name+ starting in namespace +from+
|
412
408
|
|
413
|
-
def find_class_named_from
|
409
|
+
def find_class_named_from(name, from)
|
414
410
|
from = find_class_named from unless RDoc::Context === from
|
415
411
|
|
416
412
|
until RDoc::TopLevel === from do
|
@@ -428,7 +424,7 @@ class RDoc::Store
|
|
428
424
|
##
|
429
425
|
# Finds the class or module with +name+
|
430
426
|
|
431
|
-
def find_class_or_module
|
427
|
+
def find_class_or_module(name)
|
432
428
|
name = $' if name =~ /^::/
|
433
429
|
@classes_hash[name] || @modules_hash[name]
|
434
430
|
end
|
@@ -436,14 +432,14 @@ class RDoc::Store
|
|
436
432
|
##
|
437
433
|
# Finds the file with +name+ in all discovered files
|
438
434
|
|
439
|
-
def find_file_named
|
435
|
+
def find_file_named(name)
|
440
436
|
@files_hash[name]
|
441
437
|
end
|
442
438
|
|
443
439
|
##
|
444
440
|
# Finds the module with +name+ in all discovered modules
|
445
441
|
|
446
|
-
def find_module_named
|
442
|
+
def find_module_named(name)
|
447
443
|
@modules_hash[name]
|
448
444
|
end
|
449
445
|
|
@@ -451,7 +447,7 @@ class RDoc::Store
|
|
451
447
|
# Returns the RDoc::TopLevel that is a text file and has the given
|
452
448
|
# +file_name+
|
453
449
|
|
454
|
-
def find_text_page
|
450
|
+
def find_text_page(file_name)
|
455
451
|
@text_files_hash.each_value.find do |file|
|
456
452
|
file.full_name == file_name
|
457
453
|
end
|
@@ -464,7 +460,7 @@ class RDoc::Store
|
|
464
460
|
#--
|
465
461
|
# TODO aliases should be registered by Context#add_module_alias
|
466
462
|
|
467
|
-
def find_unique
|
463
|
+
def find_unique(all_hash)
|
468
464
|
unique = []
|
469
465
|
|
470
466
|
all_hash.each_pair do |full_name, cm|
|
@@ -607,7 +603,7 @@ class RDoc::Store
|
|
607
603
|
##
|
608
604
|
# Loads ri data for +klass_name+ and hooks it up to this store.
|
609
605
|
|
610
|
-
def load_class
|
606
|
+
def load_class(klass_name)
|
611
607
|
obj = load_class_data klass_name
|
612
608
|
|
613
609
|
obj.store = self
|
@@ -625,7 +621,7 @@ class RDoc::Store
|
|
625
621
|
##
|
626
622
|
# Loads ri data for +klass_name+
|
627
623
|
|
628
|
-
def load_class_data
|
624
|
+
def load_class_data(klass_name)
|
629
625
|
file = class_file klass_name
|
630
626
|
|
631
627
|
marshal_load(file)
|
@@ -638,7 +634,7 @@ class RDoc::Store
|
|
638
634
|
##
|
639
635
|
# Loads ri data for +method_name+ in +klass_name+
|
640
636
|
|
641
|
-
def load_method
|
637
|
+
def load_method(klass_name, method_name)
|
642
638
|
file = method_file klass_name, method_name
|
643
639
|
|
644
640
|
obj = marshal_load(file)
|
@@ -654,7 +650,7 @@ class RDoc::Store
|
|
654
650
|
##
|
655
651
|
# Loads ri data for +page_name+
|
656
652
|
|
657
|
-
def load_page
|
653
|
+
def load_page(page_name)
|
658
654
|
file = page_file page_name
|
659
655
|
|
660
656
|
obj = marshal_load(file)
|
@@ -677,7 +673,7 @@ class RDoc::Store
|
|
677
673
|
##
|
678
674
|
# Sets the main page for this RDoc store.
|
679
675
|
|
680
|
-
def main=
|
676
|
+
def main=(page)
|
681
677
|
@cache[:main] = page
|
682
678
|
end
|
683
679
|
|
@@ -685,7 +681,7 @@ class RDoc::Store
|
|
685
681
|
# Converts the variable => ClassModule map +variables+ from a C parser into
|
686
682
|
# a variable => class name map.
|
687
683
|
|
688
|
-
def make_variable_map
|
684
|
+
def make_variable_map(variables)
|
689
685
|
map = {}
|
690
686
|
|
691
687
|
variables.each { |variable, class_module|
|
@@ -698,7 +694,7 @@ class RDoc::Store
|
|
698
694
|
##
|
699
695
|
# Path to the ri data for +method_name+ in +klass_name+
|
700
696
|
|
701
|
-
def method_file
|
697
|
+
def method_file(klass_name, method_name)
|
702
698
|
method_name = method_name.split('::').last
|
703
699
|
method_name =~ /#(.*)/
|
704
700
|
method_type = $1 ? 'i' : 'c'
|
@@ -726,7 +722,7 @@ class RDoc::Store
|
|
726
722
|
##
|
727
723
|
# Returns the RDoc::TopLevel that is a text file and has the given +name+
|
728
724
|
|
729
|
-
def page
|
725
|
+
def page(name)
|
730
726
|
@text_files_hash.each_value.find do |file|
|
731
727
|
file.page_name == name or file.base_name == name
|
732
728
|
end
|
@@ -735,7 +731,7 @@ class RDoc::Store
|
|
735
731
|
##
|
736
732
|
# Path to the ri data for +page_name+
|
737
733
|
|
738
|
-
def page_file
|
734
|
+
def page_file(page_name)
|
739
735
|
file_name = File.basename(page_name).gsub('.', '_')
|
740
736
|
|
741
737
|
File.join @path, File.dirname(page_name), "page-#{file_name}.ri"
|
@@ -746,7 +742,7 @@ class RDoc::Store
|
|
746
742
|
#
|
747
743
|
# See RDoc::Context#remove_from_documentation?
|
748
744
|
|
749
|
-
def remove_nodoc
|
745
|
+
def remove_nodoc(all_hash)
|
750
746
|
all_hash.keys.each do |name|
|
751
747
|
context = all_hash[name]
|
752
748
|
all_hash.delete(name) if context.remove_from_documentation?
|
@@ -766,7 +762,7 @@ class RDoc::Store
|
|
766
762
|
save_method klass, method
|
767
763
|
end
|
768
764
|
|
769
|
-
klass.
|
765
|
+
klass.attributes.each do |attribute|
|
770
766
|
save_method klass, attribute
|
771
767
|
end
|
772
768
|
end
|
@@ -808,7 +804,7 @@ class RDoc::Store
|
|
808
804
|
##
|
809
805
|
# Writes the ri data for +klass+ (or module)
|
810
806
|
|
811
|
-
def save_class
|
807
|
+
def save_class(klass)
|
812
808
|
full_name = klass.full_name
|
813
809
|
|
814
810
|
FileUtils.mkdir_p class_path(full_name) unless @dry_run
|
@@ -882,7 +878,7 @@ class RDoc::Store
|
|
882
878
|
##
|
883
879
|
# Writes the ri data for +method+ on +klass+
|
884
880
|
|
885
|
-
def save_method
|
881
|
+
def save_method(klass, method)
|
886
882
|
full_name = klass.full_name
|
887
883
|
|
888
884
|
FileUtils.mkdir_p class_path(full_name) unless @dry_run
|
@@ -905,7 +901,7 @@ class RDoc::Store
|
|
905
901
|
##
|
906
902
|
# Writes the ri data for +page+
|
907
903
|
|
908
|
-
def save_page
|
904
|
+
def save_page(page)
|
909
905
|
return unless page.text?
|
910
906
|
|
911
907
|
path = page_file page.full_name
|
@@ -952,7 +948,7 @@ class RDoc::Store
|
|
952
948
|
##
|
953
949
|
# Sets the title page for this RDoc store.
|
954
950
|
|
955
|
-
def title=
|
951
|
+
def title=(title)
|
956
952
|
@cache[:title] = title
|
957
953
|
end
|
958
954
|
|
data/lib/rdoc/task.rb
CHANGED
@@ -154,7 +154,7 @@ class RDoc::Task < Rake::TaskLib
|
|
154
154
|
# Create an RDoc task with the given name. See the RDoc::Task class overview
|
155
155
|
# for documentation.
|
156
156
|
|
157
|
-
def initialize
|
157
|
+
def initialize(name = :rdoc) # :yield: self
|
158
158
|
defaults
|
159
159
|
|
160
160
|
check_names name
|
@@ -170,7 +170,7 @@ class RDoc::Task < Rake::TaskLib
|
|
170
170
|
# Ensures that +names+ only includes names for the :rdoc, :clobber_rdoc and
|
171
171
|
# :rerdoc. If other names are given an ArgumentError is raised.
|
172
172
|
|
173
|
-
def check_names
|
173
|
+
def check_names(names)
|
174
174
|
return unless Hash === names
|
175
175
|
|
176
176
|
invalid_options =
|