rdoc 6.13.1 → 6.14.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/README.rdoc +3 -1
- data/lib/rdoc/code_object/any_method.rb +4 -4
- data/lib/rdoc/code_object/attr.rb +3 -3
- data/lib/rdoc/code_object/class_module.rb +15 -15
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +7 -7
- data/lib/rdoc/code_object/context.rb +19 -19
- data/lib/rdoc/code_object/method_attr.rb +6 -6
- 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/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +7 -7
- data/lib/rdoc/code_object.rb +3 -3
- data/lib/rdoc/comment.rb +6 -6
- 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 +15 -15
- data/lib/rdoc/generator/json_index.rb +3 -3
- data/lib/rdoc/generator/markup.rb +12 -0
- data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
- 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 -1
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
- 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 +4 -4
- 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 +21 -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 +5 -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 +19 -12
- data/lib/rdoc/parser/c.rb +16 -16
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +1 -1
- data/lib/rdoc/parser/ruby.rb +43 -43
- 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 +8 -8
- data/lib/rdoc/ri/driver.rb +49 -49
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +14 -11
- data/lib/rdoc/servlet.rb +15 -15
- 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 +12 -12
- data/lib/rdoc/store.rb +30 -30
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +11 -11
- 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
- metadata +17 -3
data/lib/rdoc/ri/driver.rb
CHANGED
@@ -96,7 +96,7 @@ class RDoc::RI::Driver
|
|
96
96
|
##
|
97
97
|
# Dump +data_path+ using pp
|
98
98
|
|
99
|
-
def self.dump
|
99
|
+
def self.dump(data_path)
|
100
100
|
require 'pp'
|
101
101
|
|
102
102
|
File.open data_path, 'rb' do |io|
|
@@ -107,7 +107,7 @@ class RDoc::RI::Driver
|
|
107
107
|
##
|
108
108
|
# Parses +argv+ and returns a Hash of options
|
109
109
|
|
110
|
-
def self.process_args
|
110
|
+
def self.process_args(argv)
|
111
111
|
options = default_options
|
112
112
|
|
113
113
|
opts = OptionParser.new do |opt|
|
@@ -384,7 +384,7 @@ or the PAGER environment variable.
|
|
384
384
|
##
|
385
385
|
# Runs the ri command line executable using +argv+
|
386
386
|
|
387
|
-
def self.run
|
387
|
+
def self.run(argv = ARGV)
|
388
388
|
options = process_args argv
|
389
389
|
|
390
390
|
if options[:dump_path] then
|
@@ -399,7 +399,7 @@ or the PAGER environment variable.
|
|
399
399
|
##
|
400
400
|
# Creates a new driver using +initial_options+ from ::process_args
|
401
401
|
|
402
|
-
def initialize
|
402
|
+
def initialize(initial_options = {})
|
403
403
|
@paging = false
|
404
404
|
@classes = nil
|
405
405
|
|
@@ -438,7 +438,7 @@ or the PAGER environment variable.
|
|
438
438
|
##
|
439
439
|
# Adds paths for undocumented classes +also_in+ to +out+
|
440
440
|
|
441
|
-
def add_also_in
|
441
|
+
def add_also_in(out, also_in)
|
442
442
|
return if also_in.empty?
|
443
443
|
|
444
444
|
out << RDoc::Markup::Rule.new(1)
|
@@ -455,7 +455,7 @@ or the PAGER environment variable.
|
|
455
455
|
# Adds a class header to +out+ for class +name+ which is described in
|
456
456
|
# +classes+.
|
457
457
|
|
458
|
-
def add_class
|
458
|
+
def add_class(out, name, classes)
|
459
459
|
heading = if classes.all? { |klass| klass.module? } then
|
460
460
|
name
|
461
461
|
else
|
@@ -475,14 +475,14 @@ or the PAGER environment variable.
|
|
475
475
|
##
|
476
476
|
# Adds "(from ...)" to +out+ for +store+
|
477
477
|
|
478
|
-
def add_from
|
478
|
+
def add_from(out, store)
|
479
479
|
out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
|
480
480
|
end
|
481
481
|
|
482
482
|
##
|
483
483
|
# Adds +extends+ to +out+
|
484
484
|
|
485
|
-
def add_extends
|
485
|
+
def add_extends(out, extends)
|
486
486
|
add_extension_modules out, 'Extended by', extends
|
487
487
|
end
|
488
488
|
|
@@ -490,7 +490,7 @@ or the PAGER environment variable.
|
|
490
490
|
# Adds a list of +extensions+ to this module of the given +type+ to +out+.
|
491
491
|
# add_includes and add_extends call this, so you should use those directly.
|
492
492
|
|
493
|
-
def add_extension_modules
|
493
|
+
def add_extension_modules(out, type, extensions)
|
494
494
|
return if extensions.empty?
|
495
495
|
|
496
496
|
out << RDoc::Markup::Rule.new(1)
|
@@ -508,7 +508,7 @@ or the PAGER environment variable.
|
|
508
508
|
##
|
509
509
|
# Renders multiple included +modules+ from +store+ to +out+.
|
510
510
|
|
511
|
-
def add_extension_modules_multiple
|
511
|
+
def add_extension_modules_multiple(out, store, modules) # :nodoc:
|
512
512
|
out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
|
513
513
|
|
514
514
|
wout, with = modules.partition { |incl| incl.comment.empty? }
|
@@ -535,7 +535,7 @@ or the PAGER environment variable.
|
|
535
535
|
##
|
536
536
|
# Adds a single extension module +include+ from +store+ to +out+
|
537
537
|
|
538
|
-
def add_extension_modules_single
|
538
|
+
def add_extension_modules_single(out, store, include) # :nodoc:
|
539
539
|
name = include.name
|
540
540
|
path = store.friendly_path
|
541
541
|
out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
|
@@ -549,14 +549,14 @@ or the PAGER environment variable.
|
|
549
549
|
##
|
550
550
|
# Adds +includes+ to +out+
|
551
551
|
|
552
|
-
def add_includes
|
552
|
+
def add_includes(out, includes)
|
553
553
|
add_extension_modules out, 'Includes', includes
|
554
554
|
end
|
555
555
|
|
556
556
|
##
|
557
557
|
# Looks up the method +name+ and adds it to +out+
|
558
558
|
|
559
|
-
def add_method
|
559
|
+
def add_method(out, name)
|
560
560
|
filtered = lookup_method name
|
561
561
|
method_document out, name, filtered
|
562
562
|
end
|
@@ -564,7 +564,7 @@ or the PAGER environment variable.
|
|
564
564
|
##
|
565
565
|
# Adds documentation for all methods in +klass+ to +out+
|
566
566
|
|
567
|
-
def add_method_documentation
|
567
|
+
def add_method_documentation(out, klass)
|
568
568
|
klass.method_list.each do |method|
|
569
569
|
begin
|
570
570
|
add_method out, method.full_name
|
@@ -577,7 +577,7 @@ or the PAGER environment variable.
|
|
577
577
|
##
|
578
578
|
# Adds a list of +methods+ to +out+ with a heading of +name+
|
579
579
|
|
580
|
-
def add_method_list
|
580
|
+
def add_method_list(out, methods, name)
|
581
581
|
return if methods.empty?
|
582
582
|
|
583
583
|
out << RDoc::Markup::Heading.new(1, "#{name}:")
|
@@ -597,7 +597,7 @@ or the PAGER environment variable.
|
|
597
597
|
##
|
598
598
|
# Returns ancestor classes of +klass+
|
599
599
|
|
600
|
-
def ancestors_of
|
600
|
+
def ancestors_of(klass)
|
601
601
|
ancestors = []
|
602
602
|
|
603
603
|
unexamined = [klass]
|
@@ -634,7 +634,7 @@ or the PAGER environment variable.
|
|
634
634
|
##
|
635
635
|
# Builds a RDoc::Markup::Document from +found+, +klasess+ and +includes+
|
636
636
|
|
637
|
-
def class_document
|
637
|
+
def class_document(name, found, klasses, includes, extends)
|
638
638
|
also_in = []
|
639
639
|
|
640
640
|
out = RDoc::Markup::Document.new
|
@@ -657,7 +657,7 @@ or the PAGER environment variable.
|
|
657
657
|
##
|
658
658
|
# Adds the class +comment+ to +out+.
|
659
659
|
|
660
|
-
def class_document_comment
|
660
|
+
def class_document_comment(out, document) # :nodoc:
|
661
661
|
unless document.empty? then
|
662
662
|
out << RDoc::Markup::Rule.new(1)
|
663
663
|
|
@@ -677,7 +677,7 @@ or the PAGER environment variable.
|
|
677
677
|
##
|
678
678
|
# Adds the constants from +klass+ to the Document +out+.
|
679
679
|
|
680
|
-
def class_document_constants
|
680
|
+
def class_document_constants(out, klass) # :nodoc:
|
681
681
|
return if klass.constants.empty?
|
682
682
|
|
683
683
|
out << RDoc::Markup::Heading.new(1, "Constants:")
|
@@ -721,7 +721,7 @@ or the PAGER environment variable.
|
|
721
721
|
# Returns the stores wherein +name+ is found along with the classes,
|
722
722
|
# extends and includes that match it
|
723
723
|
|
724
|
-
def classes_and_includes_and_extends_for
|
724
|
+
def classes_and_includes_and_extends_for(name)
|
725
725
|
klasses = []
|
726
726
|
extends = []
|
727
727
|
includes = []
|
@@ -746,7 +746,7 @@ or the PAGER environment variable.
|
|
746
746
|
##
|
747
747
|
# Completes +name+ based on the caches. For Readline
|
748
748
|
|
749
|
-
def complete
|
749
|
+
def complete(name)
|
750
750
|
completions = []
|
751
751
|
|
752
752
|
klass, selector, method = parse_name name
|
@@ -757,7 +757,7 @@ or the PAGER environment variable.
|
|
757
757
|
completions.uniq.select {|s| s.start_with? name }.sort
|
758
758
|
end
|
759
759
|
|
760
|
-
def complete_klass
|
760
|
+
def complete_klass(name, klass, selector, method, completions) # :nodoc:
|
761
761
|
klasses = classes.keys
|
762
762
|
|
763
763
|
# may need to include Foo when given Foo::
|
@@ -776,7 +776,7 @@ or the PAGER environment variable.
|
|
776
776
|
end
|
777
777
|
end
|
778
778
|
|
779
|
-
def complete_method
|
779
|
+
def complete_method(name, klass, selector, completions) # :nodoc:
|
780
780
|
if completions.include? klass and name =~ /#|\.|::/ then
|
781
781
|
methods = list_methods_matching name
|
782
782
|
|
@@ -804,7 +804,7 @@ or the PAGER environment variable.
|
|
804
804
|
##
|
805
805
|
# Converts +document+ to text and writes it to the pager
|
806
806
|
|
807
|
-
def display
|
807
|
+
def display(document)
|
808
808
|
page do |io|
|
809
809
|
f = formatter(io)
|
810
810
|
f.width = @width if @width and f.respond_to?(:width)
|
@@ -817,7 +817,7 @@ or the PAGER environment variable.
|
|
817
817
|
##
|
818
818
|
# Outputs formatted RI data for class +name+. Groups undocumented classes
|
819
819
|
|
820
|
-
def display_class
|
820
|
+
def display_class(name)
|
821
821
|
return if name =~ /#|\./
|
822
822
|
|
823
823
|
found, klasses, includes, extends =
|
@@ -833,7 +833,7 @@ or the PAGER environment variable.
|
|
833
833
|
##
|
834
834
|
# Outputs formatted RI data for method +name+
|
835
835
|
|
836
|
-
def display_method
|
836
|
+
def display_method(name)
|
837
837
|
out = RDoc::Markup::Document.new
|
838
838
|
|
839
839
|
add_method out, name
|
@@ -849,7 +849,7 @@ or the PAGER environment variable.
|
|
849
849
|
# Returns true if +name+ was found, false if it was not an alternative could
|
850
850
|
# be guessed, raises an error if +name+ couldn't be guessed.
|
851
851
|
|
852
|
-
def display_name
|
852
|
+
def display_name(name)
|
853
853
|
if name =~ /\w:(\w|$)/ then
|
854
854
|
display_page name
|
855
855
|
return true
|
@@ -878,7 +878,7 @@ or the PAGER environment variable.
|
|
878
878
|
##
|
879
879
|
# Displays each name in +name+
|
880
880
|
|
881
|
-
def display_names
|
881
|
+
def display_names(names)
|
882
882
|
names.each do |name|
|
883
883
|
name = expand_name name
|
884
884
|
|
@@ -889,7 +889,7 @@ or the PAGER environment variable.
|
|
889
889
|
##
|
890
890
|
# Outputs formatted RI data for page +name+.
|
891
891
|
|
892
|
-
def display_page
|
892
|
+
def display_page(name)
|
893
893
|
store_name, page_name = name.split ':', 2
|
894
894
|
|
895
895
|
store = @stores.find { |s| s.source == store_name }
|
@@ -920,7 +920,7 @@ or the PAGER environment variable.
|
|
920
920
|
##
|
921
921
|
# Outputs a formatted RI page list for the pages in +store+.
|
922
922
|
|
923
|
-
def display_page_list
|
923
|
+
def display_page_list(store, pages = store.cache[:pages], search = nil)
|
924
924
|
out = RDoc::Markup::Document.new
|
925
925
|
|
926
926
|
title = if search then
|
@@ -964,7 +964,7 @@ or the PAGER environment variable.
|
|
964
964
|
# Expands abbreviated klass +klass+ into a fully-qualified class. "Zl::Da"
|
965
965
|
# will be expanded to Zlib::DataError.
|
966
966
|
|
967
|
-
def expand_class
|
967
|
+
def expand_class(klass)
|
968
968
|
class_names = classes.keys
|
969
969
|
ary = class_names.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
|
970
970
|
if ary.length != 1 && ary.first != klass
|
@@ -982,7 +982,7 @@ or the PAGER environment variable.
|
|
982
982
|
# Expands the class portion of +name+ into a fully-qualified class. See
|
983
983
|
# #expand_class.
|
984
984
|
|
985
|
-
def expand_name
|
985
|
+
def expand_name(name)
|
986
986
|
klass, selector, method = parse_name name
|
987
987
|
|
988
988
|
return [selector, method].join if klass.empty?
|
@@ -998,7 +998,7 @@ or the PAGER environment variable.
|
|
998
998
|
##
|
999
999
|
# Filters the methods in +found+ trying to find a match for +name+.
|
1000
1000
|
|
1001
|
-
def filter_methods
|
1001
|
+
def filter_methods(found, name)
|
1002
1002
|
regexp = name_regexp name
|
1003
1003
|
|
1004
1004
|
filtered = found.find_all do |store, methods|
|
@@ -1016,7 +1016,7 @@ or the PAGER environment variable.
|
|
1016
1016
|
# types of methods to look up (from #method_type), and the method name being
|
1017
1017
|
# searched for
|
1018
1018
|
|
1019
|
-
def find_methods
|
1019
|
+
def find_methods(name)
|
1020
1020
|
klass, selector, method = parse_name name
|
1021
1021
|
|
1022
1022
|
types = method_type selector
|
@@ -1062,7 +1062,7 @@ or the PAGER environment variable.
|
|
1062
1062
|
#
|
1063
1063
|
# See also RDoc::Store#source
|
1064
1064
|
|
1065
|
-
def find_store
|
1065
|
+
def find_store(name)
|
1066
1066
|
@stores.each do |store|
|
1067
1067
|
source = store.source
|
1068
1068
|
|
@@ -1131,7 +1131,7 @@ or the PAGER environment variable.
|
|
1131
1131
|
# Lists classes known to ri starting with +names+. If +names+ is empty all
|
1132
1132
|
# known classes are shown.
|
1133
1133
|
|
1134
|
-
def list_known_classes
|
1134
|
+
def list_known_classes(names = [])
|
1135
1135
|
classes = []
|
1136
1136
|
|
1137
1137
|
stores.each do |store|
|
@@ -1163,7 +1163,7 @@ or the PAGER environment variable.
|
|
1163
1163
|
##
|
1164
1164
|
# Returns an Array of methods matching +name+
|
1165
1165
|
|
1166
|
-
def list_methods_matching
|
1166
|
+
def list_methods_matching(name)
|
1167
1167
|
found = []
|
1168
1168
|
|
1169
1169
|
find_methods name do |store, klass, ancestor, types, method|
|
@@ -1202,7 +1202,7 @@ or the PAGER environment variable.
|
|
1202
1202
|
# Loads RI data for method +name+ on +klass+ from +store+. +type+ and
|
1203
1203
|
# +cache+ indicate if it is a class or instance method.
|
1204
1204
|
|
1205
|
-
def load_method
|
1205
|
+
def load_method(store, cache, klass, type, name)
|
1206
1206
|
methods = store.public_send(cache)[klass]
|
1207
1207
|
|
1208
1208
|
return unless methods
|
@@ -1226,7 +1226,7 @@ or the PAGER environment variable.
|
|
1226
1226
|
##
|
1227
1227
|
# Returns an Array of RI data for methods matching +name+
|
1228
1228
|
|
1229
|
-
def load_methods_matching
|
1229
|
+
def load_methods_matching(name)
|
1230
1230
|
found = []
|
1231
1231
|
|
1232
1232
|
find_methods name do |store, klass, ancestor, types, method|
|
@@ -1247,7 +1247,7 @@ or the PAGER environment variable.
|
|
1247
1247
|
##
|
1248
1248
|
# Returns a filtered list of methods matching +name+
|
1249
1249
|
|
1250
|
-
def lookup_method
|
1250
|
+
def lookup_method(name)
|
1251
1251
|
found = load_methods_matching name
|
1252
1252
|
|
1253
1253
|
if found.empty?
|
@@ -1272,7 +1272,7 @@ or the PAGER environment variable.
|
|
1272
1272
|
##
|
1273
1273
|
# Builds a RDoc::Markup::Document from +found+, +klasses+ and +includes+
|
1274
1274
|
|
1275
|
-
def method_document
|
1275
|
+
def method_document(out, name, filtered)
|
1276
1276
|
out << RDoc::Markup::Heading.new(1, name)
|
1277
1277
|
out << RDoc::Markup::BlankLine.new
|
1278
1278
|
|
@@ -1288,7 +1288,7 @@ or the PAGER environment variable.
|
|
1288
1288
|
##
|
1289
1289
|
# Returns the type of method (:both, :instance, :class) for +selector+
|
1290
1290
|
|
1291
|
-
def method_type
|
1291
|
+
def method_type(selector)
|
1292
1292
|
case selector
|
1293
1293
|
when '.', nil then :both
|
1294
1294
|
when '#' then :instance
|
@@ -1300,7 +1300,7 @@ or the PAGER environment variable.
|
|
1300
1300
|
# Returns a regular expression for +name+ that will match an
|
1301
1301
|
# RDoc::AnyMethod's name.
|
1302
1302
|
|
1303
|
-
def name_regexp
|
1303
|
+
def name_regexp(name)
|
1304
1304
|
klass, type, name = parse_name name
|
1305
1305
|
|
1306
1306
|
case type
|
@@ -1343,7 +1343,7 @@ or the PAGER environment variable.
|
|
1343
1343
|
# NOTE: Given Foo::Bar, Bar is considered a class even though it may be a
|
1344
1344
|
# method
|
1345
1345
|
|
1346
|
-
def parse_name
|
1346
|
+
def parse_name(name)
|
1347
1347
|
parts = name.split(/(::?|#|\.)/)
|
1348
1348
|
|
1349
1349
|
if parts.length == 1 then
|
@@ -1375,7 +1375,7 @@ or the PAGER environment variable.
|
|
1375
1375
|
# Renders the +klass+ from +store+ to +out+. If the klass has no
|
1376
1376
|
# documentable items the class is added to +also_in+ instead.
|
1377
1377
|
|
1378
|
-
def render_class
|
1378
|
+
def render_class(out, store, klass, also_in) # :nodoc:
|
1379
1379
|
document = klass.comment.parse
|
1380
1380
|
# TODO the store's cache should always return an empty Array
|
1381
1381
|
class_methods = store.class_methods[klass.full_name] || []
|
@@ -1405,7 +1405,7 @@ or the PAGER environment variable.
|
|
1405
1405
|
add_method_documentation out, klass if @show_all
|
1406
1406
|
end
|
1407
1407
|
|
1408
|
-
def render_method
|
1408
|
+
def render_method(out, store, method, name) # :nodoc:
|
1409
1409
|
out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
|
1410
1410
|
|
1411
1411
|
unless name =~ /^#{Regexp.escape method.parent_name}/ then
|
@@ -1425,7 +1425,7 @@ or the PAGER environment variable.
|
|
1425
1425
|
end
|
1426
1426
|
end
|
1427
1427
|
|
1428
|
-
def render_method_arguments
|
1428
|
+
def render_method_arguments(out, arglists) # :nodoc:
|
1429
1429
|
return unless arglists
|
1430
1430
|
|
1431
1431
|
arglists = arglists.chomp.split "\n"
|
@@ -1434,7 +1434,7 @@ or the PAGER environment variable.
|
|
1434
1434
|
out << RDoc::Markup::Rule.new(1)
|
1435
1435
|
end
|
1436
1436
|
|
1437
|
-
def render_method_comment
|
1437
|
+
def render_method_comment(out, method, alias_for = nil)# :nodoc:
|
1438
1438
|
if alias_for
|
1439
1439
|
unless method.comment.nil? or method.comment.empty?
|
1440
1440
|
out << RDoc::Markup::BlankLine.new
|
@@ -1452,7 +1452,7 @@ or the PAGER environment variable.
|
|
1452
1452
|
end
|
1453
1453
|
end
|
1454
1454
|
|
1455
|
-
def render_method_superclass
|
1455
|
+
def render_method_superclass(out, method) # :nodoc:
|
1456
1456
|
return unless
|
1457
1457
|
method.respond_to?(:superclass_method) and method.superclass_method
|
1458
1458
|
|
data/lib/rdoc/ri/paths.rb
CHANGED
@@ -52,7 +52,7 @@ module RDoc::RI::Paths
|
|
52
52
|
##
|
53
53
|
# The ri directory for the gem with +gem_name+.
|
54
54
|
|
55
|
-
def self.gem_dir
|
55
|
+
def self.gem_dir(name, version)
|
56
56
|
req = Gem::Requirement.new "= #{version}"
|
57
57
|
|
58
58
|
spec = Gem::Specification.find_by_name name, req
|
@@ -67,7 +67,7 @@ module RDoc::RI::Paths
|
|
67
67
|
# A +filter+ :all includes all versions of gems and includes gems without
|
68
68
|
# ri documentation.
|
69
69
|
|
70
|
-
def self.gemdirs
|
70
|
+
def self.gemdirs(filter = :latest)
|
71
71
|
ri_paths = {}
|
72
72
|
|
73
73
|
all = Gem::Specification.map do |spec|
|
data/lib/rdoc/ri/task.rb
CHANGED
@@ -44,7 +44,7 @@ class RDoc::RI::Task < RDoc::Task
|
|
44
44
|
# Create an ri task with the given name. See RDoc::Task for documentation on
|
45
45
|
# setting names.
|
46
46
|
|
47
|
-
def initialize
|
47
|
+
def initialize(name = DEFAULT_NAMES) # :yield: self
|
48
48
|
super
|
49
49
|
end
|
50
50
|
|
data/lib/rdoc/rubygems_hook.rb
CHANGED
@@ -51,7 +51,7 @@ class RDoc::RubyGemsHook
|
|
51
51
|
# Post installs hook that generates documentation for each specification in
|
52
52
|
# +specs+
|
53
53
|
|
54
|
-
def self.generate
|
54
|
+
def self.generate(installer, specs)
|
55
55
|
start = Time.now
|
56
56
|
types = installer.document
|
57
57
|
|
@@ -70,7 +70,7 @@ class RDoc::RubyGemsHook
|
|
70
70
|
say "Done installing documentation for #{names} after #{duration} seconds"
|
71
71
|
end
|
72
72
|
|
73
|
-
def self.remove
|
73
|
+
def self.remove(uninstaller)
|
74
74
|
new(uninstaller.spec).remove
|
75
75
|
end
|
76
76
|
|
@@ -92,7 +92,7 @@ class RDoc::RubyGemsHook
|
|
92
92
|
#
|
93
93
|
# Only +generate_ri+ is enabled by default.
|
94
94
|
|
95
|
-
def initialize
|
95
|
+
def initialize(spec, generate_rdoc = false, generate_ri = true)
|
96
96
|
@doc_dir = spec.doc_dir
|
97
97
|
@force = false
|
98
98
|
@rdoc = nil
|
@@ -110,7 +110,7 @@ class RDoc::RubyGemsHook
|
|
110
110
|
#--
|
111
111
|
# TODO move to RDoc::Options
|
112
112
|
|
113
|
-
def delete_legacy_args
|
113
|
+
def delete_legacy_args(args)
|
114
114
|
args.delete '--inline-source'
|
115
115
|
args.delete '--promiscuous'
|
116
116
|
args.delete '-p'
|
@@ -123,7 +123,7 @@ class RDoc::RubyGemsHook
|
|
123
123
|
#
|
124
124
|
# Documentation will be generated into +destination+
|
125
125
|
|
126
|
-
def document
|
126
|
+
def document(generator, options, destination)
|
127
127
|
generator_name = generator
|
128
128
|
|
129
129
|
options = options.dup
|
@@ -182,18 +182,21 @@ class RDoc::RubyGemsHook
|
|
182
182
|
options.default_title = "#{@spec.full_name} Documentation"
|
183
183
|
options.parse args
|
184
184
|
options.quiet = !Gem.configuration.really_verbose
|
185
|
-
options.finish
|
186
185
|
end
|
187
186
|
|
188
187
|
@rdoc = new_rdoc
|
189
|
-
@rdoc.options = options
|
190
|
-
|
191
|
-
@rdoc.store = RDoc::Store.new(options)
|
192
188
|
|
193
189
|
say "Parsing documentation for #{@spec.full_name}"
|
194
190
|
|
195
191
|
Dir.chdir @spec.full_gem_path do
|
196
|
-
|
192
|
+
# RDoc::Options#finish must be called before parse_files.
|
193
|
+
# RDoc::Options#finish is also called after ri/darkfish generator setup.
|
194
|
+
# We need to dup the options to avoid modifying it after finish is called.
|
195
|
+
parse_options = options.dup
|
196
|
+
parse_options.finish
|
197
|
+
@rdoc.options = parse_options
|
198
|
+
@rdoc.store = RDoc::Store.new(parse_options)
|
199
|
+
@rdoc.parse_files parse_options.files
|
197
200
|
end
|
198
201
|
|
199
202
|
document 'ri', options, @ri_dir if
|
@@ -297,7 +300,7 @@ module RDoc
|
|
297
300
|
RubyGemsHook.new(@spec).remove
|
298
301
|
end
|
299
302
|
|
300
|
-
def self.generation_hook
|
303
|
+
def self.generation_hook(installer, specs)
|
301
304
|
# Do nothing if this is NOT a default gem.
|
302
305
|
return unless default_gem?
|
303
306
|
|
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
|
@@ -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,7 +243,7 @@ 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 = '..'
|
@@ -265,7 +265,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
265
265
|
# file has not been modified a Not Modified response is returned. If the
|
266
266
|
# file has been modified a Last-Modified header is added to +res+.
|
267
267
|
|
268
|
-
def if_modified_since
|
268
|
+
def if_modified_since(req, res, path = nil)
|
269
269
|
last_modified = File.stat(path).mtime if path
|
270
270
|
|
271
271
|
res['last-modified'] = last_modified.httpdate
|
@@ -316,7 +316,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
316
316
|
##
|
317
317
|
# Returns a 404 page built by +generator+ for +req+ on +res+.
|
318
318
|
|
319
|
-
def not_found
|
319
|
+
def not_found(generator, req, res, message = nil)
|
320
320
|
message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found"
|
321
321
|
res.body = generator.generate_servlet_not_found message
|
322
322
|
res.status = 404
|
@@ -325,14 +325,14 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
325
325
|
##
|
326
326
|
# Enumerates the ri paths. See RDoc::RI::Paths#each
|
327
327
|
|
328
|
-
def ri_paths
|
328
|
+
def ri_paths(&block)
|
329
329
|
RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs
|
330
330
|
end
|
331
331
|
|
332
332
|
##
|
333
333
|
# Generates the root page on +res+. +req+ is ignored.
|
334
334
|
|
335
|
-
def root
|
335
|
+
def root(req, res)
|
336
336
|
generator = RDoc::Generator::Darkfish.new nil, @options
|
337
337
|
|
338
338
|
res.body = generator.generate_servlet_root installed_docs
|
@@ -343,7 +343,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
343
343
|
##
|
344
344
|
# Generates a search index for the root page on +res+. +req+ is ignored.
|
345
345
|
|
346
|
-
def root_search
|
346
|
+
def root_search(req, res)
|
347
347
|
search_index = []
|
348
348
|
info = []
|
349
349
|
|
@@ -393,7 +393,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
393
393
|
# Displays documentation for +req+ on +res+, whether that be HTML or some
|
394
394
|
# asset.
|
395
395
|
|
396
|
-
def show_documentation
|
396
|
+
def show_documentation(req, res)
|
397
397
|
store, path = documentation_source req.path
|
398
398
|
|
399
399
|
if_modified_since req, res, store.cache_path
|
@@ -417,7 +417,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
417
417
|
##
|
418
418
|
# Returns an RDoc::Store for the given +source_name+ ('ruby' or a gem name).
|
419
419
|
|
420
|
-
def store_for
|
420
|
+
def store_for(source_name)
|
421
421
|
case source_name
|
422
422
|
when 'home' then
|
423
423
|
RDoc::Store.new(@options, path: RDoc::RI::Paths.home_dir, type: :home)
|
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,
|