ruby-changes:62953
From: Marc-Andre <ko1@a...>
Date: Tue, 15 Sep 2020 01:59:52 +0900 (JST)
Subject: [ruby-changes:62953] 867f0c6793 (master): [ruby/rdoc] Prefer require_relative
https://git.ruby-lang.org/ruby.git/commit/?id=867f0c6793 From 867f0c6793da63a8f80eb3d868fe10e859abe3d8 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune <github@m...> Date: Fri, 5 Oct 2018 16:41:57 -0400 Subject: [ruby/rdoc] Prefer require_relative diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index 5049aa4..b46861d 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -4,7 +4,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/darkfish.rb#L4 require 'erb' require 'fileutils' require 'pathname' -require 'rdoc/generator/markup' +require_relative 'markup' ## # Darkfish RDoc HTML Generator diff --git a/lib/rdoc/generator/pot.rb b/lib/rdoc/generator/pot.rb index a12cba7..bee1133 100644 --- a/lib/rdoc/generator/pot.rb +++ b/lib/rdoc/generator/pot.rb @@ -91,8 +91,8 @@ class RDoc::Generator::POT https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/pot.rb#L91 extractor.extract end - require 'rdoc/generator/pot/message_extractor' - require 'rdoc/generator/pot/po' - require 'rdoc/generator/pot/po_entry' + require_relative 'pot/message_extractor' + require_relative 'pot/po' + require_relative 'pot/po_entry' end diff --git a/lib/rdoc/i18n.rb b/lib/rdoc/i18n.rb index af30385..a32fd84 100644 --- a/lib/rdoc/i18n.rb +++ b/lib/rdoc/i18n.rb @@ -5,6 +5,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/i18n.rb#L5 module RDoc::I18n autoload :Locale, 'rdoc/i18n/locale' - require 'rdoc/i18n/text' + require_relative 'i18n/text' end diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb index 597bcd6..2ee40ee 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -269,9 +269,9 @@ class RDoc::Parser https://github.com/ruby/ruby/blob/trunk/lib/rdoc/parser.rb#L269 end # simple must come first in order to show up last in the parsers list -require 'rdoc/parser/simple' -require 'rdoc/parser/c' -require 'rdoc/parser/changelog' -require 'rdoc/parser/markdown' -require 'rdoc/parser/rd' -require 'rdoc/parser/ruby' +require_relative 'parser/simple' +require_relative 'parser/c' +require_relative 'parser/changelog' +require_relative 'parser/markdown' +require_relative 'parser/rd' +require_relative 'parser/ruby' diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 1c099b2..a0835d1 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -561,6 +561,6 @@ rescue LoadError https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rdoc.rb#L561 end # require built-in generators after discovery in case they've been replaced -require 'rdoc/generator/darkfish' -require 'rdoc/generator/ri' -require 'rdoc/generator/pot' +require_relative 'generator/darkfish' +require_relative 'generator/ri' +require_relative 'generator/pot' diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index 1f504a6..7f70904 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -17,7 +17,7 @@ require 'rdoc' https://github.com/ruby/ruby/blob/trunk/lib/rdoc/ri/driver.rb#L17 ## # For RubyGems backwards compatibility -require 'rdoc/ri/formatter' +require_relative 'formatter' ## # The RI driver implements the command-line ri tool. diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb index 7891d1e..8e89b04 100644 --- a/lib/rdoc/ri/paths.rb +++ b/lib/rdoc/ri/paths.rb @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/ri/paths.rb#L1 # frozen_string_literal: true -require 'rdoc/rdoc' +require_relative '../rdoc' ## # The directories where ri data lives. Paths can be enumerated via ::each, or diff --git a/lib/rdoc/ri/task.rb b/lib/rdoc/ri/task.rb index 6a6ea57..1122ea3 100644 --- a/lib/rdoc/ri/task.rb +++ b/lib/rdoc/ri/task.rb @@ -4,7 +4,7 @@ begin https://github.com/ruby/ruby/blob/trunk/lib/rdoc/ri/task.rb#L4 rescue Gem::LoadError end unless defined?(RDoc) -require 'rdoc/task' +require_relative '../task' ## # RDoc::RI::Task creates ri data in <code>./.rdoc</code> for your project. diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index a676455..f4aa965 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -70,7 +70,7 @@ class RDoc::RubygemsHook https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rubygems_hook.rb#L70 def self.load_rdoc return if @rdoc_version - require 'rdoc/rdoc' + require_relative 'rdoc' @rdoc_version = Gem::Version.new ::RDoc::VERSION end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/