ruby-changes:67462
From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:39 +0900 (JST)
Subject: [ruby-changes:67462] 54ae3f587e (master): [rubygems/rubygems] Prefer `require_relative` to `require` for internal requires
https://git.ruby-lang.org/ruby.git/commit/?id=54ae3f587e From 54ae3f587ed42f425edc7ec741702ac764429c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Mon, 22 Apr 2019 13:56:16 +0200 Subject: [rubygems/rubygems] Prefer `require_relative` to `require` for internal requires https://github.com/rubygems/rubygems/commit/c74fc58695 --- lib/rubygems.rb | 28 +++++------ lib/rubygems/command_manager.rb | 6 +-- lib/rubygems/commands/build_command.rb | 6 +-- lib/rubygems/commands/cert_command.rb | 4 +- lib/rubygems/commands/check_command.rb | 8 ++-- lib/rubygems/commands/cleanup_command.rb | 6 +-- lib/rubygems/commands/contents_command.rb | 4 +- lib/rubygems/commands/dependency_command.rb | 6 +-- lib/rubygems/commands/environment_command.rb | 2 +- lib/rubygems/commands/fetch_command.rb | 6 +-- lib/rubygems/commands/generate_index_command.rb | 4 +- lib/rubygems/commands/help_command.rb | 2 +- lib/rubygems/commands/info_command.rb | 4 +- lib/rubygems/commands/install_command.rb | 20 ++++---- lib/rubygems/commands/list_command.rb | 4 +- lib/rubygems/commands/lock_command.rb | 2 +- lib/rubygems/commands/mirror_command.rb | 2 +- lib/rubygems/commands/open_command.rb | 4 +- lib/rubygems/commands/outdated_command.rb | 8 ++-- lib/rubygems/commands/owner_command.rb | 8 ++-- lib/rubygems/commands/pristine_command.rb | 10 ++-- lib/rubygems/commands/push_command.rb | 8 ++-- lib/rubygems/commands/query_command.rb | 6 +-- lib/rubygems/commands/rdoc_command.rb | 6 +-- lib/rubygems/commands/search_command.rb | 4 +- lib/rubygems/commands/server_command.rb | 6 +-- lib/rubygems/commands/setup_command.rb | 10 ++-- lib/rubygems/commands/signin_command.rb | 4 +- lib/rubygems/commands/signout_command.rb | 2 +- lib/rubygems/commands/sources_command.rb | 8 ++-- lib/rubygems/commands/specification_command.rb | 8 ++-- lib/rubygems/commands/stale_command.rb | 2 +- lib/rubygems/commands/uninstall_command.rb | 6 +-- lib/rubygems/commands/unpack_command.rb | 10 ++-- lib/rubygems/commands/update_command.rb | 18 +++---- lib/rubygems/commands/which_command.rb | 2 +- lib/rubygems/commands/yank_command.rb | 8 ++-- lib/rubygems/config_file.rb | 2 +- lib/rubygems/dependency_installer.rb | 16 +++---- lib/rubygems/dependency_list.rb | 2 +- lib/rubygems/doctor.rb | 4 +- lib/rubygems/exceptions.rb | 4 +- lib/rubygems/gem_runner.rb | 6 +-- lib/rubygems/gemcutter_utilities.rb | 4 +- lib/rubygems/indexer.rb | 4 +- lib/rubygems/install_default_message.rb | 4 +- lib/rubygems/install_message.rb | 4 +- lib/rubygems/install_update_options.rb | 4 +- lib/rubygems/installer.rb | 14 +++--- lib/rubygems/local_remote_options.rb | 2 +- lib/rubygems/mock_gem_ui.rb | 2 +- lib/rubygems/package.rb | 24 +++++----- lib/rubygems/package/tar_reader.rb | 2 +- lib/rubygems/package_task.rb | 4 +- lib/rubygems/platform.rb | 2 +- lib/rubygems/rdoc.rb | 2 +- lib/rubygems/remote_fetcher.rb | 14 +++--- lib/rubygems/request.rb | 8 ++-- lib/rubygems/request_set.rb | 8 ++-- lib/rubygems/request_set/lockfile.rb | 2 +- lib/rubygems/request_set/lockfile/tokenizer.rb | 2 +- lib/rubygems/requirement.rb | 2 +- lib/rubygems/resolver.rb | 62 ++++++++++++------------- lib/rubygems/resolver/git_specification.rb | 2 +- lib/rubygems/resolver/molinillo.rb | 2 +- lib/rubygems/resolver/specification.rb | 2 +- lib/rubygems/security.rb | 10 ++-- lib/rubygems/security/policy.rb | 2 +- lib/rubygems/security/signer.rb | 2 +- lib/rubygems/security_option.rb | 4 +- lib/rubygems/server.rb | 4 +- lib/rubygems/source.rb | 12 ++--- lib/rubygems/spec_fetcher.rb | 10 ++-- lib/rubygems/specification.rb | 18 +++---- lib/rubygems/specification_policy.rb | 2 +- lib/rubygems/uninstaller.rb | 12 ++--- lib/rubygems/user_interaction.rb | 4 +- lib/rubygems/util/licenses.rb | 2 +- lib/rubygems/validator.rb | 4 +- lib/rubygems/version_option.rb | 2 +- 80 files changed, 275 insertions(+), 275 deletions(-) diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 9e8776b..80708e2 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -12,11 +12,11 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L12 end # Must be first since it unloads the prelude from 1.9.2 -require 'rubygems/compatibility' +require_relative 'rubygems/compatibility' -require 'rubygems/defaults' -require 'rubygems/deprecate' -require 'rubygems/errors' +require_relative 'rubygems/defaults' +require_relative 'rubygems/deprecate' +require_relative 'rubygems/errors' ## # RubyGems is the Ruby standard for publishing and managing third party @@ -559,7 +559,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L559 # => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>] def self.install(name, version = Gem::Requirement.default, *options) - require "rubygems/dependency_installer" + require_relative "rubygems/dependency_installer" inst = Gem::DependencyInstaller.new(*options) inst.install name, version inst.installed_gems @@ -625,12 +625,12 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L625 rescue ::LoadError # If we can't load psych, that's fine, go on. else - require 'rubygems/psych_additions' - require 'rubygems/psych_tree' + require_relative 'rubygems/psych_additions' + require_relative 'rubygems/psych_tree' end require 'yaml' - require 'rubygems/safe_yaml' + require_relative 'rubygems/safe_yaml' @yaml_loaded = true end @@ -990,7 +990,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L990 # Lazily loads DefaultUserInteraction and returns the default UI. def self.ui - require 'rubygems/user_interaction' + require_relative 'rubygems/user_interaction' Gem::DefaultUserInteraction.ui end @@ -1110,7 +1110,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1110 end ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path) - require 'rubygems/user_interaction' + require_relative 'rubygems/user_interaction' require "bundler" begin Gem::DefaultUserInteraction.use_ui(ui) do @@ -1322,7 +1322,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1322 autoload :Version, File.expand_path('rubygems/version', __dir__) end -require 'rubygems/exceptions' +require_relative 'rubygems/exceptions' # REFACTOR: This should be pulled out into some kind of hacks file. begin @@ -1353,6 +1353,6 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1353 # Loads the default specs. Gem::Specification.load_defaults -require 'rubygems/core_ext/kernel_gem' -require 'rubygems/core_ext/kernel_require' -require 'rubygems/core_ext/kernel_warn' +require_relative 'rubygems/core_ext/kernel_gem' +require_relative 'rubygems/core_ext/kernel_require' +require_relative 'rubygems/core_ext/kernel_warn' diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb index 2409550..39bf8bd 100644 --- a/lib/rubygems/command_manager.rb +++ b/lib/rubygems/command_manager.rb @@ -5,9 +5,9 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command_manager.rb#L5 # See LICENSE.txt for permissions. #++ -require 'rubygems/command' -require 'rubygems/user_interaction' -require 'rubygems/text' +require_relative 'command' +require_relative 'user_interaction' +require_relative 'text' ## # The command manager registers and installs all the individual sub-commands diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index 842ec18..6d1a057 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -1,7 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/build_command.rb#L1 # frozen_string_literal: true -require 'rubygems/command' -require 'rubygems/package' -require 'rubygems/version_option' +require_relative '../command' +require_relative '../package' +require_relative '../version_option' class Gem::Commands::BuildCommand < Gem::Command include Gem::VersionOption diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb index 3fc0dae..bdfeb0b 100644 --- a/lib/rubygems/commands/cert_command.rb +++ b/lib/rubygems/commands/cert_command.rb @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/cert_command.rb#L1 # frozen_string_literal: true -require 'rubygems/command' -require 'rubygems/security' +require_relative '../command' +require_relative '../security' class Gem::Commands::CertCommand < Gem::Command def initialize d (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/