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/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
|
|
@@ -420,7 +420,7 @@ or the PAGER environment variable.
|
|
420
420
|
*options[:extra_doc_dirs]) do |path, type|
|
421
421
|
@doc_dirs << path
|
422
422
|
|
423
|
-
store = RDoc::RI::Store.new path, type
|
423
|
+
store = RDoc::RI::Store.new(RDoc::Options.new, path: path, type: type)
|
424
424
|
store.load_cache
|
425
425
|
@stores << store
|
426
426
|
end
|
@@ -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
|
@@ -754,10 +754,10 @@ or the PAGER environment variable.
|
|
754
754
|
complete_klass name, klass, selector, method, completions
|
755
755
|
complete_method name, klass, selector, completions
|
756
756
|
|
757
|
-
completions.sort
|
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
|
|
@@ -789,14 +789,22 @@ or the PAGER environment variable.
|
|
789
789
|
completions << "#{klass}#{selector}"
|
790
790
|
end
|
791
791
|
|
792
|
-
|
792
|
+
methods.each do |klass_sel_method|
|
793
|
+
match = klass_sel_method.match(/^(.+)(#|\.|::)([^#.:]+)$/)
|
794
|
+
# match[2] is `::` for class method and `#` for instance method.
|
795
|
+
# To be consistent with old completion that completes `['Foo#i', 'Foo::c']` for `Foo.`,
|
796
|
+
# `.` should be a wildcard for both `#` and `::` here.
|
797
|
+
if match && match[2] == selector || selector == '.'
|
798
|
+
completions << match[1] + selector + match[3]
|
799
|
+
end
|
800
|
+
end
|
793
801
|
end
|
794
802
|
end
|
795
803
|
|
796
804
|
##
|
797
805
|
# Converts +document+ to text and writes it to the pager
|
798
806
|
|
799
|
-
def display
|
807
|
+
def display(document)
|
800
808
|
page do |io|
|
801
809
|
f = formatter(io)
|
802
810
|
f.width = @width if @width and f.respond_to?(:width)
|
@@ -809,7 +817,7 @@ or the PAGER environment variable.
|
|
809
817
|
##
|
810
818
|
# Outputs formatted RI data for class +name+. Groups undocumented classes
|
811
819
|
|
812
|
-
def display_class
|
820
|
+
def display_class(name)
|
813
821
|
return if name =~ /#|\./
|
814
822
|
|
815
823
|
found, klasses, includes, extends =
|
@@ -825,7 +833,7 @@ or the PAGER environment variable.
|
|
825
833
|
##
|
826
834
|
# Outputs formatted RI data for method +name+
|
827
835
|
|
828
|
-
def display_method
|
836
|
+
def display_method(name)
|
829
837
|
out = RDoc::Markup::Document.new
|
830
838
|
|
831
839
|
add_method out, name
|
@@ -841,7 +849,7 @@ or the PAGER environment variable.
|
|
841
849
|
# Returns true if +name+ was found, false if it was not an alternative could
|
842
850
|
# be guessed, raises an error if +name+ couldn't be guessed.
|
843
851
|
|
844
|
-
def display_name
|
852
|
+
def display_name(name)
|
845
853
|
if name =~ /\w:(\w|$)/ then
|
846
854
|
display_page name
|
847
855
|
return true
|
@@ -870,7 +878,7 @@ or the PAGER environment variable.
|
|
870
878
|
##
|
871
879
|
# Displays each name in +name+
|
872
880
|
|
873
|
-
def display_names
|
881
|
+
def display_names(names)
|
874
882
|
names.each do |name|
|
875
883
|
name = expand_name name
|
876
884
|
|
@@ -881,7 +889,7 @@ or the PAGER environment variable.
|
|
881
889
|
##
|
882
890
|
# Outputs formatted RI data for page +name+.
|
883
891
|
|
884
|
-
def display_page
|
892
|
+
def display_page(name)
|
885
893
|
store_name, page_name = name.split ':', 2
|
886
894
|
|
887
895
|
store = @stores.find { |s| s.source == store_name }
|
@@ -912,7 +920,7 @@ or the PAGER environment variable.
|
|
912
920
|
##
|
913
921
|
# Outputs a formatted RI page list for the pages in +store+.
|
914
922
|
|
915
|
-
def display_page_list
|
923
|
+
def display_page_list(store, pages = store.cache[:pages], search = nil)
|
916
924
|
out = RDoc::Markup::Document.new
|
917
925
|
|
918
926
|
title = if search then
|
@@ -956,7 +964,7 @@ or the PAGER environment variable.
|
|
956
964
|
# Expands abbreviated klass +klass+ into a fully-qualified class. "Zl::Da"
|
957
965
|
# will be expanded to Zlib::DataError.
|
958
966
|
|
959
|
-
def expand_class
|
967
|
+
def expand_class(klass)
|
960
968
|
class_names = classes.keys
|
961
969
|
ary = class_names.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
|
962
970
|
if ary.length != 1 && ary.first != klass
|
@@ -974,7 +982,7 @@ or the PAGER environment variable.
|
|
974
982
|
# Expands the class portion of +name+ into a fully-qualified class. See
|
975
983
|
# #expand_class.
|
976
984
|
|
977
|
-
def expand_name
|
985
|
+
def expand_name(name)
|
978
986
|
klass, selector, method = parse_name name
|
979
987
|
|
980
988
|
return [selector, method].join if klass.empty?
|
@@ -990,7 +998,7 @@ or the PAGER environment variable.
|
|
990
998
|
##
|
991
999
|
# Filters the methods in +found+ trying to find a match for +name+.
|
992
1000
|
|
993
|
-
def filter_methods
|
1001
|
+
def filter_methods(found, name)
|
994
1002
|
regexp = name_regexp name
|
995
1003
|
|
996
1004
|
filtered = found.find_all do |store, methods|
|
@@ -1008,7 +1016,7 @@ or the PAGER environment variable.
|
|
1008
1016
|
# types of methods to look up (from #method_type), and the method name being
|
1009
1017
|
# searched for
|
1010
1018
|
|
1011
|
-
def find_methods
|
1019
|
+
def find_methods(name)
|
1012
1020
|
klass, selector, method = parse_name name
|
1013
1021
|
|
1014
1022
|
types = method_type selector
|
@@ -1054,7 +1062,7 @@ or the PAGER environment variable.
|
|
1054
1062
|
#
|
1055
1063
|
# See also RDoc::Store#source
|
1056
1064
|
|
1057
|
-
def find_store
|
1065
|
+
def find_store(name)
|
1058
1066
|
@stores.each do |store|
|
1059
1067
|
source = store.source
|
1060
1068
|
|
@@ -1123,7 +1131,7 @@ or the PAGER environment variable.
|
|
1123
1131
|
# Lists classes known to ri starting with +names+. If +names+ is empty all
|
1124
1132
|
# known classes are shown.
|
1125
1133
|
|
1126
|
-
def list_known_classes
|
1134
|
+
def list_known_classes(names = [])
|
1127
1135
|
classes = []
|
1128
1136
|
|
1129
1137
|
stores.each do |store|
|
@@ -1155,7 +1163,7 @@ or the PAGER environment variable.
|
|
1155
1163
|
##
|
1156
1164
|
# Returns an Array of methods matching +name+
|
1157
1165
|
|
1158
|
-
def list_methods_matching
|
1166
|
+
def list_methods_matching(name)
|
1159
1167
|
found = []
|
1160
1168
|
|
1161
1169
|
find_methods name do |store, klass, ancestor, types, method|
|
@@ -1194,7 +1202,7 @@ or the PAGER environment variable.
|
|
1194
1202
|
# Loads RI data for method +name+ on +klass+ from +store+. +type+ and
|
1195
1203
|
# +cache+ indicate if it is a class or instance method.
|
1196
1204
|
|
1197
|
-
def load_method
|
1205
|
+
def load_method(store, cache, klass, type, name)
|
1198
1206
|
methods = store.public_send(cache)[klass]
|
1199
1207
|
|
1200
1208
|
return unless methods
|
@@ -1218,7 +1226,7 @@ or the PAGER environment variable.
|
|
1218
1226
|
##
|
1219
1227
|
# Returns an Array of RI data for methods matching +name+
|
1220
1228
|
|
1221
|
-
def load_methods_matching
|
1229
|
+
def load_methods_matching(name)
|
1222
1230
|
found = []
|
1223
1231
|
|
1224
1232
|
find_methods name do |store, klass, ancestor, types, method|
|
@@ -1239,7 +1247,7 @@ or the PAGER environment variable.
|
|
1239
1247
|
##
|
1240
1248
|
# Returns a filtered list of methods matching +name+
|
1241
1249
|
|
1242
|
-
def lookup_method
|
1250
|
+
def lookup_method(name)
|
1243
1251
|
found = load_methods_matching name
|
1244
1252
|
|
1245
1253
|
if found.empty?
|
@@ -1264,7 +1272,7 @@ or the PAGER environment variable.
|
|
1264
1272
|
##
|
1265
1273
|
# Builds a RDoc::Markup::Document from +found+, +klasses+ and +includes+
|
1266
1274
|
|
1267
|
-
def method_document
|
1275
|
+
def method_document(out, name, filtered)
|
1268
1276
|
out << RDoc::Markup::Heading.new(1, name)
|
1269
1277
|
out << RDoc::Markup::BlankLine.new
|
1270
1278
|
|
@@ -1280,7 +1288,7 @@ or the PAGER environment variable.
|
|
1280
1288
|
##
|
1281
1289
|
# Returns the type of method (:both, :instance, :class) for +selector+
|
1282
1290
|
|
1283
|
-
def method_type
|
1291
|
+
def method_type(selector)
|
1284
1292
|
case selector
|
1285
1293
|
when '.', nil then :both
|
1286
1294
|
when '#' then :instance
|
@@ -1292,7 +1300,7 @@ or the PAGER environment variable.
|
|
1292
1300
|
# Returns a regular expression for +name+ that will match an
|
1293
1301
|
# RDoc::AnyMethod's name.
|
1294
1302
|
|
1295
|
-
def name_regexp
|
1303
|
+
def name_regexp(name)
|
1296
1304
|
klass, type, name = parse_name name
|
1297
1305
|
|
1298
1306
|
case type
|
@@ -1335,7 +1343,7 @@ or the PAGER environment variable.
|
|
1335
1343
|
# NOTE: Given Foo::Bar, Bar is considered a class even though it may be a
|
1336
1344
|
# method
|
1337
1345
|
|
1338
|
-
def parse_name
|
1346
|
+
def parse_name(name)
|
1339
1347
|
parts = name.split(/(::?|#|\.)/)
|
1340
1348
|
|
1341
1349
|
if parts.length == 1 then
|
@@ -1367,7 +1375,7 @@ or the PAGER environment variable.
|
|
1367
1375
|
# Renders the +klass+ from +store+ to +out+. If the klass has no
|
1368
1376
|
# documentable items the class is added to +also_in+ instead.
|
1369
1377
|
|
1370
|
-
def render_class
|
1378
|
+
def render_class(out, store, klass, also_in) # :nodoc:
|
1371
1379
|
document = klass.comment.parse
|
1372
1380
|
# TODO the store's cache should always return an empty Array
|
1373
1381
|
class_methods = store.class_methods[klass.full_name] || []
|
@@ -1397,7 +1405,7 @@ or the PAGER environment variable.
|
|
1397
1405
|
add_method_documentation out, klass if @show_all
|
1398
1406
|
end
|
1399
1407
|
|
1400
|
-
def render_method
|
1408
|
+
def render_method(out, store, method, name) # :nodoc:
|
1401
1409
|
out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
|
1402
1410
|
|
1403
1411
|
unless name =~ /^#{Regexp.escape method.parent_name}/ then
|
@@ -1417,7 +1425,7 @@ or the PAGER environment variable.
|
|
1417
1425
|
end
|
1418
1426
|
end
|
1419
1427
|
|
1420
|
-
def render_method_arguments
|
1428
|
+
def render_method_arguments(out, arglists) # :nodoc:
|
1421
1429
|
return unless arglists
|
1422
1430
|
|
1423
1431
|
arglists = arglists.chomp.split "\n"
|
@@ -1426,7 +1434,7 @@ or the PAGER environment variable.
|
|
1426
1434
|
out << RDoc::Markup::Rule.new(1)
|
1427
1435
|
end
|
1428
1436
|
|
1429
|
-
def render_method_comment
|
1437
|
+
def render_method_comment(out, method, alias_for = nil)# :nodoc:
|
1430
1438
|
if alias_for
|
1431
1439
|
unless method.comment.nil? or method.comment.empty?
|
1432
1440
|
out << RDoc::Markup::BlankLine.new
|
@@ -1444,7 +1452,7 @@ or the PAGER environment variable.
|
|
1444
1452
|
end
|
1445
1453
|
end
|
1446
1454
|
|
1447
|
-
def render_method_superclass
|
1455
|
+
def render_method_superclass(out, method) # :nodoc:
|
1448
1456
|
return unless
|
1449
1457
|
method.respond_to?(:superclass_method) and method.superclass_method
|
1450
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,24 +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
|
-
store = RDoc::Store.new
|
192
|
-
store.encoding = options.encoding
|
193
|
-
store.dry_run = options.dry_run
|
194
|
-
store.main = options.main_page
|
195
|
-
store.title = options.title
|
196
|
-
|
197
|
-
@rdoc.store = store
|
198
188
|
|
199
189
|
say "Parsing documentation for #{@spec.full_name}"
|
200
190
|
|
201
191
|
Dir.chdir @spec.full_gem_path do
|
202
|
-
|
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
|
203
200
|
end
|
204
201
|
|
205
202
|
document 'ri', options, @ri_dir if
|
@@ -303,7 +300,7 @@ module RDoc
|
|
303
300
|
RubyGemsHook.new(@spec).remove
|
304
301
|
end
|
305
302
|
|
306
|
-
def self.generation_hook
|
303
|
+
def self.generation_hook(installer, specs)
|
307
304
|
# Do nothing if this is NOT a default gem.
|
308
305
|
return unless default_gem?
|
309
306
|
|