From 39e09429d33e56cf932207be807a316dbe8fb93a Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune Date: Fri, 5 Oct 2018 16:41:57 -0400 Subject: [PATCH] Prefer require_relative --- lib/rdoc/generator/darkfish.rb | 2 +- lib/rdoc/generator/pot.rb | 6 +++--- lib/rdoc/i18n.rb | 2 +- lib/rdoc/parser.rb | 12 ++++++------ lib/rdoc/rdoc.rb | 6 +++--- lib/rdoc/ri/driver.rb | 2 +- lib/rdoc/ri/paths.rb | 2 +- lib/rdoc/ri/task.rb | 2 +- lib/rdoc/rubygems_hook.rb | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index a07f74e716..ad66b9a334 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -4,7 +4,7 @@ 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 a12cba7505..bee1133b07 100644 --- a/lib/rdoc/generator/pot.rb +++ b/lib/rdoc/generator/pot.rb @@ -91,8 +91,8 @@ def extract_messages 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 af303858b9..a32fd848a0 100644 --- a/lib/rdoc/i18n.rb +++ b/lib/rdoc/i18n.rb @@ -5,6 +5,6 @@ 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 597bcd6b9d..2ee40eed40 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -269,9 +269,9 @@ def initialize top_level, file_name, content, options, stats 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 ca2c1abefd..efa5c864a0 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -561,6 +561,6 @@ def remove_siginfo_handler 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 c4d1dd03df..5399aa9a55 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -17,7 +17,7 @@ ## # 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 d41e610591..e8f3727592 100644 --- a/lib/rdoc/ri/paths.rb +++ b/lib/rdoc/ri/paths.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/ri' +require_relative '../ri' ## # 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 6a6ea572bf..1122ea3775 100644 --- a/lib/rdoc/ri/task.rb +++ b/lib/rdoc/ri/task.rb @@ -4,7 +4,7 @@ rescue Gem::LoadError end unless defined?(RDoc) -require 'rdoc/task' +require_relative '../task' ## # RDoc::RI::Task creates ri data in ./.rdoc for your project. diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index 90b0541fcf..0ecad8b11d 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -70,7 +70,7 @@ def self.generation_hook installer, specs def self.load_rdoc return if @rdoc_version - require 'rdoc/rdoc' + require_relative 'rdoc' @rdoc_version = Gem::Version.new ::RDoc::VERSION end