rdoc 6.4.0 → 6.6.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.rdoc +1 -2
- data/LEGAL.rdoc +1 -1
- data/README.rdoc +2 -2
- data/TODO.rdoc +1 -1
- data/exe/rdoc +0 -1
- data/lib/rdoc/alias.rb +0 -1
- data/lib/rdoc/anon_class.rb +0 -1
- data/lib/rdoc/any_method.rb +17 -2
- data/lib/rdoc/attr.rb +0 -1
- data/lib/rdoc/class_module.rb +0 -1
- data/lib/rdoc/code_objects.rb +1 -2
- data/lib/rdoc/comment.rb +20 -41
- data/lib/rdoc/constant.rb +0 -1
- data/lib/rdoc/context/section.rb +2 -1
- data/lib/rdoc/context.rb +1 -3
- data/lib/rdoc/cross_reference.rb +17 -2
- data/lib/rdoc/encoding.rb +1 -6
- data/lib/rdoc/erb_partial.rb +0 -1
- data/lib/rdoc/erbio.rb +2 -7
- data/lib/rdoc/extend.rb +0 -1
- data/lib/rdoc/generator/darkfish.rb +2 -6
- data/lib/rdoc/generator/json_index.rb +2 -2
- data/lib/rdoc/generator/markup.rb +1 -2
- data/lib/rdoc/generator/ri.rb +0 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +10 -10
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +27 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +22 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +25 -4
- data/lib/rdoc/generator/template/darkfish/class.rhtml +28 -20
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +44 -7
- data/lib/rdoc/generator/template/darkfish/index.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +14 -1
- data/lib/rdoc/generator/template/darkfish/js/search.js +4 -4
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +7 -6
- data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
- data/lib/rdoc/generator.rb +5 -5
- data/lib/rdoc/ghost_method.rb +0 -1
- data/lib/rdoc/i18n.rb +1 -1
- data/lib/rdoc/include.rb +0 -1
- data/lib/rdoc/known_classes.rb +5 -4
- data/lib/rdoc/markdown/entities.rb +0 -1
- data/lib/rdoc/markdown/literals.rb +98 -40
- data/lib/rdoc/markdown.kpeg +26 -19
- data/lib/rdoc/markdown.rb +326 -227
- data/lib/rdoc/markup/attr_changer.rb +0 -1
- data/lib/rdoc/markup/attr_span.rb +0 -1
- data/lib/rdoc/markup/attribute_manager.rb +29 -36
- data/lib/rdoc/markup/attributes.rb +0 -1
- data/lib/rdoc/markup/blank_line.rb +0 -1
- data/lib/rdoc/markup/block_quote.rb +0 -1
- data/lib/rdoc/markup/document.rb +0 -1
- data/lib/rdoc/markup/formatter.rb +0 -1
- data/lib/rdoc/markup/hard_break.rb +0 -1
- data/lib/rdoc/markup/heading.rb +0 -1
- data/lib/rdoc/markup/include.rb +0 -1
- data/lib/rdoc/markup/indented_paragraph.rb +0 -1
- data/lib/rdoc/markup/list.rb +0 -1
- data/lib/rdoc/markup/list_item.rb +0 -1
- data/lib/rdoc/markup/paragraph.rb +0 -1
- data/lib/rdoc/markup/parser.rb +12 -6
- data/lib/rdoc/markup/raw.rb +0 -1
- data/lib/rdoc/markup/regexp_handling.rb +0 -1
- data/lib/rdoc/markup/rule.rb +0 -1
- data/lib/rdoc/markup/to_ansi.rb +0 -1
- data/lib/rdoc/markup/to_html.rb +21 -16
- data/lib/rdoc/markup/to_html_crossref.rb +0 -1
- data/lib/rdoc/markup/to_html_snippet.rb +0 -1
- data/lib/rdoc/markup/to_joined_paragraph.rb +2 -3
- data/lib/rdoc/markup/to_label.rb +1 -2
- data/lib/rdoc/markup/to_markdown.rb +0 -1
- data/lib/rdoc/markup/to_rdoc.rb +3 -21
- data/lib/rdoc/markup/to_table_of_contents.rb +0 -1
- data/lib/rdoc/markup/to_test.rb +0 -1
- data/lib/rdoc/markup/to_tt_only.rb +0 -1
- data/lib/rdoc/markup/verbatim.rb +0 -1
- data/lib/rdoc/markup.rb +35 -667
- data/lib/rdoc/meta_method.rb +0 -1
- data/lib/rdoc/method_attr.rb +1 -2
- data/lib/rdoc/mixin.rb +0 -1
- data/lib/rdoc/normal_class.rb +1 -2
- data/lib/rdoc/normal_module.rb +1 -2
- data/lib/rdoc/options.rb +36 -20
- data/lib/rdoc/parser/c.rb +89 -101
- data/lib/rdoc/parser/changelog.rb +0 -1
- data/lib/rdoc/parser/markdown.rb +0 -2
- data/lib/rdoc/parser/rd.rb +0 -1
- data/lib/rdoc/parser/ripper_state_lex.rb +1 -1
- data/lib/rdoc/parser/ruby.rb +29 -14
- data/lib/rdoc/parser/ruby_tools.rb +0 -2
- data/lib/rdoc/parser/text.rb +0 -1
- data/lib/rdoc/parser.rb +19 -2
- data/lib/rdoc/rd/block_parser.rb +666 -12
- data/lib/rdoc/rd/block_parser.ry +13 -9
- data/lib/rdoc/rd/inline.rb +0 -1
- data/lib/rdoc/rd/inline_parser.rb +3 -1
- data/lib/rdoc/rd.rb +3 -4
- data/lib/rdoc/rdoc.rb +19 -7
- data/lib/rdoc/require.rb +0 -1
- data/lib/rdoc/ri/driver.rb +20 -86
- data/lib/rdoc/ri/store.rb +0 -1
- data/lib/rdoc/ri.rb +4 -5
- data/lib/rdoc/rubygems_hook.rb +1 -1
- data/lib/rdoc/servlet.rb +1 -1
- data/lib/rdoc/single_class.rb +5 -1
- data/lib/rdoc/stats/quiet.rb +0 -1
- data/lib/rdoc/stats/verbose.rb +0 -2
- data/lib/rdoc/stats.rb +3 -4
- data/lib/rdoc/store.rb +4 -4
- data/lib/rdoc/task.rb +31 -5
- data/lib/rdoc/token_stream.rb +0 -1
- data/lib/rdoc/top_level.rb +0 -1
- data/lib/rdoc/version.rb +3 -1
- data/lib/rdoc.rb +46 -46
- metadata +9 -11
- data/Gemfile +0 -12
- data/Rakefile +0 -107
- data/bin/console +0 -7
- data/bin/setup +0 -6
- data/rdoc.gemspec +0 -249
data/lib/rdoc/rd/block_parser.ry
CHANGED
|
@@ -230,8 +230,6 @@ end
|
|
|
230
230
|
|
|
231
231
|
# :stopdoc:
|
|
232
232
|
|
|
233
|
-
TMPFILE = ["rdtmp", $$, 0]
|
|
234
|
-
|
|
235
233
|
MARK_TO_LEVEL = {
|
|
236
234
|
'=' => 1,
|
|
237
235
|
'==' => 2,
|
|
@@ -341,15 +339,19 @@ def next_token # :nodoc:
|
|
|
341
339
|
# non-RD part begin
|
|
342
340
|
when /^=begin\s+(\w+)/
|
|
343
341
|
part = $1
|
|
342
|
+
=begin # not imported to RDoc
|
|
344
343
|
if @in_part # if in non-RD part
|
|
345
344
|
@part_content.push(line)
|
|
346
345
|
else
|
|
347
346
|
@in_part = part if @tree.filter[part] # if filter exists
|
|
348
347
|
# p "BEGIN_PART: #{@in_part}" # DEBUG
|
|
349
348
|
end
|
|
349
|
+
=end
|
|
350
|
+
@in_part = part
|
|
350
351
|
# non-RD part end
|
|
351
|
-
when /^=end/
|
|
352
|
+
when /^=end(?:$|[\s\0\C-d\C-z])/
|
|
352
353
|
if @in_part # if in non-RD part
|
|
354
|
+
=begin # not imported to RDoc
|
|
353
355
|
# p "END_PART: #{@in_part}" # DEBUG
|
|
354
356
|
# make Part-in object
|
|
355
357
|
part = RDoc::RD::Part.new(@part_content.join(""), @tree, "r")
|
|
@@ -360,20 +362,22 @@ def next_token # :nodoc:
|
|
|
360
362
|
if @tree.filter[@in_part].mode == :rd # if output is RD formatted
|
|
361
363
|
subtree = parse_subtree(part_out.to_a)
|
|
362
364
|
else # if output is target formatted
|
|
363
|
-
basename =
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
tmpfile.close
|
|
365
|
+
basename = Tempfile.create(["rdtmp", ".#{@in_part}"], @tree.tmp_dir) do |tmpfile|
|
|
366
|
+
tmpfile.print(part_out)
|
|
367
|
+
File.basename(tmpfile.path)
|
|
368
|
+
end
|
|
368
369
|
subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
|
|
369
370
|
end
|
|
370
371
|
@in_part = nil
|
|
371
372
|
return [:SUBTREE, subtree]
|
|
373
|
+
=end
|
|
372
374
|
end
|
|
373
375
|
else
|
|
376
|
+
=begin # not imported to RDoc
|
|
374
377
|
if @in_part # if in non-RD part
|
|
375
378
|
@part_content.push(line)
|
|
376
379
|
end
|
|
380
|
+
=end
|
|
377
381
|
end
|
|
378
382
|
end
|
|
379
383
|
|
|
@@ -568,7 +572,7 @@ def get_included(file)
|
|
|
568
572
|
file_name = File.join dir, file
|
|
569
573
|
|
|
570
574
|
if File.exist? file_name then
|
|
571
|
-
included =
|
|
575
|
+
included = File.readlines file_name
|
|
572
576
|
break
|
|
573
577
|
end
|
|
574
578
|
end
|
data/lib/rdoc/rd/inline.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
#
|
|
3
3
|
# DO NOT MODIFY!!!!
|
|
4
|
-
# This file is automatically generated by Racc 1.
|
|
4
|
+
# This file is automatically generated by Racc 1.7.1
|
|
5
5
|
# from Racc grammar file "".
|
|
6
6
|
#
|
|
7
7
|
|
|
@@ -652,6 +652,7 @@ Racc_arg = [
|
|
|
652
652
|
racc_shift_n,
|
|
653
653
|
racc_reduce_n,
|
|
654
654
|
racc_use_result_var ]
|
|
655
|
+
Ractor.make_shareable(Racc_arg) if defined?(Ractor)
|
|
655
656
|
|
|
656
657
|
Racc_token_to_s_table = [
|
|
657
658
|
"$end",
|
|
@@ -723,6 +724,7 @@ Racc_token_to_s_table = [
|
|
|
723
724
|
"normal_strings",
|
|
724
725
|
"verb_string",
|
|
725
726
|
"verb_normal_string" ]
|
|
727
|
+
Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
|
|
726
728
|
|
|
727
729
|
Racc_debug_parser = false
|
|
728
730
|
|
data/lib/rdoc/rd.rb
CHANGED
|
@@ -92,9 +92,8 @@ class RDoc::RD
|
|
|
92
92
|
document
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
autoload :BlockParser,
|
|
96
|
-
autoload :InlineParser,
|
|
97
|
-
autoload :Inline,
|
|
95
|
+
autoload :BlockParser, "#{__dir__}/rd/block_parser"
|
|
96
|
+
autoload :InlineParser, "#{__dir__}/rd/inline_parser"
|
|
97
|
+
autoload :Inline, "#{__dir__}/rd/inline"
|
|
98
98
|
|
|
99
99
|
end
|
|
100
|
-
|
data/lib/rdoc/rdoc.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
require_relative '../rdoc'
|
|
3
3
|
|
|
4
4
|
require 'find'
|
|
5
5
|
require 'fileutils'
|
|
@@ -35,6 +35,17 @@ class RDoc::RDoc
|
|
|
35
35
|
|
|
36
36
|
GENERATORS = {}
|
|
37
37
|
|
|
38
|
+
##
|
|
39
|
+
# List of directory names always skipped
|
|
40
|
+
|
|
41
|
+
UNCONDITIONALLY_SKIPPED_DIRECTORIES = %w[CVS .svn .git].freeze
|
|
42
|
+
|
|
43
|
+
##
|
|
44
|
+
# List of directory names skipped if test suites should be skipped
|
|
45
|
+
|
|
46
|
+
TEST_SUITE_DIRECTORY_NAMES = %w[spec test].freeze
|
|
47
|
+
|
|
48
|
+
|
|
38
49
|
##
|
|
39
50
|
# Generator instance used for creating output
|
|
40
51
|
|
|
@@ -108,7 +119,7 @@ class RDoc::RDoc
|
|
|
108
119
|
# +files+.
|
|
109
120
|
|
|
110
121
|
def gather_files files
|
|
111
|
-
files = [
|
|
122
|
+
files = [@options.root.to_s] if files.empty?
|
|
112
123
|
|
|
113
124
|
file_list = normalized_file_list files, true, @options.exclude
|
|
114
125
|
|
|
@@ -280,7 +291,10 @@ option)
|
|
|
280
291
|
file_list[rel_file_name] = mtime
|
|
281
292
|
end
|
|
282
293
|
when "directory" then
|
|
283
|
-
next if rel_file_name
|
|
294
|
+
next if UNCONDITIONALLY_SKIPPED_DIRECTORIES.include?(rel_file_name)
|
|
295
|
+
|
|
296
|
+
basename = File.basename(rel_file_name)
|
|
297
|
+
next if options.skip_tests && TEST_SUITE_DIRECTORY_NAMES.include?(basename)
|
|
284
298
|
|
|
285
299
|
created_rid = File.join rel_file_name, "created.rid"
|
|
286
300
|
next if File.file? created_rid
|
|
@@ -415,9 +429,7 @@ The internal error was:
|
|
|
415
429
|
files.reject do |file, *|
|
|
416
430
|
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
|
|
417
431
|
(file =~ /tags$/i and
|
|
418
|
-
File.
|
|
419
|
-
io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/
|
|
420
|
-
})
|
|
432
|
+
/\A(\f\n[^,]+,\d+$|!_TAG_)/.match?(File.binread(file, 100)))
|
|
421
433
|
end
|
|
422
434
|
end
|
|
423
435
|
|
|
@@ -440,11 +452,11 @@ The internal error was:
|
|
|
440
452
|
|
|
441
453
|
if RDoc::Options === options then
|
|
442
454
|
@options = options
|
|
443
|
-
@options.finish
|
|
444
455
|
else
|
|
445
456
|
@options = RDoc::Options.load_options
|
|
446
457
|
@options.parse options
|
|
447
458
|
end
|
|
459
|
+
@options.finish
|
|
448
460
|
|
|
449
461
|
if @options.pipe then
|
|
450
462
|
handle_pipe
|
data/lib/rdoc/require.rb
CHANGED
data/lib/rdoc/ri/driver.rb
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'abbrev'
|
|
3
2
|
require 'optparse'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
require 'readline'
|
|
7
|
-
rescue LoadError
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
begin
|
|
11
|
-
require 'win32console'
|
|
12
|
-
rescue LoadError
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
require 'rdoc'
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
# For RubyGems backwards compatibility
|
|
4
|
+
require_relative '../../rdoc'
|
|
19
5
|
|
|
20
|
-
require_relative 'formatter'
|
|
6
|
+
require_relative 'formatter' # For RubyGems backwards compatibility
|
|
7
|
+
# TODO: Fix weird documentation with `require_relative`
|
|
21
8
|
|
|
22
9
|
##
|
|
23
10
|
# The RI driver implements the command-line ri tool.
|
|
@@ -47,9 +34,9 @@ class RDoc::RI::Driver
|
|
|
47
34
|
|
|
48
35
|
class NotFoundError < Error
|
|
49
36
|
|
|
50
|
-
def initialize(klass,
|
|
37
|
+
def initialize(klass, suggestion_proc = nil) # :nodoc:
|
|
51
38
|
@klass = klass
|
|
52
|
-
@
|
|
39
|
+
@suggestion_proc = suggestion_proc
|
|
53
40
|
end
|
|
54
41
|
|
|
55
42
|
##
|
|
@@ -61,8 +48,9 @@ class RDoc::RI::Driver
|
|
|
61
48
|
|
|
62
49
|
def message # :nodoc:
|
|
63
50
|
str = "Nothing known about #{@klass}"
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
suggestions = @suggestion_proc&.call
|
|
52
|
+
if suggestions and !suggestions.empty?
|
|
53
|
+
str += "\nDid you mean? #{suggestions.join("\n ")}"
|
|
66
54
|
end
|
|
67
55
|
str
|
|
68
56
|
end
|
|
@@ -433,9 +421,6 @@ or the PAGER environment variable.
|
|
|
433
421
|
@use_stdout = options[:use_stdout]
|
|
434
422
|
@show_all = options[:show_all]
|
|
435
423
|
@width = options[:width]
|
|
436
|
-
|
|
437
|
-
# pager process for jruby
|
|
438
|
-
@jruby_pager_process = nil
|
|
439
424
|
end
|
|
440
425
|
|
|
441
426
|
##
|
|
@@ -964,8 +949,8 @@ or the PAGER environment variable.
|
|
|
964
949
|
ary = class_names.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
|
|
965
950
|
if ary.length != 1 && ary.first != klass
|
|
966
951
|
if check_did_you_mean
|
|
967
|
-
|
|
968
|
-
raise NotFoundError.new(klass,
|
|
952
|
+
suggestion_proc = -> { DidYouMean::SpellChecker.new(dictionary: class_names).correct(klass) }
|
|
953
|
+
raise NotFoundError.new(klass, suggestion_proc)
|
|
969
954
|
else
|
|
970
955
|
raise NotFoundError, klass
|
|
971
956
|
end
|
|
@@ -1051,36 +1036,6 @@ or the PAGER environment variable.
|
|
|
1051
1036
|
self
|
|
1052
1037
|
end
|
|
1053
1038
|
|
|
1054
|
-
##
|
|
1055
|
-
# Finds the given +pager+ for jruby. Returns an IO if +pager+ was found.
|
|
1056
|
-
#
|
|
1057
|
-
# Returns false if +pager+ does not exist.
|
|
1058
|
-
#
|
|
1059
|
-
# Returns nil if the jruby JVM doesn't support ProcessBuilder redirection
|
|
1060
|
-
# (1.6 and older).
|
|
1061
|
-
|
|
1062
|
-
def find_pager_jruby pager
|
|
1063
|
-
require 'java'
|
|
1064
|
-
require 'shellwords'
|
|
1065
|
-
|
|
1066
|
-
return nil unless java.lang.ProcessBuilder.constants.include? :Redirect
|
|
1067
|
-
|
|
1068
|
-
pager = Shellwords.split pager
|
|
1069
|
-
|
|
1070
|
-
pb = java.lang.ProcessBuilder.new(*pager)
|
|
1071
|
-
pb = pb.redirect_output java.lang.ProcessBuilder::Redirect::INHERIT
|
|
1072
|
-
|
|
1073
|
-
@jruby_pager_process = pb.start
|
|
1074
|
-
|
|
1075
|
-
input = @jruby_pager_process.output_stream
|
|
1076
|
-
|
|
1077
|
-
io = input.to_io
|
|
1078
|
-
io.sync = true
|
|
1079
|
-
io
|
|
1080
|
-
rescue java.io.IOException
|
|
1081
|
-
false
|
|
1082
|
-
end
|
|
1083
|
-
|
|
1084
1039
|
##
|
|
1085
1040
|
# Finds a store that matches +name+ which can be the name of a gem, "ruby",
|
|
1086
1041
|
# "home" or "site".
|
|
@@ -1120,6 +1075,10 @@ or the PAGER environment variable.
|
|
|
1120
1075
|
def interactive
|
|
1121
1076
|
puts "\nEnter the method name you want to look up."
|
|
1122
1077
|
|
|
1078
|
+
begin
|
|
1079
|
+
require 'readline'
|
|
1080
|
+
rescue LoadError
|
|
1081
|
+
end
|
|
1123
1082
|
if defined? Readline then
|
|
1124
1083
|
Readline.completion_proc = method :complete
|
|
1125
1084
|
puts "You can use tab to autocomplete."
|
|
@@ -1148,17 +1107,6 @@ or the PAGER environment variable.
|
|
|
1148
1107
|
exit
|
|
1149
1108
|
end
|
|
1150
1109
|
|
|
1151
|
-
##
|
|
1152
|
-
# Is +file+ in ENV['PATH']?
|
|
1153
|
-
|
|
1154
|
-
def in_path? file
|
|
1155
|
-
return true if file =~ %r%\A/% and File.exist? file
|
|
1156
|
-
|
|
1157
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path|
|
|
1158
|
-
File.exist? File.join(path, file)
|
|
1159
|
-
end
|
|
1160
|
-
end
|
|
1161
|
-
|
|
1162
1110
|
##
|
|
1163
1111
|
# Lists classes known to ri starting with +names+. If +names+ is empty all
|
|
1164
1112
|
# known classes are shown.
|
|
@@ -1290,8 +1238,8 @@ or the PAGER environment variable.
|
|
|
1290
1238
|
methods.push(*store.instance_methods[klass]) if [:instance, :both].include? types
|
|
1291
1239
|
end
|
|
1292
1240
|
methods = methods.uniq
|
|
1293
|
-
|
|
1294
|
-
raise NotFoundError.new(name,
|
|
1241
|
+
suggestion_proc = -> { DidYouMean::SpellChecker.new(dictionary: methods).correct(method_name) }
|
|
1242
|
+
raise NotFoundError.new(name, suggestion_proc)
|
|
1295
1243
|
else
|
|
1296
1244
|
raise NotFoundError, name
|
|
1297
1245
|
end
|
|
@@ -1353,7 +1301,6 @@ or the PAGER environment variable.
|
|
|
1353
1301
|
yield pager
|
|
1354
1302
|
ensure
|
|
1355
1303
|
pager.close
|
|
1356
|
-
@jruby_pager_process.wait_for if @jruby_pager_process
|
|
1357
1304
|
end
|
|
1358
1305
|
else
|
|
1359
1306
|
yield $stdout
|
|
@@ -1521,27 +1468,14 @@ or the PAGER environment variable.
|
|
|
1521
1468
|
def setup_pager
|
|
1522
1469
|
return if @use_stdout
|
|
1523
1470
|
|
|
1524
|
-
jruby = RUBY_ENGINE == 'jruby'
|
|
1525
|
-
|
|
1526
1471
|
pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
|
|
1527
1472
|
|
|
1473
|
+
require 'shellwords'
|
|
1528
1474
|
pagers.compact.uniq.each do |pager|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
pager_cmd = pager.split(' ').first
|
|
1532
|
-
|
|
1533
|
-
next unless in_path? pager_cmd
|
|
1534
|
-
|
|
1535
|
-
if jruby then
|
|
1536
|
-
case io = find_pager_jruby(pager)
|
|
1537
|
-
when nil then break
|
|
1538
|
-
when false then next
|
|
1539
|
-
else io
|
|
1540
|
-
end
|
|
1541
|
-
else
|
|
1542
|
-
io = IO.popen(pager, 'w') rescue next
|
|
1543
|
-
end
|
|
1475
|
+
pager = Shellwords.split(pager)
|
|
1476
|
+
next if pager.empty?
|
|
1544
1477
|
|
|
1478
|
+
io = IO.popen(pager, 'w') rescue next
|
|
1545
1479
|
next if $? and $?.pid == io.pid and $?.exited? # pager didn't work
|
|
1546
1480
|
|
|
1547
1481
|
@paging = true
|
data/lib/rdoc/ri/store.rb
CHANGED
data/lib/rdoc/ri.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
require_relative '../rdoc'
|
|
3
3
|
|
|
4
4
|
##
|
|
5
5
|
# Namespace for the ri command line tool's implementation.
|
|
@@ -13,9 +13,8 @@ module RDoc::RI
|
|
|
13
13
|
|
|
14
14
|
class Error < RDoc::Error; end
|
|
15
15
|
|
|
16
|
-
autoload :Driver,
|
|
17
|
-
autoload :Paths,
|
|
18
|
-
autoload :Store,
|
|
16
|
+
autoload :Driver, "#{__dir__}/ri/driver"
|
|
17
|
+
autoload :Paths, "#{__dir__}/ri/paths"
|
|
18
|
+
autoload :Store, "#{__dir__}/ri/store"
|
|
19
19
|
|
|
20
20
|
end
|
|
21
|
-
|
data/lib/rdoc/rubygems_hook.rb
CHANGED
data/lib/rdoc/servlet.rb
CHANGED
data/lib/rdoc/single_class.rb
CHANGED
data/lib/rdoc/stats/quiet.rb
CHANGED
data/lib/rdoc/stats/verbose.rb
CHANGED
data/lib/rdoc/stats.rb
CHANGED
|
@@ -454,9 +454,8 @@ class RDoc::Stats
|
|
|
454
454
|
[params.length, undoc]
|
|
455
455
|
end
|
|
456
456
|
|
|
457
|
-
autoload :Quiet,
|
|
458
|
-
autoload :Normal,
|
|
459
|
-
autoload :Verbose,
|
|
457
|
+
autoload :Quiet, "#{__dir__}/stats/quiet"
|
|
458
|
+
autoload :Normal, "#{__dir__}/stats/normal"
|
|
459
|
+
autoload :Verbose, "#{__dir__}/stats/verbose"
|
|
460
460
|
|
|
461
461
|
end
|
|
462
|
-
|
data/lib/rdoc/store.rb
CHANGED
|
@@ -557,7 +557,7 @@ class RDoc::Store
|
|
|
557
557
|
#orig_enc = @encoding
|
|
558
558
|
|
|
559
559
|
File.open cache_path, 'rb' do |io|
|
|
560
|
-
@cache = Marshal.load io
|
|
560
|
+
@cache = Marshal.load io
|
|
561
561
|
end
|
|
562
562
|
|
|
563
563
|
load_enc = @cache[:encoding]
|
|
@@ -616,7 +616,7 @@ class RDoc::Store
|
|
|
616
616
|
file = class_file klass_name
|
|
617
617
|
|
|
618
618
|
File.open file, 'rb' do |io|
|
|
619
|
-
Marshal.load io
|
|
619
|
+
Marshal.load io
|
|
620
620
|
end
|
|
621
621
|
rescue Errno::ENOENT => e
|
|
622
622
|
error = MissingFileError.new(self, file, klass_name)
|
|
@@ -631,7 +631,7 @@ class RDoc::Store
|
|
|
631
631
|
file = method_file klass_name, method_name
|
|
632
632
|
|
|
633
633
|
File.open file, 'rb' do |io|
|
|
634
|
-
obj = Marshal.load io
|
|
634
|
+
obj = Marshal.load io
|
|
635
635
|
obj.store = self
|
|
636
636
|
obj.parent =
|
|
637
637
|
find_class_or_module(klass_name) || load_class(klass_name) unless
|
|
@@ -651,7 +651,7 @@ class RDoc::Store
|
|
|
651
651
|
file = page_file page_name
|
|
652
652
|
|
|
653
653
|
File.open file, 'rb' do |io|
|
|
654
|
-
obj = Marshal.load io
|
|
654
|
+
obj = Marshal.load io
|
|
655
655
|
obj.store = self
|
|
656
656
|
obj
|
|
657
657
|
end
|
data/lib/rdoc/task.rb
CHANGED
|
@@ -32,7 +32,7 @@ begin
|
|
|
32
32
|
rescue Gem::LoadError
|
|
33
33
|
end unless defined?(Rake)
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
require_relative '../rdoc'
|
|
36
36
|
require 'rake'
|
|
37
37
|
require 'rake/tasklib'
|
|
38
38
|
|
|
@@ -50,6 +50,9 @@ require 'rake/tasklib'
|
|
|
50
50
|
# [rerdoc]
|
|
51
51
|
# Rebuild the rdoc files from scratch, even if they are not out of date.
|
|
52
52
|
#
|
|
53
|
+
# [rdoc:coverage]
|
|
54
|
+
# Print RDoc coverage report for all rdoc files.
|
|
55
|
+
#
|
|
53
56
|
# Simple Example:
|
|
54
57
|
#
|
|
55
58
|
# require 'rdoc/task'
|
|
@@ -71,7 +74,7 @@ require 'rake/tasklib'
|
|
|
71
74
|
# require 'rdoc/task'
|
|
72
75
|
#
|
|
73
76
|
# RDoc::Task.new :rdoc_dev do |rdoc|
|
|
74
|
-
# rdoc.main = "README.
|
|
77
|
+
# rdoc.main = "README.rdoc"
|
|
75
78
|
# rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
|
76
79
|
# rdoc.options << "--all"
|
|
77
80
|
# end
|
|
@@ -90,8 +93,8 @@ require 'rake/tasklib'
|
|
|
90
93
|
# RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
|
|
91
94
|
# :rerdoc => "rdoc:force")
|
|
92
95
|
#
|
|
93
|
-
# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt
|
|
94
|
-
# <tt>:rdoc:force</tt>.
|
|
96
|
+
# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt>,
|
|
97
|
+
# <tt>:rdoc:force</tt>, and <tt>:rdoc:coverage</tt>.
|
|
95
98
|
|
|
96
99
|
class RDoc::Task < Rake::TaskLib
|
|
97
100
|
|
|
@@ -248,6 +251,18 @@ class RDoc::Task < Rake::TaskLib
|
|
|
248
251
|
RDoc::RDoc.new.document args
|
|
249
252
|
end
|
|
250
253
|
|
|
254
|
+
namespace rdoc_task_name do
|
|
255
|
+
desc coverage_task_description
|
|
256
|
+
task coverage_task_name do
|
|
257
|
+
@before_running_rdoc.call if @before_running_rdoc
|
|
258
|
+
opts = option_list << "-C"
|
|
259
|
+
args = opts + @rdoc_files
|
|
260
|
+
|
|
261
|
+
$stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
|
|
262
|
+
RDoc::RDoc.new.document args
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
251
266
|
self
|
|
252
267
|
end
|
|
253
268
|
|
|
@@ -288,6 +303,13 @@ class RDoc::Task < Rake::TaskLib
|
|
|
288
303
|
"Rebuild RDoc HTML files"
|
|
289
304
|
end
|
|
290
305
|
|
|
306
|
+
##
|
|
307
|
+
# Task description for the coverage task or its renamed description
|
|
308
|
+
|
|
309
|
+
def coverage_task_description
|
|
310
|
+
"Print RDoc coverage report"
|
|
311
|
+
end
|
|
312
|
+
|
|
291
313
|
private
|
|
292
314
|
|
|
293
315
|
def rdoc_target
|
|
@@ -315,6 +337,10 @@ class RDoc::Task < Rake::TaskLib
|
|
|
315
337
|
end
|
|
316
338
|
end
|
|
317
339
|
|
|
340
|
+
def coverage_task_name
|
|
341
|
+
"coverage"
|
|
342
|
+
end
|
|
343
|
+
|
|
318
344
|
end
|
|
319
345
|
|
|
320
346
|
# :stopdoc:
|
|
@@ -323,7 +349,7 @@ module Rake
|
|
|
323
349
|
##
|
|
324
350
|
# For backwards compatibility
|
|
325
351
|
|
|
326
|
-
RDocTask = RDoc::Task
|
|
352
|
+
RDocTask = RDoc::Task # :nodoc:
|
|
327
353
|
|
|
328
354
|
end
|
|
329
355
|
# :startdoc:
|
data/lib/rdoc/token_stream.rb
CHANGED
data/lib/rdoc/top_level.rb
CHANGED