rdoc 6.2.1 → 6.3.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Rakefile +16 -14
- data/lib/rdoc/any_method.rb +52 -7
- data/lib/rdoc/context/section.rb +0 -13
- data/lib/rdoc/context.rb +10 -2
- data/lib/rdoc/cross_reference.rb +2 -2
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +2 -2
- data/lib/rdoc/generator/darkfish.rb +3 -3
- data/lib/rdoc/generator/pot.rb +3 -3
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +4 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/class.rhtml +44 -44
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +21 -1
- data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
- data/lib/rdoc/i18n.rb +1 -1
- data/lib/rdoc/markdown/literals.rb +7 -8
- data/lib/rdoc/markdown.kpeg +20 -2
- data/lib/rdoc/markdown.rb +458 -61
- data/lib/rdoc/markup/attr_span.rb +8 -2
- data/lib/rdoc/markup/attribute_manager.rb +93 -28
- data/lib/rdoc/markup/formatter.rb +1 -1
- data/lib/rdoc/markup/pre_process.rb +1 -1
- data/lib/rdoc/markup/table.rb +47 -0
- data/lib/rdoc/markup/to_html.rb +46 -6
- data/lib/rdoc/markup/to_html_crossref.rb +13 -5
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -0
- data/lib/rdoc/markup/to_rdoc.rb +28 -0
- data/lib/rdoc/markup/to_table_of_contents.rb +1 -0
- data/lib/rdoc/markup.rb +1 -0
- data/lib/rdoc/options.rb +34 -2
- data/lib/rdoc/parser/c.rb +24 -58
- data/lib/rdoc/parser/changelog.rb +145 -14
- data/lib/rdoc/parser.rb +7 -7
- data/lib/rdoc/rd/block_parser.rb +1 -1
- data/lib/rdoc/rd/inline_parser.rb +1 -1
- data/lib/rdoc/rdoc.rb +35 -22
- data/lib/rdoc/ri/driver.rb +9 -5
- data/lib/rdoc/ri/paths.rb +3 -17
- data/lib/rdoc/ri/task.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +2 -2
- data/lib/rdoc/servlet.rb +6 -1
- data/lib/rdoc/store.rb +2 -2
- data/lib/rdoc/version.rb +1 -1
- data/lib/rdoc.rb +21 -0
- data/man/ri.1 +247 -0
- data/rdoc.gemspec +4 -1
- metadata +23 -7
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'time'
|
3
2
|
|
4
3
|
##
|
5
4
|
# A ChangeLog file parser.
|
@@ -106,14 +105,32 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
106
105
|
entries.group_by do |title, _|
|
107
106
|
begin
|
108
107
|
time = @time_cache[title]
|
109
|
-
(time ||
|
108
|
+
(time || parse_date(title)).strftime '%Y-%m-%d'
|
110
109
|
rescue NoMethodError, ArgumentError
|
111
110
|
time, = title.split ' ', 2
|
112
|
-
|
111
|
+
parse_date(time).strftime '%Y-%m-%d'
|
113
112
|
end
|
114
113
|
end
|
115
114
|
end
|
116
115
|
|
116
|
+
##
|
117
|
+
# Parse date in ISO-8601, RFC-2822, or default of Git
|
118
|
+
|
119
|
+
def parse_date(date)
|
120
|
+
case date
|
121
|
+
when /\A\s*(\d+)-(\d+)-(\d+)(?:[ T](\d+):(\d+):(\d+) *([-+]\d\d):?(\d\d))?\b/
|
122
|
+
Time.new($1, $2, $3, $4, $5, $6, ("#{$7}:#{$8}" if $7))
|
123
|
+
when /\A\s*\w{3}, +(\d+) (\w{3}) (\d+) (\d+):(\d+):(\d+) *(?:([-+]\d\d):?(\d\d))\b/
|
124
|
+
Time.new($3, $2, $1, $4, $5, $6, ("#{$7}:#{$8}" if $7))
|
125
|
+
when /\A\s*\w{3} (\w{3}) +(\d+) (\d+) (\d+):(\d+):(\d+) *(?:([-+]\d\d):?(\d\d))\b/
|
126
|
+
Time.new($3, $1, $2, $4, $5, $6, ("#{$7}:#{$8}" if $7))
|
127
|
+
when /\A\s*\w{3} (\w{3}) +(\d+) (\d+):(\d+):(\d+) (\d+)\b/
|
128
|
+
Time.new($6, $1, $2, $3, $4, $5)
|
129
|
+
else
|
130
|
+
raise ArgumentError, "bad date: #{date}"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
117
134
|
##
|
118
135
|
# Parses the entries in the ChangeLog.
|
119
136
|
#
|
@@ -131,6 +148,13 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
131
148
|
|
132
149
|
def parse_entries
|
133
150
|
@time_cache ||= {}
|
151
|
+
|
152
|
+
if /\A((?:.*\n){,3})commit\s/ =~ @content
|
153
|
+
class << self; prepend Git; end
|
154
|
+
parse_info($1)
|
155
|
+
return parse_entries
|
156
|
+
end
|
157
|
+
|
134
158
|
entries = []
|
135
159
|
entry_name = nil
|
136
160
|
entry_body = []
|
@@ -145,19 +169,10 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
145
169
|
entry_name = $&
|
146
170
|
|
147
171
|
begin
|
148
|
-
time =
|
172
|
+
time = parse_date entry_name
|
149
173
|
@time_cache[entry_name] = time
|
150
|
-
# HACK Ruby 1.8 does not raise ArgumentError for Time.parse "Other"
|
151
|
-
entry_name = nil unless entry_name =~ /#{time.year}/
|
152
|
-
rescue NoMethodError
|
153
|
-
# HACK Ruby 2.1.2 and earlier raises NoMethodError if time part is absent
|
154
|
-
entry_name.split ' ', 2
|
155
174
|
rescue ArgumentError
|
156
|
-
|
157
|
-
Time.parse(entry_name.split(' ', 2)[0]) rescue entry_name = nil
|
158
|
-
else
|
159
|
-
entry_name = nil
|
160
|
-
end
|
175
|
+
entry_name = nil
|
161
176
|
end
|
162
177
|
|
163
178
|
entry_body = []
|
@@ -190,6 +205,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
190
205
|
|
191
206
|
def scan
|
192
207
|
@time_cache = {}
|
208
|
+
|
193
209
|
entries = parse_entries
|
194
210
|
grouped_entries = group_entries entries
|
195
211
|
|
@@ -200,5 +216,120 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
200
216
|
@top_level
|
201
217
|
end
|
202
218
|
|
219
|
+
module Git
|
220
|
+
def parse_info(info)
|
221
|
+
/^\s*base-url\s*=\s*(.*\S)/ =~ info
|
222
|
+
@base_url = $1
|
223
|
+
end
|
224
|
+
|
225
|
+
def parse_entries
|
226
|
+
entries = []
|
227
|
+
|
228
|
+
@content.scan(/^commit\s+(\h{20})\h*\n((?:.+\n)*)\n((?: {4}.*\n+)*)/) do
|
229
|
+
entry_name, header, entry_body = $1, $2, $3.gsub(/^ {4}/, '')
|
230
|
+
# header = header.scan(/^ *(\S+?): +(.*)/).to_h
|
231
|
+
# date = header["CommitDate"] || header["Date"]
|
232
|
+
date = header[/^ *(?:Author)?Date: +(.*)/, 1]
|
233
|
+
author = header[/^ *Author: +(.*)/, 1]
|
234
|
+
begin
|
235
|
+
time = parse_date(header[/^ *CommitDate: +(.*)/, 1] || date)
|
236
|
+
@time_cache[entry_name] = time
|
237
|
+
author.sub!(/\s*<(.*)>/, '')
|
238
|
+
email = $1
|
239
|
+
entries << [entry_name, [author, email, date, entry_body]]
|
240
|
+
rescue ArgumentError
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
entries
|
245
|
+
end
|
246
|
+
|
247
|
+
def create_entries entries
|
248
|
+
# git log entries have no strictly itemized style like the old
|
249
|
+
# style, just assume Markdown.
|
250
|
+
entries.map do |commit, entry|
|
251
|
+
LogEntry.new(@base_url, commit, *entry)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
LogEntry = Struct.new(:base, :commit, :author, :email, :date, :contents) do
|
256
|
+
HEADING_LEVEL = 3
|
257
|
+
|
258
|
+
def initialize(base, commit, author, email, date, contents)
|
259
|
+
case contents
|
260
|
+
when String
|
261
|
+
contents = RDoc::Markdown.parse(contents).parts.each do |body|
|
262
|
+
case body
|
263
|
+
when RDoc::Markup::Heading
|
264
|
+
body.level += HEADING_LEVEL + 1
|
265
|
+
end
|
266
|
+
end
|
267
|
+
case first = contents[0]
|
268
|
+
when RDoc::Markup::Paragraph
|
269
|
+
contents[0] = RDoc::Markup::Heading.new(HEADING_LEVEL + 1, first.text)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
super
|
273
|
+
end
|
274
|
+
|
275
|
+
def level
|
276
|
+
HEADING_LEVEL
|
277
|
+
end
|
278
|
+
|
279
|
+
def aref
|
280
|
+
"label-#{commit}"
|
281
|
+
end
|
282
|
+
|
283
|
+
def label context = nil
|
284
|
+
aref
|
285
|
+
end
|
286
|
+
|
287
|
+
def text
|
288
|
+
case base
|
289
|
+
when nil
|
290
|
+
"#{date}"
|
291
|
+
when /%s/
|
292
|
+
"{#{date}}[#{base % commit}]"
|
293
|
+
else
|
294
|
+
"{#{date}}[#{base}#{commit}]"
|
295
|
+
end + " {#{author}}[mailto:#{email}]"
|
296
|
+
end
|
297
|
+
|
298
|
+
def accept visitor
|
299
|
+
visitor.accept_heading self
|
300
|
+
begin
|
301
|
+
if visitor.respond_to?(:code_object=)
|
302
|
+
code_object = visitor.code_object
|
303
|
+
visitor.code_object = self
|
304
|
+
end
|
305
|
+
contents.each do |body|
|
306
|
+
body.accept visitor
|
307
|
+
end
|
308
|
+
ensure
|
309
|
+
if visitor.respond_to?(:code_object)
|
310
|
+
visitor.code_object = code_object
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
def pretty_print q # :nodoc:
|
316
|
+
q.group(2, '[log_entry: ', ']') do
|
317
|
+
q.text commit
|
318
|
+
q.text ','
|
319
|
+
q.breakable
|
320
|
+
q.group(2, '[date: ', ']') { q.text date }
|
321
|
+
q.text ','
|
322
|
+
q.breakable
|
323
|
+
q.group(2, '[author: ', ']') { q.text author }
|
324
|
+
q.text ','
|
325
|
+
q.breakable
|
326
|
+
q.group(2, '[email: ', ']') { q.text email }
|
327
|
+
q.text ','
|
328
|
+
q.breakable
|
329
|
+
q.pp contents
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
203
334
|
end
|
204
335
|
|
data/lib/rdoc/parser.rb
CHANGED
@@ -78,7 +78,7 @@ class RDoc::Parser
|
|
78
78
|
|
79
79
|
return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00")
|
80
80
|
|
81
|
-
mode = 'r:utf-8' # default source encoding has been
|
81
|
+
mode = 'r:utf-8' # default source encoding has been changed to utf-8
|
82
82
|
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
|
83
83
|
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
|
84
84
|
mode = "rb:#{encoding}" if encoding
|
@@ -269,9 +269,9 @@ class RDoc::Parser
|
|
269
269
|
end
|
270
270
|
|
271
271
|
# simple must come first in order to show up last in the parsers list
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
272
|
+
require_relative 'parser/simple'
|
273
|
+
require_relative 'parser/c'
|
274
|
+
require_relative 'parser/changelog'
|
275
|
+
require_relative 'parser/markdown'
|
276
|
+
require_relative 'parser/rd'
|
277
|
+
require_relative 'parser/ruby'
|
data/lib/rdoc/rd/block_parser.rb
CHANGED
data/lib/rdoc/rdoc.rb
CHANGED
@@ -112,11 +112,17 @@ class RDoc::RDoc
|
|
112
112
|
|
113
113
|
file_list = normalized_file_list files, true, @options.exclude
|
114
114
|
|
115
|
-
file_list = file_list
|
116
|
-
|
117
|
-
file_list
|
118
|
-
|
119
|
-
|
115
|
+
file_list = remove_unparseable(file_list)
|
116
|
+
|
117
|
+
if file_list.count {|name, mtime|
|
118
|
+
file_list[name] = @last_modified[name] unless mtime
|
119
|
+
mtime
|
120
|
+
} > 0
|
121
|
+
@last_modified.replace file_list
|
122
|
+
file_list.keys.sort
|
123
|
+
else
|
124
|
+
[]
|
125
|
+
end
|
120
126
|
end
|
121
127
|
|
122
128
|
##
|
@@ -160,8 +166,15 @@ class RDoc::RDoc
|
|
160
166
|
rescue Psych::SyntaxError
|
161
167
|
end
|
162
168
|
|
169
|
+
return RDoc::Options.new if options == false # Allow empty file.
|
170
|
+
|
163
171
|
raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless
|
164
|
-
RDoc::Options === options
|
172
|
+
RDoc::Options === options or Hash === options
|
173
|
+
|
174
|
+
if Hash === options
|
175
|
+
# Override the default values with the contents of YAML file.
|
176
|
+
options = RDoc::Options.new options
|
177
|
+
end
|
165
178
|
|
166
179
|
options
|
167
180
|
end
|
@@ -254,11 +267,11 @@ option)
|
|
254
267
|
# read and strip comments
|
255
268
|
patterns = File.read(filename).gsub(/#.*/, '')
|
256
269
|
|
257
|
-
result =
|
270
|
+
result = {}
|
258
271
|
|
259
|
-
patterns.split.each do |patt|
|
272
|
+
patterns.split(' ').each do |patt|
|
260
273
|
candidates = Dir.glob(File.join(in_dir, patt))
|
261
|
-
result.
|
274
|
+
result.update normalized_file_list(candidates, false, @options.exclude)
|
262
275
|
end
|
263
276
|
|
264
277
|
result
|
@@ -278,21 +291,21 @@ option)
|
|
278
291
|
|
279
292
|
def normalized_file_list(relative_files, force_doc = false,
|
280
293
|
exclude_pattern = nil)
|
281
|
-
file_list =
|
294
|
+
file_list = {}
|
282
295
|
|
283
296
|
relative_files.each do |rel_file_name|
|
297
|
+
rel_file_name = rel_file_name.sub(/^\.\//, '')
|
284
298
|
next if rel_file_name.end_with? 'created.rid'
|
285
299
|
next if exclude_pattern && exclude_pattern =~ rel_file_name
|
286
300
|
stat = File.stat rel_file_name rescue next
|
287
301
|
|
288
302
|
case type = stat.ftype
|
289
303
|
when "file" then
|
290
|
-
|
291
|
-
|
304
|
+
mtime = (stat.mtime unless (last_modified = @last_modified[rel_file_name] and
|
305
|
+
stat.mtime.to_i <= last_modified.to_i))
|
292
306
|
|
293
307
|
if force_doc or RDoc::Parser.can_parse(rel_file_name) then
|
294
|
-
file_list
|
295
|
-
@last_modified[rel_file_name] = stat.mtime
|
308
|
+
file_list[rel_file_name] = mtime
|
296
309
|
end
|
297
310
|
when "directory" then
|
298
311
|
next if rel_file_name == "CVS" || rel_file_name == ".svn"
|
@@ -303,16 +316,16 @@ option)
|
|
303
316
|
dot_doc = File.join rel_file_name, RDoc::DOT_DOC_FILENAME
|
304
317
|
|
305
318
|
if File.file? dot_doc then
|
306
|
-
file_list
|
319
|
+
file_list.update(parse_dot_doc_file(rel_file_name, dot_doc))
|
307
320
|
else
|
308
|
-
file_list
|
321
|
+
file_list.update(list_files_in_directory(rel_file_name))
|
309
322
|
end
|
310
323
|
else
|
311
324
|
warn "rdoc can't parse the #{type} #{rel_file_name}"
|
312
325
|
end
|
313
326
|
end
|
314
327
|
|
315
|
-
file_list
|
328
|
+
file_list
|
316
329
|
end
|
317
330
|
|
318
331
|
##
|
@@ -427,10 +440,10 @@ The internal error was:
|
|
427
440
|
# files for emacs and vim.
|
428
441
|
|
429
442
|
def remove_unparseable files
|
430
|
-
files.reject do |file
|
443
|
+
files.reject do |file, *|
|
431
444
|
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
|
432
445
|
(file =~ /tags$/i and
|
433
|
-
open(file, 'rb') { |io|
|
446
|
+
File.open(file, 'rb') { |io|
|
434
447
|
io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/
|
435
448
|
})
|
436
449
|
end
|
@@ -561,6 +574,6 @@ rescue LoadError
|
|
561
574
|
end
|
562
575
|
|
563
576
|
# require built-in generators after discovery in case they've been replaced
|
564
|
-
|
565
|
-
|
566
|
-
|
577
|
+
require_relative 'generator/darkfish'
|
578
|
+
require_relative 'generator/ri'
|
579
|
+
require_relative 'generator/pot'
|
data/lib/rdoc/ri/driver.rb
CHANGED
@@ -17,7 +17,7 @@ require 'rdoc'
|
|
17
17
|
##
|
18
18
|
# For RubyGems backwards compatibility
|
19
19
|
|
20
|
-
|
20
|
+
require_relative 'formatter'
|
21
21
|
|
22
22
|
##
|
23
23
|
# The RI driver implements the command-line ri tool.
|
@@ -356,7 +356,7 @@ or the PAGER environment variable.
|
|
356
356
|
end
|
357
357
|
end
|
358
358
|
|
359
|
-
argv = ENV['RI'].to_s.split.concat argv
|
359
|
+
argv = ENV['RI'].to_s.split(' ').concat argv
|
360
360
|
|
361
361
|
opts.parse! argv
|
362
362
|
|
@@ -1228,7 +1228,7 @@ or the PAGER environment variable.
|
|
1228
1228
|
# +cache+ indicate if it is a class or instance method.
|
1229
1229
|
|
1230
1230
|
def load_method store, cache, klass, type, name
|
1231
|
-
methods = store.
|
1231
|
+
methods = store.public_send(cache)[klass]
|
1232
1232
|
|
1233
1233
|
return unless methods
|
1234
1234
|
|
@@ -1521,7 +1521,7 @@ or the PAGER environment variable.
|
|
1521
1521
|
pagers.compact.uniq.each do |pager|
|
1522
1522
|
next unless pager
|
1523
1523
|
|
1524
|
-
pager_cmd = pager.split.first
|
1524
|
+
pager_cmd = pager.split(' ').first
|
1525
1525
|
|
1526
1526
|
next unless in_path? pager_cmd
|
1527
1527
|
|
@@ -1551,7 +1551,11 @@ or the PAGER environment variable.
|
|
1551
1551
|
# Starts a WEBrick server for ri.
|
1552
1552
|
|
1553
1553
|
def start_server
|
1554
|
-
|
1554
|
+
begin
|
1555
|
+
require 'webrick'
|
1556
|
+
rescue LoadError
|
1557
|
+
abort "webrick is not found. You may need to `gem install webrick` to install webrick."
|
1558
|
+
end
|
1555
1559
|
|
1556
1560
|
server = WEBrick::HTTPServer.new :Port => @server
|
1557
1561
|
|
data/lib/rdoc/ri/paths.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
require_relative '../rdoc'
|
3
3
|
|
4
4
|
##
|
5
5
|
# The directories where ri data lives. Paths can be enumerated via ::each, or
|
@@ -12,23 +12,9 @@ module RDoc::RI::Paths
|
|
12
12
|
|
13
13
|
version = RbConfig::CONFIG['ruby_version']
|
14
14
|
|
15
|
-
BASE =
|
16
|
-
File.join RbConfig::CONFIG['ridir'], version
|
17
|
-
else
|
18
|
-
File.join RbConfig::CONFIG['datadir'], 'ri', version
|
19
|
-
end
|
15
|
+
BASE = File.join RbConfig::CONFIG['ridir'], version
|
20
16
|
|
21
|
-
|
22
|
-
File.expand_path('~')
|
23
|
-
rescue ArgumentError
|
24
|
-
end
|
25
|
-
|
26
|
-
homedir ||= ENV['HOME'] ||
|
27
|
-
ENV['USERPROFILE'] || ENV['HOMEPATH'] # for 1.8 compatibility
|
28
|
-
|
29
|
-
HOMEDIR = if homedir then
|
30
|
-
File.join homedir, ".rdoc"
|
31
|
-
end
|
17
|
+
HOMEDIR = RDoc.home
|
32
18
|
#:startdoc:
|
33
19
|
|
34
20
|
##
|
data/lib/rdoc/ri/task.rb
CHANGED
data/lib/rdoc/rubygems_hook.rb
CHANGED
@@ -70,7 +70,7 @@ class RDoc::RubygemsHook
|
|
70
70
|
def self.load_rdoc
|
71
71
|
return if @rdoc_version
|
72
72
|
|
73
|
-
|
73
|
+
require_relative 'rdoc'
|
74
74
|
|
75
75
|
@rdoc_version = Gem::Version.new ::RDoc::VERSION
|
76
76
|
end
|
@@ -158,7 +158,7 @@ class RDoc::RubygemsHook
|
|
158
158
|
|
159
159
|
case config_args = Gem.configuration[:rdoc]
|
160
160
|
when String then
|
161
|
-
args = args.concat config_args.split
|
161
|
+
args = args.concat config_args.split(' ')
|
162
162
|
when Array then
|
163
163
|
args = args.concat config_args
|
164
164
|
end
|
data/lib/rdoc/servlet.rb
CHANGED
@@ -3,7 +3,12 @@ require 'rdoc'
|
|
3
3
|
require 'erb'
|
4
4
|
require 'time'
|
5
5
|
require 'json'
|
6
|
-
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'webrick'
|
9
|
+
rescue LoadError
|
10
|
+
abort "webrick is not found. You may need to `gem install webrick` to install webrick."
|
11
|
+
end
|
7
12
|
|
8
13
|
##
|
9
14
|
# This is a WEBrick servlet that allows you to browse ri documentation.
|
data/lib/rdoc/store.rb
CHANGED
@@ -482,7 +482,7 @@ class RDoc::Store
|
|
482
482
|
when :gem then
|
483
483
|
parent = File.expand_path '..', @path
|
484
484
|
"gem #{File.basename parent}"
|
485
|
-
when :home then
|
485
|
+
when :home then RDoc.home
|
486
486
|
when :site then 'ruby site'
|
487
487
|
when :system then 'ruby core'
|
488
488
|
else @path
|
@@ -723,7 +723,7 @@ class RDoc::Store
|
|
723
723
|
|
724
724
|
def page name
|
725
725
|
@text_files_hash.each_value.find do |file|
|
726
|
-
file.page_name == name
|
726
|
+
file.page_name == name or file.base_name == name
|
727
727
|
end
|
728
728
|
end
|
729
729
|
|
data/lib/rdoc/version.rb
CHANGED
data/lib/rdoc.rb
CHANGED
@@ -120,6 +120,27 @@ module RDoc
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
def self.home
|
124
|
+
rdoc_dir = begin
|
125
|
+
File.expand_path('~/.rdoc')
|
126
|
+
rescue ArgumentError
|
127
|
+
end
|
128
|
+
|
129
|
+
if File.directory?(rdoc_dir)
|
130
|
+
rdoc_dir
|
131
|
+
else
|
132
|
+
begin
|
133
|
+
# XDG
|
134
|
+
xdg_data_home = ENV["XDG_DATA_HOME"] || File.join(File.expand_path("~"), '.local', 'share')
|
135
|
+
unless File.exist?(xdg_data_home)
|
136
|
+
FileUtils.mkdir_p xdg_data_home
|
137
|
+
end
|
138
|
+
File.join xdg_data_home, "rdoc"
|
139
|
+
rescue Errno::EACCES
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
123
144
|
autoload :RDoc, 'rdoc/rdoc'
|
124
145
|
|
125
146
|
autoload :CrossReference, 'rdoc/cross_reference'
|