ruby-changes:68365
From: David <ko1@a...>
Date: Mon, 11 Oct 2021 01:13:04 +0900 (JST)
Subject: [ruby-changes:68365] e0c20485db (master): [ruby/rubygems] Prefer `require_relative` for internal requires
https://git.ruby-lang.org/ruby.git/commit/?id=e0c20485db From e0c20485db62f1c764b9902ad4e64658a9027632 Mon Sep 17 00:00:00 2001 From: David Rodriguez <deivid.rodriguez@r...> Date: Sun, 10 Oct 2021 17:10:49 +0200 Subject: [ruby/rubygems] Prefer `require_relative` for internal requires https://github.com/rubygems/rubygems/commit/51796f257a --- lib/rubygems/commands/setup_command.rb | 2 +- lib/rubygems/query_utils.rb | 8 ++++---- lib/rubygems/remote_fetcher.rb | 2 +- lib/rubygems/s3_uri_signer.rb | 6 +++--- lib/rubygems/source.rb | 2 +- lib/rubygems/util.rb | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index edb3498eec..00953a8f4b 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -606,7 +606,7 @@ abort "#{deprecation_message}" https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/setup_command.rb#L606 end def regenerate_plugins - require "rubygems/commands/pristine_command" + require_relative "pristine_command" say "Regenerating plugins" args = %w[--all --only-plugins --silent] diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb index ea0f260ab4..0acd5bf9c8 100644 --- a/lib/rubygems/query_utils.rb +++ b/lib/rubygems/query_utils.rb @@ -1,9 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/query_utils.rb#L1 # frozen_string_literal: true -require 'rubygems/local_remote_options' -require 'rubygems/spec_fetcher' -require 'rubygems/version_option' -require 'rubygems/text' +require_relative 'local_remote_options' +require_relative 'spec_fetcher' +require_relative 'version_option' +require_relative 'text' module Gem::QueryUtils diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb index 0724a51ee0..bd8165e3c7 100644 --- a/lib/rubygems/remote_fetcher.rb +++ b/lib/rubygems/remote_fetcher.rb @@ -72,7 +72,7 @@ class Gem::RemoteFetcher https://github.com/ruby/ruby/blob/trunk/lib/rubygems/remote_fetcher.rb#L72 # fetching the gem. def initialize(proxy=nil, dns=nil, headers={}) - require 'rubygems/core_ext/tcpsocket_init' if Gem.configuration.ipv4_fallback_enabled + require_relative 'core_ext/tcpsocket_init' if Gem.configuration.ipv4_fallback_enabled require 'net/http' require 'stringio' require 'uri' diff --git a/lib/rubygems/s3_uri_signer.rb b/lib/rubygems/s3_uri_signer.rb index bba9afc9ff..da2af5f326 100644 --- a/lib/rubygems/s3_uri_signer.rb +++ b/lib/rubygems/s3_uri_signer.rb @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/s3_uri_signer.rb#L1 require 'digest' -require 'rubygems/openssl' +require_relative 'openssl' ## # S3URISigner implements AWS SigV4 for S3 Source to avoid a dependency on the aws-sdk-* gems @@ -140,8 +140,8 @@ class Gem::S3URISigner https://github.com/ruby/ruby/blob/trunk/lib/rubygems/s3_uri_signer.rb#L140 def ec2_metadata_credentials_json require 'net/http' - require 'rubygems/request' - require 'rubygems/request/connection_pools' + require_relative 'request' + require_relative 'request/connection_pools' require 'json' iam_info = ec2_metadata_request(EC2_IAM_INFO) diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb index a9d91ed18e..f03e09872c 100644 --- a/lib/rubygems/source.rb +++ b/lib/rubygems/source.rb @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/source.rb#L1 # frozen_string_literal: true -require "rubygems/text" +require_relative "text" ## # A Source knows how to list and fetch gems from a RubyGems marshal index. # diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb index 2a55305172..4363c5adce 100644 --- a/lib/rubygems/util.rb +++ b/lib/rubygems/util.rb @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/util.rb#L1 # frozen_string_literal: true -require 'rubygems/deprecate' +require_relative 'deprecate' ## # This module contains various utility methods as module methods. -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/