summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2017-07-15 19:11:50 +0900
committerKoichi ITO <koic.ito@gmail.com>2017-07-16 15:12:53 +0900
commit5687d01121f7e442a13b7b8caf2489811a3f4548 (patch)
treece4a20c76b7730326c9e77d672f4be82fa7d95ee
parent9e42c6096a65308c6084b42d4dfceddf7ac13444 (diff)
downloadbundler-5687d01121f7e442a13b7b8caf2489811a3f4548.tar.gz
[RuboCop] Enable Layout/EmptyLineAfterMagicComment cop
-rw-r--r--.rubocop_todo.yml5
-rw-r--r--Rakefile1
-rw-r--r--bundler.gemspec1
-rw-r--r--lib/bundler.rb1
-rw-r--r--lib/bundler/capistrano.rb1
-rw-r--r--lib/bundler/cli.rb1
-rw-r--r--lib/bundler/cli/add.rb1
-rw-r--r--lib/bundler/cli/binstubs.rb1
-rw-r--r--lib/bundler/cli/cache.rb1
-rw-r--r--lib/bundler/cli/check.rb1
-rw-r--r--lib/bundler/cli/clean.rb1
-rw-r--r--lib/bundler/cli/common.rb1
-rw-r--r--lib/bundler/cli/config.rb1
-rw-r--r--lib/bundler/cli/console.rb1
-rw-r--r--lib/bundler/cli/exec.rb1
-rw-r--r--lib/bundler/cli/gem.rb1
-rw-r--r--lib/bundler/cli/info.rb1
-rw-r--r--lib/bundler/cli/init.rb1
-rw-r--r--lib/bundler/cli/inject.rb1
-rw-r--r--lib/bundler/cli/install.rb1
-rw-r--r--lib/bundler/cli/lock.rb1
-rw-r--r--lib/bundler/cli/open.rb1
-rw-r--r--lib/bundler/cli/outdated.rb1
-rw-r--r--lib/bundler/cli/package.rb1
-rw-r--r--lib/bundler/cli/platform.rb1
-rw-r--r--lib/bundler/cli/plugin.rb1
-rw-r--r--lib/bundler/cli/pristine.rb1
-rw-r--r--lib/bundler/cli/show.rb1
-rw-r--r--lib/bundler/cli/update.rb1
-rw-r--r--lib/bundler/cli/viz.rb1
-rw-r--r--lib/bundler/compact_index_client.rb1
-rw-r--r--lib/bundler/compact_index_client/cache.rb1
-rw-r--r--lib/bundler/compact_index_client/updater.rb1
-rw-r--r--lib/bundler/constants.rb1
-rw-r--r--lib/bundler/current_ruby.rb1
-rw-r--r--lib/bundler/definition.rb1
-rw-r--r--lib/bundler/dep_proxy.rb1
-rw-r--r--lib/bundler/dependency.rb1
-rw-r--r--lib/bundler/deprecate.rb1
-rw-r--r--lib/bundler/dsl.rb1
-rw-r--r--lib/bundler/endpoint_specification.rb1
-rw-r--r--lib/bundler/env.rb1
-rw-r--r--lib/bundler/environment_preserver.rb1
-rw-r--r--lib/bundler/errors.rb1
-rw-r--r--lib/bundler/feature_flag.rb1
-rw-r--r--lib/bundler/fetcher.rb1
-rw-r--r--lib/bundler/fetcher/base.rb1
-rw-r--r--lib/bundler/fetcher/compact_index.rb1
-rw-r--r--lib/bundler/fetcher/dependency.rb1
-rw-r--r--lib/bundler/fetcher/downloader.rb1
-rw-r--r--lib/bundler/fetcher/index.rb1
-rw-r--r--lib/bundler/friendly_errors.rb1
-rw-r--r--lib/bundler/gem_helper.rb1
-rw-r--r--lib/bundler/gem_helpers.rb1
-rw-r--r--lib/bundler/gem_remote_fetcher.rb1
-rw-r--r--lib/bundler/gem_tasks.rb1
-rw-r--r--lib/bundler/gem_version_promoter.rb1
-rw-r--r--lib/bundler/gemdeps.rb1
-rw-r--r--lib/bundler/graph.rb1
-rw-r--r--lib/bundler/index.rb1
-rw-r--r--lib/bundler/injector.rb1
-rw-r--r--lib/bundler/inline.rb1
-rw-r--r--lib/bundler/installer.rb1
-rw-r--r--lib/bundler/installer/gem_installer.rb1
-rw-r--r--lib/bundler/installer/parallel_installer.rb1
-rw-r--r--lib/bundler/installer/standalone.rb1
-rw-r--r--lib/bundler/lazy_specification.rb1
-rw-r--r--lib/bundler/lockfile_generator.rb1
-rw-r--r--lib/bundler/match_platform.rb1
-rw-r--r--lib/bundler/mirror.rb1
-rw-r--r--lib/bundler/plugin.rb1
-rw-r--r--lib/bundler/plugin/api/source.rb1
-rw-r--r--lib/bundler/psyched_yaml.rb1
-rw-r--r--lib/bundler/remote_specification.rb1
-rw-r--r--lib/bundler/resolver.rb1
-rw-r--r--lib/bundler/retry.rb1
-rw-r--r--lib/bundler/ruby_dsl.rb1
-rw-r--r--lib/bundler/ruby_version.rb1
-rw-r--r--lib/bundler/rubygems_ext.rb1
-rw-r--r--lib/bundler/rubygems_gem_installer.rb1
-rw-r--r--lib/bundler/rubygems_integration.rb1
-rw-r--r--lib/bundler/runtime.rb1
-rw-r--r--lib/bundler/settings.rb1
-rw-r--r--lib/bundler/setup.rb1
-rw-r--r--lib/bundler/shared_helpers.rb1
-rw-r--r--lib/bundler/similarity_detector.rb1
-rw-r--r--lib/bundler/source.rb1
-rw-r--r--lib/bundler/source/gemspec.rb1
-rw-r--r--lib/bundler/source/git.rb1
-rw-r--r--lib/bundler/source/git/git_proxy.rb1
-rw-r--r--lib/bundler/source/path.rb1
-rw-r--r--lib/bundler/source/path/installer.rb1
-rw-r--r--lib/bundler/source/rubygems.rb1
-rw-r--r--lib/bundler/source/rubygems/remote.rb1
-rw-r--r--lib/bundler/source_list.rb1
-rw-r--r--lib/bundler/spec_set.rb1
-rw-r--r--lib/bundler/ssl_certs/certificate_manager.rb1
-rw-r--r--lib/bundler/stub_specification.rb1
-rwxr-xr-xlib/bundler/templates/Executable1
-rw-r--r--lib/bundler/templates/Gemfile1
-rw-r--r--lib/bundler/templates/gems.rb1
-rw-r--r--lib/bundler/ui.rb1
-rw-r--r--lib/bundler/ui/rg_proxy.rb1
-rw-r--r--lib/bundler/ui/shell.rb1
-rw-r--r--lib/bundler/ui/silent.rb1
-rw-r--r--lib/bundler/uri_credentials_filter.rb1
-rw-r--r--lib/bundler/vendored_fileutils.rb1
-rw-r--r--lib/bundler/vendored_molinillo.rb1
-rw-r--r--lib/bundler/vendored_persistent.rb1
-rw-r--r--lib/bundler/vendored_thor.rb1
-rw-r--r--lib/bundler/version_ranges.rb1
-rw-r--r--lib/bundler/vlad.rb1
-rw-r--r--lib/bundler/worker.rb1
-rw-r--r--spec/bundler/bundler_spec.rb1
-rw-r--r--spec/bundler/cli_spec.rb1
-rw-r--r--spec/bundler/compact_index_client/updater_spec.rb1
-rw-r--r--spec/bundler/definition_spec.rb1
-rw-r--r--spec/bundler/env_spec.rb1
-rw-r--r--spec/bundler/fetcher_spec.rb1
-rw-r--r--spec/bundler/friendly_errors_spec.rb1
-rw-r--r--spec/bundler/gem_helper_spec.rb1
-rw-r--r--spec/bundler/installer/gem_installer_spec.rb1
-rw-r--r--spec/bundler/installer/parallel_installer_spec.rb1
-rw-r--r--spec/bundler/installer/spec_installation_spec.rb1
-rw-r--r--spec/bundler/lockfile_parser_spec.rb1
-rw-r--r--spec/bundler/mirror_spec.rb1
-rw-r--r--spec/bundler/psyched_yaml_spec.rb1
-rw-r--r--spec/bundler/ruby_dsl_spec.rb1
-rw-r--r--spec/bundler/ruby_version_spec.rb1
-rw-r--r--spec/bundler/settings_spec.rb1
-rw-r--r--spec/bundler/source/rubygems/remote_spec.rb1
-rw-r--r--spec/bundler/ssl_certs/certificate_manager_spec.rb1
-rw-r--r--spec/bundler/version_ranges_spec.rb1
-rw-r--r--spec/bundler/worker_spec.rb1
-rw-r--r--spec/bundler/yaml_serializer_spec.rb1
-rw-r--r--spec/commands/doctor_spec.rb1
-rw-r--r--spec/commands/pristine_spec.rb1
-rw-r--r--spec/install/security_policy_spec.rb1
-rw-r--r--spec/other/ssl_cert_spec.rb1
-rw-r--r--spec/realworld/gemfile_source_header_spec.rb1
-rw-r--r--spec/realworld/mirror_probe_spec.rb1
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/artifice/compact_index.rb1
-rw-r--r--spec/support/artifice/compact_index_api_missing.rb1
-rw-r--r--spec/support/artifice/compact_index_basic_authentication.rb1
-rw-r--r--spec/support/artifice/compact_index_checksum_mismatch.rb1
-rw-r--r--spec/support/artifice/compact_index_concurrent_download.rb1
-rw-r--r--spec/support/artifice/compact_index_creds_diff_host.rb1
-rw-r--r--spec/support/artifice/compact_index_extra.rb1
-rw-r--r--spec/support/artifice/compact_index_extra_api.rb1
-rw-r--r--spec/support/artifice/compact_index_extra_api_missing.rb1
-rw-r--r--spec/support/artifice/compact_index_extra_missing.rb1
-rw-r--r--spec/support/artifice/compact_index_forbidden.rb1
-rw-r--r--spec/support/artifice/compact_index_host_redirect.rb1
-rw-r--r--spec/support/artifice/compact_index_no_gem.rb1
-rw-r--r--spec/support/artifice/compact_index_partial_update.rb1
-rw-r--r--spec/support/artifice/compact_index_redirects.rb1
-rw-r--r--spec/support/artifice/compact_index_strict_basic_authentication.rb1
-rw-r--r--spec/support/artifice/compact_index_wrong_dependencies.rb1
-rw-r--r--spec/support/artifice/compact_index_wrong_gem_checksum.rb1
-rw-r--r--spec/support/artifice/endopint_marshal_fail_basic_authentication.rb1
-rw-r--r--spec/support/artifice/endpoint.rb1
-rw-r--r--spec/support/artifice/endpoint_500.rb1
-rw-r--r--spec/support/artifice/endpoint_api_forbidden.rb1
-rw-r--r--spec/support/artifice/endpoint_api_missing.rb1
-rw-r--r--spec/support/artifice/endpoint_basic_authentication.rb1
-rw-r--r--spec/support/artifice/endpoint_creds_diff_host.rb1
-rw-r--r--spec/support/artifice/endpoint_extra.rb1
-rw-r--r--spec/support/artifice/endpoint_extra_api.rb1
-rw-r--r--spec/support/artifice/endpoint_extra_missing.rb1
-rw-r--r--spec/support/artifice/endpoint_fallback.rb1
-rw-r--r--spec/support/artifice/endpoint_host_redirect.rb1
-rw-r--r--spec/support/artifice/endpoint_marshal_fail.rb1
-rw-r--r--spec/support/artifice/endpoint_mirror_source.rb1
-rw-r--r--spec/support/artifice/endpoint_redirect.rb1
-rw-r--r--spec/support/artifice/endpoint_strict_basic_authentication.rb1
-rw-r--r--spec/support/artifice/endpoint_timeout.rb1
-rw-r--r--spec/support/artifice/vcr.rb1
-rw-r--r--spec/support/artifice/windows.rb1
-rw-r--r--spec/support/builders.rb1
-rw-r--r--spec/support/code_climate.rb1
-rw-r--r--spec/support/command_execution.rb1
-rw-r--r--spec/support/hax.rb1
-rw-r--r--spec/support/helpers.rb1
-rw-r--r--spec/support/indexes.rb1
-rw-r--r--spec/support/less_than_proc.rb1
-rw-r--r--spec/support/manpages.rb1
-rw-r--r--spec/support/matchers.rb1
-rw-r--r--spec/support/path.rb1
-rw-r--r--spec/support/permissions.rb1
-rw-r--r--spec/support/platforms.rb1
-rw-r--r--spec/support/rubygems_ext.rb1
-rw-r--r--spec/support/silent_logger.rb1
-rw-r--r--spec/support/sometimes.rb1
-rw-r--r--spec/support/streams.rb1
-rw-r--r--spec/support/sudo.rb1
-rw-r--r--spec/support/the_bundle.rb1
-rw-r--r--task/git_hooks.rake1
198 files changed, 197 insertions, 5 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 2eaf40e8de..5ac75f17b9 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -6,11 +6,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 310
-# Cop supports --auto-correct.
-Layout/EmptyLineAfterMagicComment:
- Enabled: false
-
# Offense count: 2
# Cop supports --auto-correct.
Layout/EmptyLinesAroundExceptionHandlingKeywords:
diff --git a/Rakefile b/Rakefile
index 6f08086731..928fe9e38f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*-
# frozen_string_literal: true
+
$:.unshift File.expand_path("../lib", __FILE__)
require "shellwords"
require "benchmark"
diff --git a/bundler.gemspec b/bundler.gemspec
index a2283d6caa..30bee33d15 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -1,5 +1,6 @@
# coding: utf-8
# frozen_string_literal: true
+
lib = File.expand_path("../lib/", __FILE__)
$:.unshift lib unless $:.include?(lib)
require "bundler/version"
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 068970fbc6..3fbd35b573 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_fileutils"
require "pathname"
require "rbconfig"
diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb
index 7b0bbbd6d2..81d457cf26 100644
--- a/lib/bundler/capistrano.rb
+++ b/lib/bundler/capistrano.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
# Capistrano task for Bundler.
#
# Add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 7992540793..c1fc40ab1f 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler"
require "bundler/vendored_thor"
diff --git a/lib/bundler/cli/add.rb b/lib/bundler/cli/add.rb
index e80c775433..3a10371994 100644
--- a/lib/bundler/cli/add.rb
+++ b/lib/bundler/cli/add.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb
index f872a2dcc7..ebb2979625 100644
--- a/lib/bundler/cli/binstubs.rb
+++ b/lib/bundler/cli/binstubs.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb
index 5ba105a31d..891671447d 100644
--- a/lib/bundler/cli/cache.rb
+++ b/lib/bundler/cli/cache.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Cache
attr_reader :options
diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb
index 96781b6c3a..553c48cebf 100644
--- a/lib/bundler/cli/check.rb
+++ b/lib/bundler/cli/check.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Check
attr_reader :options
diff --git a/lib/bundler/cli/clean.rb b/lib/bundler/cli/clean.rb
index 5eba09c6bc..0534532ee2 100644
--- a/lib/bundler/cli/clean.rb
+++ b/lib/bundler/cli/clean.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Clean
attr_reader :options
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb
index bacbb2edc5..c8c4115fa3 100644
--- a/lib/bundler/cli/common.rb
+++ b/lib/bundler/cli/common.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
module CLI::Common
def self.output_post_install_messages(messages)
diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb
index a61cf128b1..12f71ea8fe 100644
--- a/lib/bundler/cli/config.rb
+++ b/lib/bundler/cli/config.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Config
attr_reader :name, :options, :scope, :thor
diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb
index 715abf2554..70a2c90f74 100644
--- a/lib/bundler/cli/console.rb
+++ b/lib/bundler/cli/console.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Console
attr_reader :options, :group
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb
index 990f71f1d1..4b4a621879 100644
--- a/lib/bundler/cli/exec.rb
+++ b/lib/bundler/cli/exec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/current_ruby"
module Bundler
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 26dc8eedd9..5ebaf189e9 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "pathname"
module Bundler
diff --git a/lib/bundler/cli/info.rb b/lib/bundler/cli/info.rb
index 4465fba9d4..68670f29f4 100644
--- a/lib/bundler/cli/info.rb
+++ b/lib/bundler/cli/info.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb
index ce41b2d784..50e01f54fb 100644
--- a/lib/bundler/cli/init.rb
+++ b/lib/bundler/cli/init.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Init
attr_reader :options
diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb
index b17292643f..b00675d348 100644
--- a/lib/bundler/cli/inject.rb
+++ b/lib/bundler/cli/inject.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Inject
attr_reader :options, :name, :version, :group, :source, :gems
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 35a0aa7b58..b9188b233c 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/lock.rb b/lib/bundler/cli/lock.rb
index 223db9419f..2ac0537e39 100644
--- a/lib/bundler/cli/lock.rb
+++ b/lib/bundler/cli/lock.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb
index 9a21f6811c..380dbcb258 100644
--- a/lib/bundler/cli/open.rb
+++ b/lib/bundler/cli/open.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
require "shellwords"
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 07e17df981..3fb0feaddd 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/package.rb b/lib/bundler/cli/package.rb
index cf65e8a68c..eca7e08342 100644
--- a/lib/bundler/cli/package.rb
+++ b/lib/bundler/cli/package.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Package
attr_reader :options
diff --git a/lib/bundler/cli/platform.rb b/lib/bundler/cli/platform.rb
index 9fdab0a53c..e97cad49a4 100644
--- a/lib/bundler/cli/platform.rb
+++ b/lib/bundler/cli/platform.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Platform
attr_reader :options
diff --git a/lib/bundler/cli/plugin.rb b/lib/bundler/cli/plugin.rb
index 277822dafc..5488a9f28d 100644
--- a/lib/bundler/cli/plugin.rb
+++ b/lib/bundler/cli/plugin.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_thor"
module Bundler
class CLI::Plugin < Thor
diff --git a/lib/bundler/cli/pristine.rb b/lib/bundler/cli/pristine.rb
index cfd90da34b..48c5b13899 100644
--- a/lib/bundler/cli/pristine.rb
+++ b/lib/bundler/cli/pristine.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/show.rb b/lib/bundler/cli/show.rb
index 47d4470aec..2424e301ff 100644
--- a/lib/bundler/cli/show.rb
+++ b/lib/bundler/cli/show.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb
index 9e4543668e..952076566f 100644
--- a/lib/bundler/cli/update.rb
+++ b/lib/bundler/cli/update.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli/common"
module Bundler
diff --git a/lib/bundler/cli/viz.rb b/lib/bundler/cli/viz.rb
index 767fe8f3de..644f9b25cf 100644
--- a/lib/bundler/cli/viz.rb
+++ b/lib/bundler/cli/viz.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class CLI::Viz
attr_reader :options, :gem_name
diff --git a/lib/bundler/compact_index_client.rb b/lib/bundler/compact_index_client.rb
index 3ed05ca484..6c241ca07a 100644
--- a/lib/bundler/compact_index_client.rb
+++ b/lib/bundler/compact_index_client.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "pathname"
require "set"
diff --git a/lib/bundler/compact_index_client/cache.rb b/lib/bundler/compact_index_client/cache.rb
index e44f05dc7e..264e31716d 100644
--- a/lib/bundler/compact_index_client/cache.rb
+++ b/lib/bundler/compact_index_client/cache.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "digest/md5"
module Bundler
diff --git a/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb
index b501fc194b..6a66fbc3fe 100644
--- a/lib/bundler/compact_index_client/updater.rb
+++ b/lib/bundler/compact_index_client/updater.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_fileutils"
require "stringio"
require "zlib"
diff --git a/lib/bundler/constants.rb b/lib/bundler/constants.rb
index 5b1c0a8cb1..2e4ebb37ee 100644
--- a/lib/bundler/constants.rb
+++ b/lib/bundler/constants.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb
index fbdd3182a9..31532d108d 100644
--- a/lib/bundler/current_ruby.rb
+++ b/lib/bundler/current_ruby.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
# Returns current version of Ruby
#
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 23b61ffd01..a8b37499fd 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/lockfile_parser"
require "digest/sha1"
require "set"
diff --git a/lib/bundler/dep_proxy.rb b/lib/bundler/dep_proxy.rb
index 998975bbaf..637534e255 100644
--- a/lib/bundler/dep_proxy.rb
+++ b/lib/bundler/dep_proxy.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class DepProxy
attr_reader :__platform, :dep
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index 5f1371dd62..24257bc113 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rubygems/dependency"
require "bundler/shared_helpers"
require "bundler/rubygems_ext"
diff --git a/lib/bundler/deprecate.rb b/lib/bundler/deprecate.rb
index b978c0df6c..b3a9823925 100644
--- a/lib/bundler/deprecate.rb
+++ b/lib/bundler/deprecate.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
if defined? ::Deprecate
Deprecate = ::Deprecate
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index c368c533fe..e19097f57d 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/dependency"
require "bundler/ruby_dsl"
diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb
index 5a1deeea47..04e42c2410 100644
--- a/lib/bundler/endpoint_specification.rb
+++ b/lib/bundler/endpoint_specification.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
# used for Creating Specifications from the Gemcutter Endpoint
class EndpointSpecification < Gem::Specification
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb
index 333173ac27..481cfb092d 100644
--- a/lib/bundler/env.rb
+++ b/lib/bundler/env.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/rubygems_integration"
require "bundler/source/git/git_proxy"
diff --git a/lib/bundler/environment_preserver.rb b/lib/bundler/environment_preserver.rb
index f78872442a..5a3e6c5785 100644
--- a/lib/bundler/environment_preserver.rb
+++ b/lib/bundler/environment_preserver.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class EnvironmentPreserver
INTENTIONALLY_NIL = "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL".freeze
diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb
index 6ce8493ea7..e471bce0b6 100644
--- a/lib/bundler/errors.rb
+++ b/lib/bundler/errors.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class BundlerError < StandardError
def self.status_code(code)
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index 2d054c2856..00523eb96e 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class FeatureFlag
def self.settings_flag(flag, &default)
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 9e208e4957..01a0679f7c 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_persistent"
require "cgi"
require "securerandom"
diff --git a/lib/bundler/fetcher/base.rb b/lib/bundler/fetcher/base.rb
index 271729a534..27987f670a 100644
--- a/lib/bundler/fetcher/base.rb
+++ b/lib/bundler/fetcher/base.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Fetcher
class Base
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb
index ec20f18edd..cfc74d642c 100644
--- a/lib/bundler/fetcher/compact_index.rb
+++ b/lib/bundler/fetcher/compact_index.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/fetcher/base"
require "bundler/worker"
diff --git a/lib/bundler/fetcher/dependency.rb b/lib/bundler/fetcher/dependency.rb
index 445b0f2332..741b81acac 100644
--- a/lib/bundler/fetcher/dependency.rb
+++ b/lib/bundler/fetcher/dependency.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/fetcher/base"
require "cgi"
diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb
index 453e4645eb..cbc5e220bd 100644
--- a/lib/bundler/fetcher/downloader.rb
+++ b/lib/bundler/fetcher/downloader.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Fetcher
class Downloader
diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb
index d8e212989e..9529944391 100644
--- a/lib/bundler/fetcher/index.rb
+++ b/lib/bundler/fetcher/index.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/fetcher/base"
require "rubygems/remote_fetcher"
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index 9caeeee1a5..51dd60c931 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -1,5 +1,6 @@
# encoding: utf-8
# frozen_string_literal: true
+
require "cgi"
require "bundler/vendored_thor"
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 6a0906a200..93ddeede32 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_thor" unless defined?(Thor)
require "bundler"
diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb
index 955834ff01..019ae10c66 100644
--- a/lib/bundler/gem_helpers.rb
+++ b/lib/bundler/gem_helpers.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
module GemHelpers
GENERIC_CACHE = {} # rubocop:disable MutableConstant
diff --git a/lib/bundler/gem_remote_fetcher.rb b/lib/bundler/gem_remote_fetcher.rb
index 481838a5e2..9577535d63 100644
--- a/lib/bundler/gem_remote_fetcher.rb
+++ b/lib/bundler/gem_remote_fetcher.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rubygems/remote_fetcher"
module Bundler
diff --git a/lib/bundler/gem_tasks.rb b/lib/bundler/gem_tasks.rb
index 230e7f28f2..f736517bd7 100644
--- a/lib/bundler/gem_tasks.rb
+++ b/lib/bundler/gem_tasks.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rake/clean"
CLOBBER.include "pkg"
diff --git a/lib/bundler/gem_version_promoter.rb b/lib/bundler/gem_version_promoter.rb
index d60d823d9c..52b5386045 100644
--- a/lib/bundler/gem_version_promoter.rb
+++ b/lib/bundler/gem_version_promoter.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
# This class contains all of the logic for determining the next version of a
# Gem to update to based on the requested level (patch, minor, major).
diff --git a/lib/bundler/gemdeps.rb b/lib/bundler/gemdeps.rb
index 8595b8c7ea..cd4b25d0e6 100644
--- a/lib/bundler/gemdeps.rb
+++ b/lib/bundler/gemdeps.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Gemdeps
def initialize(runtime)
diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb
index e145590430..de6bba0214 100644
--- a/lib/bundler/graph.rb
+++ b/lib/bundler/graph.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "set"
module Bundler
class Graph
diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb
index fd4dea32e7..90521bcfb1 100644
--- a/lib/bundler/index.rb
+++ b/lib/bundler/index.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "set"
module Bundler
diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb
index d0cece2869..7fe6a91ddd 100644
--- a/lib/bundler/injector.rb
+++ b/lib/bundler/injector.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Injector
def self.inject(new_deps, options = {})
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index 00457d604a..a78a4c1f01 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
# Allows for declaring a Gemfile inline in a ruby script, optionally installing
# any gems that aren't already installed on the user's system.
#
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 084c49cb47..e5379513d9 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "erb"
require "rubygems/dependency_installer"
require "bundler/worker"
diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb
index a4d9bcaa07..a9bd0f56a5 100644
--- a/lib/bundler/installer/gem_installer.rb
+++ b/lib/bundler/installer/gem_installer.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class GemInstaller
attr_reader :spec, :standalone, :worker, :force, :installer
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb
index 22bc8c51c6..c8e755d36e 100644
--- a/lib/bundler/installer/parallel_installer.rb
+++ b/lib/bundler/installer/parallel_installer.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/worker"
require "bundler/installer/gem_installer"
diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb
index 03411d85e2..ce0c9df1eb 100644
--- a/lib/bundler/installer/standalone.rb
+++ b/lib/bundler/installer/standalone.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Standalone
def initialize(groups, definition)
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index b4fbba7789..993952c23b 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "uri"
require "bundler/match_platform"
diff --git a/lib/bundler/lockfile_generator.rb b/lib/bundler/lockfile_generator.rb
index 2a29b20f79..585077d18d 100644
--- a/lib/bundler/lockfile_generator.rb
+++ b/lib/bundler/lockfile_generator.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class LockfileGenerator
attr_reader :definition
diff --git a/lib/bundler/match_platform.rb b/lib/bundler/match_platform.rb
index 050cd0efd3..56cbbfb95d 100644
--- a/lib/bundler/match_platform.rb
+++ b/lib/bundler/match_platform.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/gem_helpers"
module Bundler
diff --git a/lib/bundler/mirror.rb b/lib/bundler/mirror.rb
index 8a081ba91f..a6fa070eb8 100644
--- a/lib/bundler/mirror.rb
+++ b/lib/bundler/mirror.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "socket"
module Bundler
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index 66f485ef8e..99c9a867b0 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/plugin/api"
module Bundler
diff --git a/lib/bundler/plugin/api/source.rb b/lib/bundler/plugin/api/source.rb
index 820f9ee874..aadd65e65e 100644
--- a/lib/bundler/plugin/api/source.rb
+++ b/lib/bundler/plugin/api/source.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "uri"
require "digest/sha1"
diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb
index 69d2ae78c5..aeb2b30310 100644
--- a/lib/bundler/psyched_yaml.rb
+++ b/lib/bundler/psyched_yaml.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
# Psych could be a gem, so try to ask for it
begin
gem "psych"
diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb
index 208ee1d4b7..23e1234330 100644
--- a/lib/bundler/remote_specification.rb
+++ b/lib/bundler/remote_specification.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "uri"
module Bundler
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index 39a52b4df8..aa512cb2e9 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Resolver
require "bundler/vendored_molinillo"
diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb
index 092fb866b3..244606dcc9 100644
--- a/lib/bundler/retry.rb
+++ b/lib/bundler/retry.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
# General purpose class for retrying code that may fail
class Retry
diff --git a/lib/bundler/ruby_dsl.rb b/lib/bundler/ruby_dsl.rb
index a410b7f3d7..f6ba220cd5 100644
--- a/lib/bundler/ruby_dsl.rb
+++ b/lib/bundler/ruby_dsl.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
module RubyDsl
def ruby(*ruby_version)
diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb
index f0a001d296..d4e1bdbfd5 100644
--- a/lib/bundler/ruby_version.rb
+++ b/lib/bundler/ruby_version.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class RubyVersion
attr_reader :versions,
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index 0d282a8fcc..e9f0eac355 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "pathname"
if defined?(Gem::QuickLoader)
diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb
index 977e13d948..1d9da0e329 100644
--- a/lib/bundler/rubygems_gem_installer.rb
+++ b/lib/bundler/rubygems_gem_installer.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rubygems/installer"
module Bundler
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index d94abf838f..1ac040dd83 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "monitor"
require "rubygems"
require "rubygems/config_file"
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index c8f5b8496d..c94effd3a8 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "digest/sha1"
module Bundler
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 45934f2944..96e67bfdb4 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "uri"
module Bundler
diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb
index 9aae6478cd..ac6a5bf861 100644
--- a/lib/bundler/setup.rb
+++ b/lib/bundler/setup.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/shared_helpers"
if Bundler::SharedHelpers.in_bundle?
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 339ddeb7de..99b073f542 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "pathname"
require "rubygems"
diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb
index e9c1413ea3..b7f3ee7afa 100644
--- a/lib/bundler/similarity_detector.rb
+++ b/lib/bundler/similarity_detector.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class SimilarityDetector
SimilarityScore = Struct.new(:string, :distance)
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index f3d50adecf..48f73d960e 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Source
autoload :Gemspec, "bundler/source/gemspec"
diff --git a/lib/bundler/source/gemspec.rb b/lib/bundler/source/gemspec.rb
index 05e613277f..7e3447e776 100644
--- a/lib/bundler/source/gemspec.rb
+++ b/lib/bundler/source/gemspec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Source
class Gemspec < Path
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index d1e32946eb..020cf74766 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_fileutils"
require "uri"
require "digest/sha1"
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb
index aa4c125a33..5b09b52a60 100644
--- a/lib/bundler/source/git/git_proxy.rb
+++ b/lib/bundler/source/git/git_proxy.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "shellwords"
require "tempfile"
module Bundler
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 323e60e83e..310a30f1ec 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Source
class Path < Source
diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb
index 9c2f74a31b..64e63766dd 100644
--- a/lib/bundler/source/path/installer.rb
+++ b/lib/bundler/source/path/installer.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Source
class Path
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index e76a00361a..0ac45b3d70 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "uri"
require "rubygems/user_interaction"
diff --git a/lib/bundler/source/rubygems/remote.rb b/lib/bundler/source/rubygems/remote.rb
index e60c1f9055..67f4f373db 100644
--- a/lib/bundler/source/rubygems/remote.rb
+++ b/lib/bundler/source/rubygems/remote.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class Source
class Rubygems
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index 136650e436..dd5a07afd7 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
class SourceList
attr_reader :path_sources,
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb
index e68da87704..5239a96213 100644
--- a/lib/bundler/spec_set.rb
+++ b/lib/bundler/spec_set.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "tsort"
require "forwardable"
require "set"
diff --git a/lib/bundler/ssl_certs/certificate_manager.rb b/lib/bundler/ssl_certs/certificate_manager.rb
index 05de6410be..26fc38ec18 100644
--- a/lib/bundler/ssl_certs/certificate_manager.rb
+++ b/lib/bundler/ssl_certs/certificate_manager.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_fileutils"
require "net/https"
require "openssl"
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb
index aeacf245a3..0dd024024a 100644
--- a/lib/bundler/stub_specification.rb
+++ b/lib/bundler/stub_specification.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/remote_specification"
module Bundler
diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable
index fe22de0a6d..86e73fbbc3 100755
--- a/lib/bundler/templates/Executable
+++ b/lib/bundler/templates/Executable
@@ -1,5 +1,6 @@
#!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>
# frozen_string_literal: true
+
#
# This file was generated by Bundler.
#
diff --git a/lib/bundler/templates/Gemfile b/lib/bundler/templates/Gemfile
index 21c6283123..1afd2cce67 100644
--- a/lib/bundler/templates/Gemfile
+++ b/lib/bundler/templates/Gemfile
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
diff --git a/lib/bundler/templates/gems.rb b/lib/bundler/templates/gems.rb
index 9495f50c0e..6dfb8c0836 100644
--- a/lib/bundler/templates/gems.rb
+++ b/lib/bundler/templates/gems.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
# A sample gems.rb
source "https://rubygems.org"
diff --git a/lib/bundler/ui.rb b/lib/bundler/ui.rb
index 794c000dc4..8138b30d38 100644
--- a/lib/bundler/ui.rb
+++ b/lib/bundler/ui.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
module UI
autoload :RGProxy, "bundler/ui/rg_proxy"
diff --git a/lib/bundler/ui/rg_proxy.rb b/lib/bundler/ui/rg_proxy.rb
index 95a1ecdf0c..e2f98481db 100644
--- a/lib/bundler/ui/rg_proxy.rb
+++ b/lib/bundler/ui/rg_proxy.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/ui"
require "rubygems/user_interaction"
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index e0d0d68aa9..3b3b6bfb53 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_thor"
module Bundler
diff --git a/lib/bundler/ui/silent.rb b/lib/bundler/ui/silent.rb
index 48390b7198..dca1b2ac86 100644
--- a/lib/bundler/ui/silent.rb
+++ b/lib/bundler/ui/silent.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
module UI
class Silent
diff --git a/lib/bundler/uri_credentials_filter.rb b/lib/bundler/uri_credentials_filter.rb
index 997a307533..ee3692268c 100644
--- a/lib/bundler/uri_credentials_filter.rb
+++ b/lib/bundler/uri_credentials_filter.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
module URICredentialsFilter
module_function
diff --git a/lib/bundler/vendored_fileutils.rb b/lib/bundler/vendored_fileutils.rb
index b2522cd5e0..d14e98baf7 100644
--- a/lib/bundler/vendored_fileutils.rb
+++ b/lib/bundler/vendored_fileutils.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler; end
if RUBY_VERSION >= "2.4"
require "bundler/vendor/fileutils/lib/fileutils"
diff --git a/lib/bundler/vendored_molinillo.rb b/lib/bundler/vendored_molinillo.rb
index 7b231263cb..061b634f72 100644
--- a/lib/bundler/vendored_molinillo.rb
+++ b/lib/bundler/vendored_molinillo.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
+
module Bundler; end
require "bundler/vendor/molinillo/lib/molinillo"
diff --git a/lib/bundler/vendored_persistent.rb b/lib/bundler/vendored_persistent.rb
index 729ac6b6f5..ecbf21e30a 100644
--- a/lib/bundler/vendored_persistent.rb
+++ b/lib/bundler/vendored_persistent.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
# We forcibly require OpenSSL, because net/http/persistent will only autoload
# it. On some Rubies, autoload fails but explicit require succeeds.
begin
diff --git a/lib/bundler/vendored_thor.rb b/lib/bundler/vendored_thor.rb
index 4a5d0cf6bb..8cca090f55 100644
--- a/lib/bundler/vendored_thor.rb
+++ b/lib/bundler/vendored_thor.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
def self.require_thor_actions
Kernel.send(:require, "bundler/vendor/thor/lib/thor/actions")
diff --git a/lib/bundler/version_ranges.rb b/lib/bundler/version_ranges.rb
index 1ee8440edd..ec25716cde 100644
--- a/lib/bundler/version_ranges.rb
+++ b/lib/bundler/version_ranges.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Bundler
module VersionRanges
NEq = Struct.new(:version)
diff --git a/lib/bundler/vlad.rb b/lib/bundler/vlad.rb
index db78f84baa..bd2128c73d 100644
--- a/lib/bundler/vlad.rb
+++ b/lib/bundler/vlad.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
# Vlad task for Bundler.
#
# Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb
index b73a7ed04a..e91cfa7805 100644
--- a/lib/bundler/worker.rb
+++ b/lib/bundler/worker.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "thread"
module Bundler
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb
index 3f4ebdd0ac..882d368358 100644
--- a/spec/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler_spec.rb
@@ -1,5 +1,6 @@
# encoding: utf-8
# frozen_string_literal: true
+
require "bundler"
RSpec.describe Bundler do
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 5df50c94ec..1bc1b59610 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/cli"
RSpec.describe "bundle executable" do
diff --git a/spec/bundler/compact_index_client/updater_spec.rb b/spec/bundler/compact_index_client/updater_spec.rb
index d104d6c961..3c4f212b60 100644
--- a/spec/bundler/compact_index_client/updater_spec.rb
+++ b/spec/bundler/compact_index_client/updater_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "net/http"
require "bundler/compact_index_client"
require "bundler/compact_index_client/updater"
diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb
index b9fb178afd..5abf0d9756 100644
--- a/spec/bundler/definition_spec.rb
+++ b/spec/bundler/definition_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/definition"
RSpec.describe Bundler::Definition do
diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb
index f2c534f596..10b6ae1503 100644
--- a/spec/bundler/env_spec.rb
+++ b/spec/bundler/env_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/settings"
RSpec.describe Bundler::Env do
diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb
index 2cce6e2f15..2746da3bd8 100644
--- a/spec/bundler/fetcher_spec.rb
+++ b/spec/bundler/fetcher_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/fetcher"
RSpec.describe Bundler::Fetcher do
diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb
index c5ea3ba52f..2a1be491ef 100644
--- a/spec/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/friendly_errors_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler"
require "bundler/friendly_errors"
require "cgi"
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb
index 1fa749638e..8a2a2c4083 100644
--- a/spec/bundler/gem_helper_spec.rb
+++ b/spec/bundler/gem_helper_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rake"
require "bundler/gem_helper"
diff --git a/spec/bundler/installer/gem_installer_spec.rb b/spec/bundler/installer/gem_installer_spec.rb
index f47382606f..c0eb0a0fec 100644
--- a/spec/bundler/installer/gem_installer_spec.rb
+++ b/spec/bundler/installer/gem_installer_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/installer/gem_installer"
RSpec.describe Bundler::GemInstaller do
diff --git a/spec/bundler/installer/parallel_installer_spec.rb b/spec/bundler/installer/parallel_installer_spec.rb
index 3b50223275..ace5c1a23a 100644
--- a/spec/bundler/installer/parallel_installer_spec.rb
+++ b/spec/bundler/installer/parallel_installer_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/installer/parallel_installer"
RSpec.describe Bundler::ParallelInstaller do
diff --git a/spec/bundler/installer/spec_installation_spec.rb b/spec/bundler/installer/spec_installation_spec.rb
index 811e69bfa1..a9cf09a372 100644
--- a/spec/bundler/installer/spec_installation_spec.rb
+++ b/spec/bundler/installer/spec_installation_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/installer/parallel_installer"
RSpec.describe Bundler::ParallelInstaller::SpecInstallation do
diff --git a/spec/bundler/lockfile_parser_spec.rb b/spec/bundler/lockfile_parser_spec.rb
index adf2322742..3a6d61336f 100644
--- a/spec/bundler/lockfile_parser_spec.rb
+++ b/spec/bundler/lockfile_parser_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/lockfile_parser"
RSpec.describe Bundler::LockfileParser do
diff --git a/spec/bundler/mirror_spec.rb b/spec/bundler/mirror_spec.rb
index f6fff37806..0a8b9f8926 100644
--- a/spec/bundler/mirror_spec.rb
+++ b/spec/bundler/mirror_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/mirror"
RSpec.describe Bundler::Settings::Mirror do
diff --git a/spec/bundler/psyched_yaml_spec.rb b/spec/bundler/psyched_yaml_spec.rb
index 5d92e47aab..d5d68c5cc3 100644
--- a/spec/bundler/psyched_yaml_spec.rb
+++ b/spec/bundler/psyched_yaml_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/psyched_yaml"
RSpec.describe "Bundler::YamlLibrarySyntaxError" do
diff --git a/spec/bundler/ruby_dsl_spec.rb b/spec/bundler/ruby_dsl_spec.rb
index a23ccd39f9..bc1ca98457 100644
--- a/spec/bundler/ruby_dsl_spec.rb
+++ b/spec/bundler/ruby_dsl_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/ruby_dsl"
RSpec.describe Bundler::RubyDsl do
diff --git a/spec/bundler/ruby_version_spec.rb b/spec/bundler/ruby_version_spec.rb
index 9362d0727e..3f30821b5c 100644
--- a/spec/bundler/ruby_version_spec.rb
+++ b/spec/bundler/ruby_version_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/ruby_version"
RSpec.describe "Bundler::RubyVersion and its subclasses" do
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb
index cdc6745d39..378013c444 100644
--- a/spec/bundler/settings_spec.rb
+++ b/spec/bundler/settings_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/settings"
RSpec.describe Bundler::Settings do
diff --git a/spec/bundler/source/rubygems/remote_spec.rb b/spec/bundler/source/rubygems/remote_spec.rb
index 19e466196f..539360d067 100644
--- a/spec/bundler/source/rubygems/remote_spec.rb
+++ b/spec/bundler/source/rubygems/remote_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/source/rubygems/remote"
RSpec.describe Bundler::Source::Rubygems::Remote do
diff --git a/spec/bundler/ssl_certs/certificate_manager_spec.rb b/spec/bundler/ssl_certs/certificate_manager_spec.rb
index 7cf601f6db..2e43193359 100644
--- a/spec/bundler/ssl_certs/certificate_manager_spec.rb
+++ b/spec/bundler/ssl_certs/certificate_manager_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/ssl_certs/certificate_manager"
RSpec.describe Bundler::SSLCerts::CertificateManager do
diff --git a/spec/bundler/version_ranges_spec.rb b/spec/bundler/version_ranges_spec.rb
index a69ab2dc0e..ccbb9285d5 100644
--- a/spec/bundler/version_ranges_spec.rb
+++ b/spec/bundler/version_ranges_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/version_ranges"
RSpec.describe Bundler::VersionRanges do
diff --git a/spec/bundler/worker_spec.rb b/spec/bundler/worker_spec.rb
index 9c73faeba9..2e5642709d 100644
--- a/spec/bundler/worker_spec.rb
+++ b/spec/bundler/worker_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/worker"
RSpec.describe Bundler::Worker do
diff --git a/spec/bundler/yaml_serializer_spec.rb b/spec/bundler/yaml_serializer_spec.rb
index d52fc027bc..abe8554f07 100644
--- a/spec/bundler/yaml_serializer_spec.rb
+++ b/spec/bundler/yaml_serializer_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/yaml_serializer"
RSpec.describe Bundler::YAMLSerializer do
diff --git a/spec/commands/doctor_spec.rb b/spec/commands/doctor_spec.rb
index c785a64923..e1fa98b3d3 100644
--- a/spec/commands/doctor_spec.rb
+++ b/spec/commands/doctor_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "stringio"
require "bundler/cli"
require "bundler/cli/doctor"
diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb
index 56496a0a27..90f6cffeb6 100644
--- a/spec/commands/pristine_spec.rb
+++ b/spec/commands/pristine_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/vendored_fileutils"
RSpec.describe "bundle pristine" do
diff --git a/spec/install/security_policy_spec.rb b/spec/install/security_policy_spec.rb
index f0a488c6b3..7be09d6bd4 100644
--- a/spec/install/security_policy_spec.rb
+++ b/spec/install/security_policy_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rubygems/security"
# unfortunately, testing signed gems with a provided CA is extremely difficult
diff --git a/spec/other/ssl_cert_spec.rb b/spec/other/ssl_cert_spec.rb
index 82d2b76d5b..6d957276fc 100644
--- a/spec/other/ssl_cert_spec.rb
+++ b/spec/other/ssl_cert_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/ssl_certs/certificate_manager"
RSpec.describe "SSL Certificates", :rubygems_master do
diff --git a/spec/realworld/gemfile_source_header_spec.rb b/spec/realworld/gemfile_source_header_spec.rb
index aeb21348fc..59c1916874 100644
--- a/spec/realworld/gemfile_source_header_spec.rb
+++ b/spec/realworld/gemfile_source_header_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "thread"
RSpec.describe "fetching dependencies with a mirrored source", :realworld => true, :rubygems => ">= 2.0" do
diff --git a/spec/realworld/mirror_probe_spec.rb b/spec/realworld/mirror_probe_spec.rb
index 559b7c9ccb..ab74886329 100644
--- a/spec/realworld/mirror_probe_spec.rb
+++ b/spec/realworld/mirror_probe_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "thread"
RSpec.describe "fetching dependencies with a not available mirror", :realworld => true do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 5c7fcbffa5..70a0b5d1f3 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
$:.unshift File.expand_path("..", __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)
diff --git a/spec/support/artifice/compact_index.rb b/spec/support/artifice/compact_index.rb
index f831a4d7a2..bfb6cfd7f0 100644
--- a/spec/support/artifice/compact_index.rb
+++ b/spec/support/artifice/compact_index.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
$LOAD_PATH.unshift Dir[base_system_gems.join("gems/compact_index*/lib")].first.to_s
diff --git a/spec/support/artifice/compact_index_api_missing.rb b/spec/support/artifice/compact_index_api_missing.rb
index 6d15b54b85..d4e68c38e8 100644
--- a/spec/support/artifice/compact_index_api_missing.rb
+++ b/spec/support/artifice/compact_index_api_missing.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_basic_authentication.rb b/spec/support/artifice/compact_index_basic_authentication.rb
index bffb5b9e2b..97aa6cbd84 100644
--- a/spec/support/artifice/compact_index_basic_authentication.rb
+++ b/spec/support/artifice/compact_index_basic_authentication.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_checksum_mismatch.rb b/spec/support/artifice/compact_index_checksum_mismatch.rb
index 4ac328736c..62feb9f164 100644
--- a/spec/support/artifice/compact_index_checksum_mismatch.rb
+++ b/spec/support/artifice/compact_index_checksum_mismatch.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_concurrent_download.rb b/spec/support/artifice/compact_index_concurrent_download.rb
index b788a852cf..972ecb88b7 100644
--- a/spec/support/artifice/compact_index_concurrent_download.rb
+++ b/spec/support/artifice/compact_index_concurrent_download.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_creds_diff_host.rb b/spec/support/artifice/compact_index_creds_diff_host.rb
index 362f407e47..0d349bcc1e 100644
--- a/spec/support/artifice/compact_index_creds_diff_host.rb
+++ b/spec/support/artifice/compact_index_creds_diff_host.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_extra.rb b/spec/support/artifice/compact_index_extra.rb
index 8a87fc4343..84d1859235 100644
--- a/spec/support/artifice/compact_index_extra.rb
+++ b/spec/support/artifice/compact_index_extra.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_extra_api.rb b/spec/support/artifice/compact_index_extra_api.rb
index 844a9ca9f2..903aa900fb 100644
--- a/spec/support/artifice/compact_index_extra_api.rb
+++ b/spec/support/artifice/compact_index_extra_api.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_extra_api_missing.rb b/spec/support/artifice/compact_index_extra_api_missing.rb
index d11793fc2b..e72040f604 100644
--- a/spec/support/artifice/compact_index_extra_api_missing.rb
+++ b/spec/support/artifice/compact_index_extra_api_missing.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index_extra_api", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_extra_missing.rb b/spec/support/artifice/compact_index_extra_missing.rb
index 2af5ce9c27..67a9d23691 100644
--- a/spec/support/artifice/compact_index_extra_missing.rb
+++ b/spec/support/artifice/compact_index_extra_missing.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index_extra", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_forbidden.rb b/spec/support/artifice/compact_index_forbidden.rb
index b25eea94e7..0a4dfdb2e8 100644
--- a/spec/support/artifice/compact_index_forbidden.rb
+++ b/spec/support/artifice/compact_index_forbidden.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_host_redirect.rb b/spec/support/artifice/compact_index_host_redirect.rb
index 6c1ab2def6..ab371117de 100644
--- a/spec/support/artifice/compact_index_host_redirect.rb
+++ b/spec/support/artifice/compact_index_host_redirect.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_no_gem.rb b/spec/support/artifice/compact_index_no_gem.rb
index 0a59e498cd..01c5be1b3d 100644
--- a/spec/support/artifice/compact_index_no_gem.rb
+++ b/spec/support/artifice/compact_index_no_gem.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_partial_update.rb b/spec/support/artifice/compact_index_partial_update.rb
index bf6feab877..eaedff5105 100644
--- a/spec/support/artifice/compact_index_partial_update.rb
+++ b/spec/support/artifice/compact_index_partial_update.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_redirects.rb b/spec/support/artifice/compact_index_redirects.rb
index ff1d3e43bc..e83451b5b6 100644
--- a/spec/support/artifice/compact_index_redirects.rb
+++ b/spec/support/artifice/compact_index_redirects.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_strict_basic_authentication.rb b/spec/support/artifice/compact_index_strict_basic_authentication.rb
index 49a072d2b9..abbf3258e7 100644
--- a/spec/support/artifice/compact_index_strict_basic_authentication.rb
+++ b/spec/support/artifice/compact_index_strict_basic_authentication.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_wrong_dependencies.rb b/spec/support/artifice/compact_index_wrong_dependencies.rb
index 25935f5e5d..7e1d3686e2 100644
--- a/spec/support/artifice/compact_index_wrong_dependencies.rb
+++ b/spec/support/artifice/compact_index_wrong_dependencies.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/compact_index_wrong_gem_checksum.rb b/spec/support/artifice/compact_index_wrong_gem_checksum.rb
index 3a12a59ae7..db4d8e3974 100644
--- a/spec/support/artifice/compact_index_wrong_gem_checksum.rb
+++ b/spec/support/artifice/compact_index_wrong_gem_checksum.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../compact_index", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb b/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb
index f1f8dc5700..12a6fa153f 100644
--- a/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb
+++ b/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint_marshal_fail", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb
index ba763c8248..33e2a9b411 100644
--- a/spec/support/artifice/endpoint.rb
+++ b/spec/support/artifice/endpoint.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../../path.rb", __FILE__)
require File.expand_path("../../../../lib/bundler/deprecate", __FILE__)
include Spec::Path
diff --git a/spec/support/artifice/endpoint_500.rb b/spec/support/artifice/endpoint_500.rb
index 993630b79e..202ccfc829 100644
--- a/spec/support/artifice/endpoint_500.rb
+++ b/spec/support/artifice/endpoint_500.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../../path.rb", __FILE__)
include Spec::Path
diff --git a/spec/support/artifice/endpoint_api_forbidden.rb b/spec/support/artifice/endpoint_api_forbidden.rb
index 21ad9117ed..bb89747adc 100644
--- a/spec/support/artifice/endpoint_api_forbidden.rb
+++ b/spec/support/artifice/endpoint_api_forbidden.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_api_missing.rb b/spec/support/artifice/endpoint_api_missing.rb
index 6f5b5f1323..95db8e2a7e 100644
--- a/spec/support/artifice/endpoint_api_missing.rb
+++ b/spec/support/artifice/endpoint_api_missing.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_basic_authentication.rb b/spec/support/artifice/endpoint_basic_authentication.rb
index 9fafd51a3d..223671bc29 100644
--- a/spec/support/artifice/endpoint_basic_authentication.rb
+++ b/spec/support/artifice/endpoint_basic_authentication.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_creds_diff_host.rb b/spec/support/artifice/endpoint_creds_diff_host.rb
index 6bd1bfec32..925954b12d 100644
--- a/spec/support/artifice/endpoint_creds_diff_host.rb
+++ b/spec/support/artifice/endpoint_creds_diff_host.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_extra.rb b/spec/support/artifice/endpoint_extra.rb
index ed4e87e65f..422f65401b 100644
--- a/spec/support/artifice/endpoint_extra.rb
+++ b/spec/support/artifice/endpoint_extra.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_extra_api.rb b/spec/support/artifice/endpoint_extra_api.rb
index 1e9e1dc60d..62e2c2bb93 100644
--- a/spec/support/artifice/endpoint_extra_api.rb
+++ b/spec/support/artifice/endpoint_extra_api.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_extra_missing.rb b/spec/support/artifice/endpoint_extra_missing.rb
index dc79705a26..038a12610a 100644
--- a/spec/support/artifice/endpoint_extra_missing.rb
+++ b/spec/support/artifice/endpoint_extra_missing.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint_extra", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_fallback.rb b/spec/support/artifice/endpoint_fallback.rb
index 8a85a41784..554c08f0a2 100644
--- a/spec/support/artifice/endpoint_fallback.rb
+++ b/spec/support/artifice/endpoint_fallback.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_host_redirect.rb b/spec/support/artifice/endpoint_host_redirect.rb
index 250416d8cc..cda5664be2 100644
--- a/spec/support/artifice/endpoint_host_redirect.rb
+++ b/spec/support/artifice/endpoint_host_redirect.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_marshal_fail.rb b/spec/support/artifice/endpoint_marshal_fail.rb
index 0fb75ebf31..2a5dcdc2fd 100644
--- a/spec/support/artifice/endpoint_marshal_fail.rb
+++ b/spec/support/artifice/endpoint_marshal_fail.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint_fallback", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_mirror_source.rb b/spec/support/artifice/endpoint_mirror_source.rb
index 9fb58ecb29..64452f198d 100644
--- a/spec/support/artifice/endpoint_mirror_source.rb
+++ b/spec/support/artifice/endpoint_mirror_source.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
class EndpointMirrorSource < Endpoint
diff --git a/spec/support/artifice/endpoint_redirect.rb b/spec/support/artifice/endpoint_redirect.rb
index f80d7600c2..ebf01458ba 100644
--- a/spec/support/artifice/endpoint_redirect.rb
+++ b/spec/support/artifice/endpoint_redirect.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_strict_basic_authentication.rb b/spec/support/artifice/endpoint_strict_basic_authentication.rb
index 4b32cbbf5b..905a519f3f 100644
--- a/spec/support/artifice/endpoint_strict_basic_authentication.rb
+++ b/spec/support/artifice/endpoint_strict_basic_authentication.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/endpoint_timeout.rb b/spec/support/artifice/endpoint_timeout.rb
index f2349bd5c7..3f60471c90 100644
--- a/spec/support/artifice/endpoint_timeout.rb
+++ b/spec/support/artifice/endpoint_timeout.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../endpoint_fallback", __FILE__)
Artifice.deactivate
diff --git a/spec/support/artifice/vcr.rb b/spec/support/artifice/vcr.rb
index dff87e87f1..edd2f49a91 100644
--- a/spec/support/artifice/vcr.rb
+++ b/spec/support/artifice/vcr.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "net/http"
if RUBY_VERSION < "1.9"
begin
diff --git a/spec/support/artifice/windows.rb b/spec/support/artifice/windows.rb
index c18ca454ec..f39b2c6d53 100644
--- a/spec/support/artifice/windows.rb
+++ b/spec/support/artifice/windows.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require File.expand_path("../../path.rb", __FILE__)
include Spec::Path
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index df731adf14..6b15cffe5a 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "bundler/shared_helpers"
require "shellwords"
diff --git a/spec/support/code_climate.rb b/spec/support/code_climate.rb
index 8f1fb35bcd..a15442cabe 100644
--- a/spec/support/code_climate.rb
+++ b/spec/support/code_climate.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Spec
module CodeClimate
def self.setup
diff --git a/spec/support/command_execution.rb b/spec/support/command_execution.rb
index 5b58a52117..5f80334145 100644
--- a/spec/support/command_execution.rb
+++ b/spec/support/command_execution.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "support/helpers"
require "support/path"
diff --git a/spec/support/hax.rb b/spec/support/hax.rb
index 663d3527c5..a3fe041c82 100644
--- a/spec/support/hax.rb
+++ b/spec/support/hax.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rubygems"
module Gem
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 03d9711878..8a81053da7 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Spec
module Helpers
def reset!
diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb
index 1feff7d816..59e879f37a 100644
--- a/spec/support/indexes.rb
+++ b/spec/support/indexes.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Spec
module Indexes
def dep(name, reqs = nil)
diff --git a/spec/support/less_than_proc.rb b/spec/support/less_than_proc.rb
index 27966aa6ed..ddac5458b7 100644
--- a/spec/support/less_than_proc.rb
+++ b/spec/support/less_than_proc.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
class LessThanProc < Proc
attr_accessor :present
diff --git a/spec/support/manpages.rb b/spec/support/manpages.rb
index f6a4a4ab51..ce1f72cc49 100644
--- a/spec/support/manpages.rb
+++ b/spec/support/manpages.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Spec
module Manpages
def self.setup
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index 7316e43684..782257a222 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "forwardable"
require "support/the_bundle"
module Spec
diff --git a/spec/support/path.rb b/spec/support/path.rb
index 2b929003fb..cc9c5b3cad 100644
--- a/spec/support/path.rb
+++ b/spec/support/path.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "pathname"
module Spec
diff --git a/spec/support/permissions.rb b/spec/support/permissions.rb
index f5636dd70a..b21ce3848d 100644
--- a/spec/support/permissions.rb
+++ b/spec/support/permissions.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Spec
module Permissions
def with_umask(new_umask)
diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb
index 61b8066865..002350114b 100644
--- a/spec/support/platforms.rb
+++ b/spec/support/platforms.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Spec
module Platforms
include Bundler::GemHelpers
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index aa16efceb0..3b8cd0cf62 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "rubygems/user_interaction"
require "support/path" unless defined?(Spec::Path)
diff --git a/spec/support/silent_logger.rb b/spec/support/silent_logger.rb
index 1a8f91b3ba..8665beb2c9 100644
--- a/spec/support/silent_logger.rb
+++ b/spec/support/silent_logger.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "logger"
module Spec
class SilentLogger
diff --git a/spec/support/sometimes.rb b/spec/support/sometimes.rb
index 6a50f5ff4c..65a95ed59c 100644
--- a/spec/support/sometimes.rb
+++ b/spec/support/sometimes.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Sometimes
def run_with_retries(example_to_run, retries)
example = RSpec.current_example
diff --git a/spec/support/streams.rb b/spec/support/streams.rb
index 561b29092b..b9e1d292dc 100644
--- a/spec/support/streams.rb
+++ b/spec/support/streams.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "stringio"
def capture(*streams)
diff --git a/spec/support/sudo.rb b/spec/support/sudo.rb
index 8c82bb8c0f..04e9443945 100644
--- a/spec/support/sudo.rb
+++ b/spec/support/sudo.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
module Spec
module Sudo
def self.present?
diff --git a/spec/support/the_bundle.rb b/spec/support/the_bundle.rb
index 742d393425..c994eaae78 100644
--- a/spec/support/the_bundle.rb
+++ b/spec/support/the_bundle.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require "support/helpers"
require "support/path"
diff --git a/task/git_hooks.rake b/task/git_hooks.rake
index e70d66afaa..5c5482caa1 100644
--- a/task/git_hooks.rake
+++ b/task/git_hooks.rake
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
directory ".git/hooks"
file ".git/hooks/pre-commit" => [__FILE__] do |t|