rdoc 7.2.0 → 8.0.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 +3 -4
- data/LICENSE.rdoc +4 -0
- data/README.md +43 -2
- data/doc/markup_reference/markdown.md +104 -3
- data/lib/rdoc/code_object/alias.rb +2 -8
- data/lib/rdoc/code_object/any_method.rb +11 -6
- data/lib/rdoc/code_object/attr.rb +11 -6
- data/lib/rdoc/code_object/class_module.rb +62 -32
- data/lib/rdoc/code_object/constant.rb +29 -3
- data/lib/rdoc/code_object/context/section.rb +4 -35
- data/lib/rdoc/code_object/context.rb +39 -34
- data/lib/rdoc/code_object/method_attr.rb +9 -15
- data/lib/rdoc/code_object/mixin.rb +2 -2
- data/lib/rdoc/code_object/top_level.rb +9 -3
- data/lib/rdoc/code_object.rb +2 -4
- data/lib/rdoc/comment.rb +0 -65
- data/lib/rdoc/cross_reference.rb +7 -27
- data/lib/rdoc/encoding.rb +3 -3
- data/lib/rdoc/generator/aliki.rb +17 -0
- data/lib/rdoc/generator/darkfish.rb +12 -6
- data/lib/rdoc/generator/json_index.rb +2 -2
- data/lib/rdoc/generator/markup.rb +56 -31
- data/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
- data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_head.rhtml +1 -1
- 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_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 +337 -111
- data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/js/aliki.js +20 -18
- 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/_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/i18n/text.rb +3 -3
- data/lib/rdoc/markdown.kpeg +15 -10
- data/lib/rdoc/markdown.rb +289 -104
- data/lib/rdoc/markup/document.rb +2 -2
- data/lib/rdoc/markup/formatter.rb +24 -34
- data/lib/rdoc/markup/heading.rb +1 -4
- data/lib/rdoc/markup/indented_paragraph.rb +1 -1
- data/lib/rdoc/markup/list.rb +2 -2
- data/lib/rdoc/markup/list_item.rb +2 -2
- data/lib/rdoc/markup/pre_process.rb +0 -25
- data/lib/rdoc/markup/to_ansi.rb +1 -1
- data/lib/rdoc/markup/to_bs.rb +1 -1
- data/lib/rdoc/markup/to_html.rb +131 -53
- data/lib/rdoc/markup/to_html_crossref.rb +97 -71
- data/lib/rdoc/markup/to_html_snippet.rb +5 -5
- data/lib/rdoc/markup/to_joined_paragraph.rb +0 -5
- data/lib/rdoc/markup/to_label.rb +2 -2
- data/lib/rdoc/markup/to_markdown.rb +1 -1
- data/lib/rdoc/markup/to_rdoc.rb +2 -2
- data/lib/rdoc/markup/to_table_of_contents.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +0 -7
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/options.rb +36 -51
- data/lib/rdoc/parser/c.rb +7 -6
- data/lib/rdoc/parser/rbs.rb +275 -0
- data/lib/rdoc/parser/ruby.rb +954 -2066
- data/lib/rdoc/parser/ruby_colorizer.rb +253 -0
- data/lib/rdoc/parser.rb +3 -2
- data/lib/rdoc/rbs_helper.rb +186 -0
- data/lib/rdoc/rdoc.rb +196 -24
- data/lib/rdoc/ri/driver.rb +8 -2
- data/lib/rdoc/ri/paths.rb +1 -1
- data/lib/rdoc/{servlet.rb → ri/servlet.rb} +5 -5
- data/lib/rdoc/ri.rb +4 -3
- data/lib/rdoc/rubygems_hook.rb +11 -11
- data/lib/rdoc/server.rb +460 -0
- data/lib/rdoc/stats.rb +147 -124
- data/lib/rdoc/store.rb +212 -4
- data/lib/rdoc/task.rb +16 -15
- data/lib/rdoc/text.rb +1 -118
- data/lib/rdoc/token_stream.rb +11 -33
- 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 +35 -18
- 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/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/rdoc.rb
CHANGED
|
@@ -5,6 +5,7 @@ require 'find'
|
|
|
5
5
|
require 'fileutils'
|
|
6
6
|
require 'pathname'
|
|
7
7
|
require 'time'
|
|
8
|
+
require_relative 'rbs_helper'
|
|
8
9
|
|
|
9
10
|
##
|
|
10
11
|
# This is the driver for generating RDoc output. It handles file parsing and
|
|
@@ -140,7 +141,7 @@ class RDoc::RDoc
|
|
|
140
141
|
# Turns RDoc from stdin into HTML
|
|
141
142
|
|
|
142
143
|
def handle_pipe
|
|
143
|
-
@html = RDoc::Markup::ToHtml.new @options
|
|
144
|
+
@html = RDoc::Markup::ToHtml.new(pipe: @options.pipe, output_decoration: @options.output_decoration)
|
|
144
145
|
|
|
145
146
|
parser = RDoc::Text::MARKUP_FORMAT[@options.markup]
|
|
146
147
|
|
|
@@ -332,20 +333,7 @@ option)
|
|
|
332
333
|
|
|
333
334
|
return unless content
|
|
334
335
|
|
|
335
|
-
|
|
336
|
-
begin
|
|
337
|
-
relative_path = filename_path.relative_path_from @options.root
|
|
338
|
-
rescue ArgumentError
|
|
339
|
-
relative_path = filename_path
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
if @options.page_dir and
|
|
343
|
-
relative_path.to_s.start_with? @options.page_dir.to_s then
|
|
344
|
-
relative_path =
|
|
345
|
-
relative_path.relative_path_from @options.page_dir
|
|
346
|
-
end
|
|
347
|
-
|
|
348
|
-
top_level = @store.add_file filename, relative_name: relative_path.to_s
|
|
336
|
+
top_level = @store.add_file filename, relative_name: relative_path_for(filename)
|
|
349
337
|
|
|
350
338
|
parser = RDoc::Parser.for top_level, content, @options, @stats
|
|
351
339
|
|
|
@@ -369,13 +357,25 @@ it or perhaps the original author's permissions are to restrictive. If the
|
|
|
369
357
|
this is not your library please report a bug to the author.
|
|
370
358
|
EOF
|
|
371
359
|
rescue => e
|
|
372
|
-
|
|
360
|
+
syntax_check_command = syntax_check_command_for filename, parser&.class
|
|
361
|
+
syntax_check_message = if syntax_check_command
|
|
362
|
+
<<~MESSAGE
|
|
373
363
|
Before reporting this, could you check that the file you're documenting
|
|
374
364
|
has proper syntax:
|
|
375
365
|
|
|
376
|
-
#{
|
|
366
|
+
#{syntax_check_command}
|
|
367
|
+
MESSAGE
|
|
368
|
+
else
|
|
369
|
+
<<~MESSAGE
|
|
370
|
+
Before reporting this, could you check that the file you're documenting
|
|
371
|
+
has proper syntax for its language?
|
|
372
|
+
MESSAGE
|
|
373
|
+
end
|
|
377
374
|
|
|
378
|
-
|
|
375
|
+
$stderr.puts <<-EOF
|
|
376
|
+
#{syntax_check_message}
|
|
377
|
+
RDoc's parsers are not full language parsers and may fail when fed invalid
|
|
378
|
+
source files.
|
|
379
379
|
|
|
380
380
|
The internal error was:
|
|
381
381
|
|
|
@@ -388,6 +388,38 @@ The internal error was:
|
|
|
388
388
|
raise e
|
|
389
389
|
end
|
|
390
390
|
|
|
391
|
+
def syntax_check_command_for(filename, parser_class = RDoc::Parser.can_parse_by_name(filename))
|
|
392
|
+
if parser_class == RDoc::Parser::Ruby
|
|
393
|
+
"#{Gem.ruby} -c #{filename}"
|
|
394
|
+
elsif parser_class == RDoc::Parser::C
|
|
395
|
+
cc = ENV['CC']
|
|
396
|
+
cc = 'cc' if cc.nil? || cc.empty?
|
|
397
|
+
"#{cc} -fsyntax-only #{filename}"
|
|
398
|
+
end
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
##
|
|
402
|
+
# Returns the relative path for +filename+ against +options.root+ (and
|
|
403
|
+
# +options.page_dir+ when set). This is the key used by RDoc::Store to
|
|
404
|
+
# identify files.
|
|
405
|
+
|
|
406
|
+
def relative_path_for(filename)
|
|
407
|
+
filename_path = Pathname(filename).expand_path
|
|
408
|
+
begin
|
|
409
|
+
relative_path = filename_path.relative_path_from @options.root
|
|
410
|
+
rescue ArgumentError
|
|
411
|
+
relative_path = filename_path
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
if @options.page_dir &&
|
|
415
|
+
relative_path.to_s.start_with?(@options.page_dir.to_s)
|
|
416
|
+
relative_path =
|
|
417
|
+
relative_path.relative_path_from @options.page_dir
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
relative_path.to_s
|
|
421
|
+
end
|
|
422
|
+
|
|
391
423
|
##
|
|
392
424
|
# Parse each file on the command line, recursively entering directories.
|
|
393
425
|
|
|
@@ -420,8 +452,8 @@ The internal error was:
|
|
|
420
452
|
|
|
421
453
|
def remove_unparseable(files)
|
|
422
454
|
files.reject do |file, *|
|
|
423
|
-
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)
|
|
424
|
-
(file =~ /tags
|
|
455
|
+
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)\z/i or
|
|
456
|
+
(file =~ /tags\z/i and
|
|
425
457
|
/\A(\f\n[^,]+,\d+$|!_TAG_)/.match?(File.binread(file, 100)))
|
|
426
458
|
end
|
|
427
459
|
end
|
|
@@ -456,6 +488,21 @@ The internal error was:
|
|
|
456
488
|
exit
|
|
457
489
|
end
|
|
458
490
|
|
|
491
|
+
if @options.server_port
|
|
492
|
+
@store.load_cache
|
|
493
|
+
|
|
494
|
+
parse_files @options.files
|
|
495
|
+
record_auto_discovered_rbs_signature_mtimes
|
|
496
|
+
|
|
497
|
+
@options.default_title = "RDoc Documentation"
|
|
498
|
+
|
|
499
|
+
load_auto_discovered_rbs_signatures
|
|
500
|
+
@store.complete @options.visibility
|
|
501
|
+
|
|
502
|
+
start_server
|
|
503
|
+
exit
|
|
504
|
+
end
|
|
505
|
+
|
|
459
506
|
unless @options.coverage_report then
|
|
460
507
|
@last_modified = setup_output_dir @options.op_dir, @options.force_update
|
|
461
508
|
end
|
|
@@ -464,10 +511,21 @@ The internal error was:
|
|
|
464
511
|
|
|
465
512
|
@store.load_cache
|
|
466
513
|
|
|
514
|
+
auto_discovered_rbs_signatures_changed = auto_discovered_rbs_signatures_changed?
|
|
515
|
+
# When only auto-discovered RBS signatures changed, no Ruby file would be
|
|
516
|
+
# reparsed under normal mtime checks. The store cache holds class metadata
|
|
517
|
+
# but not live RDoc::Context objects, so the generator would have nothing
|
|
518
|
+
# to iterate. Force a full reparse so updated signatures show up in the
|
|
519
|
+
# rendered output.
|
|
520
|
+
@last_modified.clear if auto_discovered_rbs_signatures_changed
|
|
521
|
+
|
|
467
522
|
file_info = parse_files @options.files
|
|
523
|
+
record_auto_discovered_rbs_signature_mtimes
|
|
468
524
|
|
|
469
525
|
@options.default_title = "RDoc Documentation"
|
|
470
526
|
|
|
527
|
+
load_auto_discovered_rbs_signatures
|
|
528
|
+
|
|
471
529
|
@store.complete @options.visibility
|
|
472
530
|
|
|
473
531
|
@stats.coverage_level = @options.coverage_report
|
|
@@ -475,8 +533,8 @@ The internal error was:
|
|
|
475
533
|
if @options.coverage_report then
|
|
476
534
|
puts
|
|
477
535
|
|
|
478
|
-
puts @stats.report
|
|
479
|
-
elsif file_info.empty? then
|
|
536
|
+
puts @stats.report
|
|
537
|
+
elsif file_info.empty? && !auto_discovered_rbs_signatures_changed then
|
|
480
538
|
$stderr.puts "\nNo newer files." unless @options.quiet
|
|
481
539
|
else
|
|
482
540
|
gen_klass = @options.generator
|
|
@@ -488,7 +546,7 @@ The internal error was:
|
|
|
488
546
|
|
|
489
547
|
if @stats and (@options.coverage_report or not @options.quiet) then
|
|
490
548
|
puts
|
|
491
|
-
puts @stats.summary
|
|
549
|
+
puts @stats.summary
|
|
492
550
|
end
|
|
493
551
|
|
|
494
552
|
exit @stats.fully_documented? if @options.coverage_report
|
|
@@ -507,7 +565,9 @@ The internal error was:
|
|
|
507
565
|
Dir.chdir @options.op_dir do
|
|
508
566
|
unless @options.quiet then
|
|
509
567
|
$stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..."
|
|
510
|
-
|
|
568
|
+
uri = "file://#{Dir.pwd}/index.html"
|
|
569
|
+
ref = $stderr.tty? ? "\e]8;;#{uri}\e\\#{uri}\e]8;;\e\\" : uri
|
|
570
|
+
$stderr.puts "\nYou can visit the home page at: #{ref}"
|
|
511
571
|
end
|
|
512
572
|
|
|
513
573
|
@generator.generate
|
|
@@ -516,6 +576,99 @@ The internal error was:
|
|
|
516
576
|
end
|
|
517
577
|
end
|
|
518
578
|
|
|
579
|
+
##
|
|
580
|
+
# Loads RBS type signatures from the project's +sig+ directory and RBS
|
|
581
|
+
# stdlib, then merges them into the store's code objects.
|
|
582
|
+
|
|
583
|
+
def load_auto_discovered_rbs_signatures
|
|
584
|
+
sig_dirs = []
|
|
585
|
+
sig_dir = File.join(@options.root.to_s, 'sig')
|
|
586
|
+
sig_dirs << sig_dir if File.directory?(sig_dir)
|
|
587
|
+
signatures = RDoc::RbsHelper.load_signatures(*sig_dirs)
|
|
588
|
+
@store.merge_rbs_signatures(signatures)
|
|
589
|
+
rescue RBS::BaseError, Errno::ENOENT, LoadError => e
|
|
590
|
+
# In server mode, a previous successful load may have populated the store;
|
|
591
|
+
# drop those signatures so a now-broken sig file doesn't keep showing
|
|
592
|
+
# stale types alongside the warning.
|
|
593
|
+
@store.clear_rbs_signatures
|
|
594
|
+
@options.warn "Failed to load RBS type signatures: #{e.message}"
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
##
|
|
598
|
+
# Returns RBS files that RDoc auto-discovers for signature loading.
|
|
599
|
+
|
|
600
|
+
def auto_discovered_rbs_signature_files
|
|
601
|
+
Dir[File.join(@options.root.to_s, 'sig', '**', '*.rbs')].sort
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
##
|
|
605
|
+
# Returns true if any auto-discovered RBS signature file has changed since
|
|
606
|
+
# the last run.
|
|
607
|
+
|
|
608
|
+
def auto_discovered_rbs_signatures_changed?
|
|
609
|
+
current = auto_discovered_rbs_signature_mtimes
|
|
610
|
+
previous = @last_modified.select { |file, _| auto_discovered_rbs_signature_file?(file) }
|
|
611
|
+
|
|
612
|
+
return true unless (previous.keys - current.keys).empty?
|
|
613
|
+
|
|
614
|
+
current.any? do |file, mtime|
|
|
615
|
+
last_modified = @last_modified[file]
|
|
616
|
+
last_modified.nil? || mtime.to_i > last_modified.to_i
|
|
617
|
+
end
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
##
|
|
621
|
+
# Records auto-discovered RBS signature file mtimes so normal generation
|
|
622
|
+
# freshness checks and the live server watcher can see signature-only edits.
|
|
623
|
+
|
|
624
|
+
def record_auto_discovered_rbs_signature_mtimes
|
|
625
|
+
@last_modified.reject! { |file, _| auto_discovered_rbs_signature_file?(file) }
|
|
626
|
+
@last_modified.merge! auto_discovered_rbs_signature_mtimes
|
|
627
|
+
end
|
|
628
|
+
|
|
629
|
+
##
|
|
630
|
+
# Files watched by the live preview server.
|
|
631
|
+
|
|
632
|
+
def watch_files
|
|
633
|
+
(@last_modified.keys + auto_discovered_rbs_signature_files).uniq
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
##
|
|
637
|
+
# Returns true for project RBS files that are auto-discovered for signature
|
|
638
|
+
# loading. RDoc parses any selected .rbs file as documentation input, but
|
|
639
|
+
# only +sig/**/*.rbs+ files are loaded through RBS::EnvironmentLoader for
|
|
640
|
+
# type signature merging and live-reload bookkeeping.
|
|
641
|
+
|
|
642
|
+
def auto_discovered_rbs_signature_file?(file) # :nodoc:
|
|
643
|
+
return false unless File.extname(file) == '.rbs'
|
|
644
|
+
|
|
645
|
+
root = Pathname(@options.root.to_s).expand_path
|
|
646
|
+
relative_path = Pathname(file).expand_path.relative_path_from root
|
|
647
|
+
relative_path.each_filename.first == 'sig'
|
|
648
|
+
rescue ArgumentError
|
|
649
|
+
# file and root may be on different drives on Windows
|
|
650
|
+
false
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
##
|
|
654
|
+
# Returns mtimes for auto-discovered RBS signature files.
|
|
655
|
+
|
|
656
|
+
def auto_discovered_rbs_signature_mtimes # :nodoc:
|
|
657
|
+
auto_discovered_rbs_signature_files.each_with_object({}) do |file, mtimes|
|
|
658
|
+
mtime = RDoc.safe_mtime(file)
|
|
659
|
+
mtimes[file] = mtime if mtime
|
|
660
|
+
end
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
##
|
|
664
|
+
# Starts a live-reloading HTTP server for previewing documentation.
|
|
665
|
+
# Called from #document when <tt>--server</tt> is given.
|
|
666
|
+
|
|
667
|
+
def start_server
|
|
668
|
+
server = RDoc::Server.new(self, @options.server_port)
|
|
669
|
+
server.start
|
|
670
|
+
end
|
|
671
|
+
|
|
519
672
|
##
|
|
520
673
|
# Removes a siginfo handler and replaces the previous
|
|
521
674
|
|
|
@@ -527,14 +680,33 @@ The internal error was:
|
|
|
527
680
|
trap 'INFO', handler
|
|
528
681
|
end
|
|
529
682
|
|
|
683
|
+
##
|
|
684
|
+
# Returns true when +extension+ is the RBS gem's RDoc discovery hook.
|
|
685
|
+
# Released RBS gems install their plugin through this hook, so skip it to
|
|
686
|
+
# avoid replacing the built-in parser during discovery.
|
|
687
|
+
|
|
688
|
+
def self.rbs_discovery_extension?(extension) # :nodoc:
|
|
689
|
+
extension = File.expand_path(extension)
|
|
690
|
+
|
|
691
|
+
Gem::Specification.find_all_by_name('rbs').any? do |spec|
|
|
692
|
+
File.expand_path('lib/rdoc/discover.rb', spec.full_gem_path) == extension
|
|
693
|
+
end
|
|
694
|
+
end
|
|
695
|
+
|
|
530
696
|
end
|
|
531
697
|
|
|
698
|
+
# Load built-in parser registrations before RubyGems discovery, then skip the
|
|
699
|
+
# RBS gem's plugin hook so it cannot replace RDoc::Parser::RBS.
|
|
700
|
+
require_relative 'parser'
|
|
701
|
+
|
|
532
702
|
begin
|
|
533
703
|
require 'rubygems'
|
|
534
704
|
|
|
535
705
|
rdoc_extensions = Gem.find_latest_files 'rdoc/discover'
|
|
536
706
|
|
|
537
707
|
rdoc_extensions.each do |extension|
|
|
708
|
+
next if RDoc::RDoc.rbs_discovery_extension?(extension)
|
|
709
|
+
|
|
538
710
|
begin
|
|
539
711
|
load extension
|
|
540
712
|
rescue => e
|
data/lib/rdoc/ri/driver.rb
CHANGED
|
@@ -1218,7 +1218,7 @@ or the PAGER environment variable.
|
|
|
1218
1218
|
comment = RDoc::Comment.new("missing documentation at #{e.file}")
|
|
1219
1219
|
comment.parse
|
|
1220
1220
|
|
|
1221
|
-
method = RDoc::AnyMethod.new
|
|
1221
|
+
method = RDoc::AnyMethod.new name
|
|
1222
1222
|
method.comment = comment
|
|
1223
1223
|
method
|
|
1224
1224
|
end
|
|
@@ -1415,6 +1415,8 @@ or the PAGER environment variable.
|
|
|
1415
1415
|
out << RDoc::Markup::Rule.new(1)
|
|
1416
1416
|
|
|
1417
1417
|
render_method_arguments out, method.arglists
|
|
1418
|
+
sig = method.type_signature_lines || store.rbs_signature_for(method)
|
|
1419
|
+
render_method_type_signature out, sig if sig
|
|
1418
1420
|
render_method_superclass out, method
|
|
1419
1421
|
if method.is_alias_for
|
|
1420
1422
|
al = method.is_alias_for
|
|
@@ -1452,6 +1454,10 @@ or the PAGER environment variable.
|
|
|
1452
1454
|
end
|
|
1453
1455
|
end
|
|
1454
1456
|
|
|
1457
|
+
def render_method_type_signature(out, lines) # :nodoc:
|
|
1458
|
+
out << RDoc::Markup::Verbatim.new(*lines.map { |s| s + "\n" })
|
|
1459
|
+
end
|
|
1460
|
+
|
|
1455
1461
|
def render_method_superclass(out, method) # :nodoc:
|
|
1456
1462
|
return unless
|
|
1457
1463
|
method.respond_to?(:superclass_method) and method.superclass_method
|
|
@@ -1521,7 +1527,7 @@ or the PAGER environment variable.
|
|
|
1521
1527
|
|
|
1522
1528
|
extra_doc_dirs = @stores.map {|s| s.type == :extra ? s.path : nil}.compact
|
|
1523
1529
|
|
|
1524
|
-
server.mount '/', RDoc::Servlet, nil, extra_doc_dirs
|
|
1530
|
+
server.mount '/', RDoc::RI::Servlet, nil, extra_doc_dirs
|
|
1525
1531
|
|
|
1526
1532
|
trap 'INT' do server.shutdown end
|
|
1527
1533
|
trap 'TERM' do server.shutdown end
|
data/lib/rdoc/ri/paths.rb
CHANGED
|
@@ -30,7 +30,7 @@ module RDoc::RI::Paths
|
|
|
30
30
|
# :extra:: ri data directory from the command line. Yielded for each
|
|
31
31
|
# entry in +extra_dirs+
|
|
32
32
|
|
|
33
|
-
def self.each
|
|
33
|
+
def self.each(system = true, site = true, home = true, gems = :latest, *extra_dirs) # :yields: directory, type
|
|
34
34
|
return enum_for __method__, system, site, home, gems, *extra_dirs unless
|
|
35
35
|
block_given?
|
|
36
36
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require_relative '
|
|
2
|
+
require_relative '../../rdoc'
|
|
3
3
|
require 'erb'
|
|
4
4
|
require 'time'
|
|
5
5
|
require 'json'
|
|
@@ -24,14 +24,14 @@ end
|
|
|
24
24
|
#
|
|
25
25
|
# server = WEBrick::HTTPServer.new Port: 8000
|
|
26
26
|
#
|
|
27
|
-
# server.mount '/', RDoc::Servlet
|
|
27
|
+
# server.mount '/', RDoc::RI::Servlet
|
|
28
28
|
#
|
|
29
29
|
# If you want to mount the servlet some other place than the root, provide the
|
|
30
30
|
# base path when mounting:
|
|
31
31
|
#
|
|
32
|
-
# server.mount '/rdoc', RDoc::Servlet, '/rdoc'
|
|
32
|
+
# server.mount '/rdoc', RDoc::RI::Servlet, '/rdoc'
|
|
33
33
|
|
|
34
|
-
class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
34
|
+
class RDoc::RI::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
35
35
|
|
|
36
36
|
@server_stores = Hash.new { |hash, server| hash[server] = {} }
|
|
37
37
|
@cache = Hash.new { |hash, store| hash[store] = {} }
|
|
@@ -50,7 +50,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
|
50
50
|
# Creates an instance of this servlet that shares cached data between
|
|
51
51
|
# requests.
|
|
52
52
|
|
|
53
|
-
def self.get_instance
|
|
53
|
+
def self.get_instance(server, *options) # :nodoc:
|
|
54
54
|
stores = @server_stores[server]
|
|
55
55
|
|
|
56
56
|
new server, stores, @cache, *options
|
data/lib/rdoc/ri.rb
CHANGED
|
@@ -13,8 +13,9 @@ module RDoc::RI
|
|
|
13
13
|
|
|
14
14
|
class Error < RDoc::Error; end
|
|
15
15
|
|
|
16
|
-
autoload :Driver,
|
|
17
|
-
autoload :Paths,
|
|
18
|
-
autoload :
|
|
16
|
+
autoload :Driver, "#{__dir__}/ri/driver"
|
|
17
|
+
autoload :Paths, "#{__dir__}/ri/paths"
|
|
18
|
+
autoload :Servlet, "#{__dir__}/ri/servlet"
|
|
19
|
+
autoload :Store, "#{__dir__}/ri/store"
|
|
19
20
|
|
|
20
21
|
end
|
data/lib/rdoc/rubygems_hook.rb
CHANGED
|
@@ -254,18 +254,18 @@ class RDoc::RubyGemsHook
|
|
|
254
254
|
|
|
255
255
|
end
|
|
256
256
|
|
|
257
|
-
# This class is referenced by RubyGems to create documents.
|
|
258
|
-
# All implementations are moved to the above RubyGemsHook.
|
|
259
|
-
#
|
|
260
|
-
# This class does nothing when this RDoc is installed as a normal gem
|
|
261
|
-
# or a bundled gem.
|
|
262
|
-
#
|
|
263
|
-
# This class does generate/remove documents for compatibility when
|
|
264
|
-
# this RDoc is installed as a default gem.
|
|
265
|
-
#
|
|
266
|
-
# We can remove this when all maintained RubyGems remove
|
|
267
|
-
# `rubygems/rdoc.rb`.
|
|
268
257
|
module RDoc
|
|
258
|
+
# This class is referenced by RubyGems to create documents.
|
|
259
|
+
# All implementations are moved to the above RubyGemsHook.
|
|
260
|
+
#
|
|
261
|
+
# This class does nothing when this RDoc is installed as a normal gem
|
|
262
|
+
# or a bundled gem.
|
|
263
|
+
#
|
|
264
|
+
# This class does generate/remove documents for compatibility when
|
|
265
|
+
# this RDoc is installed as a default gem.
|
|
266
|
+
#
|
|
267
|
+
# We can remove this when all maintained RubyGems remove
|
|
268
|
+
# `rubygems/rdoc.rb`.
|
|
269
269
|
class RubygemsHook
|
|
270
270
|
|
|
271
271
|
attr_accessor :generate_rdoc, :generate_ri, :force
|