From 4bfe8a5905bffb3c5d261bf52d1d618386f706cc Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Fri, 14 Oct 2022 15:50:48 +0200 Subject: [PATCH] Zeitwerkify --- lib/dry/system.rb | 3 +-- lib/dry/system/auto_registrar.rb | 1 - lib/dry/system/component.rb | 4 +--- lib/dry/system/component_dir.rb | 3 --- lib/dry/system/config/component_dir.rb | 2 -- lib/dry/system/config/component_dirs.rb | 1 - lib/dry/system/config/namespace.rb | 1 - lib/dry/system/config/namespaces.rb | 1 - lib/dry/system/container.rb | 15 --------------- lib/dry/system/identifier.rb | 2 +- lib/dry/system/importer.rb | 2 +- lib/dry/system/loader/autoloading.rb | 2 -- lib/dry/system/provider.rb | 3 +-- lib/dry/system/provider_registrar.rb | 8 ++++---- lib/dry/system/provider_source_registry.rb | 3 +-- .../system/provider_sources/settings/config.rb | 2 -- spec/spec_helper.rb | 2 +- 17 files changed, 11 insertions(+), 44 deletions(-) diff --git a/lib/dry/system.rb b/lib/dry/system.rb index fa66f5bb0..e68bab1c8 100644 --- a/lib/dry/system.rb +++ b/lib/dry/system.rb @@ -2,7 +2,6 @@ require "zeitwerk" require "dry/core" -require_relative "system/provider_source_registry" module Dry module System @@ -15,7 +14,7 @@ def self.loader loader.push_dir(root) loader.ignore( "#{root}/dry-system.rb", - "#{root}/dry/system/{constants,errors,stubs,version}.rb" + "#{root}/dry/system/{constants,errors,plugins,stubs,version}.rb" ) loader.inflector.inflect("dsl" => "DSL") end diff --git a/lib/dry/system/auto_registrar.rb b/lib/dry/system/auto_registrar.rb index 2ee874d8a..492436070 100644 --- a/lib/dry/system/auto_registrar.rb +++ b/lib/dry/system/auto_registrar.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "dry/system/constants" -require_relative "component" module Dry module System diff --git a/lib/dry/system/component.rb b/lib/dry/system/component.rb index 28c8c8424..fc8a72e03 100644 --- a/lib/dry/system/component.rb +++ b/lib/dry/system/component.rb @@ -1,11 +1,9 @@ # frozen_string_literal: true +require "pathname" require "dry/inflector" -require "dry/system/loader" require "dry/system/errors" require "dry/system/constants" -require "pathname" -require_relative "identifier" module Dry module System diff --git a/lib/dry/system/component_dir.rb b/lib/dry/system/component_dir.rb index a36ec10d8..5bf78a22a 100644 --- a/lib/dry/system/component_dir.rb +++ b/lib/dry/system/component_dir.rb @@ -2,9 +2,6 @@ require "pathname" require "dry/system/constants" -require_relative "constants" -require_relative "identifier" -require_relative "magic_comments_parser" module Dry module System diff --git a/lib/dry/system/config/component_dir.rb b/lib/dry/system/config/component_dir.rb index 8f1f5f064..0f98870f1 100644 --- a/lib/dry/system/config/component_dir.rb +++ b/lib/dry/system/config/component_dir.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true require "dry/system/constants" -require "dry/system/loader" -require_relative "namespaces" module Dry module System diff --git a/lib/dry/system/config/component_dirs.rb b/lib/dry/system/config/component_dirs.rb index e54d453eb..d64ec000f 100644 --- a/lib/dry/system/config/component_dirs.rb +++ b/lib/dry/system/config/component_dirs.rb @@ -2,7 +2,6 @@ require "dry/system/constants" require "dry/system/errors" -require_relative "component_dir" module Dry module System diff --git a/lib/dry/system/config/namespace.rb b/lib/dry/system/config/namespace.rb index 9c89c49a8..db2edcb10 100644 --- a/lib/dry/system/config/namespace.rb +++ b/lib/dry/system/config/namespace.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "dry/core/equalizer" require "dry/system/constants" module Dry diff --git a/lib/dry/system/config/namespaces.rb b/lib/dry/system/config/namespaces.rb index ee9600249..c5ca5abbb 100644 --- a/lib/dry/system/config/namespaces.rb +++ b/lib/dry/system/config/namespaces.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "dry/system/errors" -require_relative "namespace" module Dry module System diff --git a/lib/dry/system/container.rb b/lib/dry/system/container.rb index dc9fde9f1..35a9487a5 100644 --- a/lib/dry/system/container.rb +++ b/lib/dry/system/container.rb @@ -5,24 +5,9 @@ require "dry/configurable" require "dry/auto_inject" require "dry/container" -require "dry/core" require "dry/inflector" -require "dry/system/auto_registrar" -require "dry/system/component" -require "dry/system/constants" -require "dry/system/errors" -require "dry/system/identifier" -require "dry/system/importer" -require "dry/system/indirect_component" -require "dry/system/manifest_registrar" require "dry/system/plugins" -require "dry/system/provider_registrar" -require "dry/system/provider" -require "dry/system/provider/source" - -require_relative "component_dir" -require_relative "config/component_dirs" module Dry module System diff --git a/lib/dry/system/identifier.rb b/lib/dry/system/identifier.rb index ed17aec4d..c7f62b1dc 100644 --- a/lib/dry/system/identifier.rb +++ b/lib/dry/system/identifier.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative "constants" +require "dry/system/constants" module Dry module System diff --git a/lib/dry/system/importer.rb b/lib/dry/system/importer.rb index 6b5c67178..a8df3f2fc 100644 --- a/lib/dry/system/importer.rb +++ b/lib/dry/system/importer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "dry/container" -require_relative "constants" +require "dry/system/constants" module Dry module System diff --git a/lib/dry/system/loader/autoloading.rb b/lib/dry/system/loader/autoloading.rb index 42bc34a97..24669cb40 100644 --- a/lib/dry/system/loader/autoloading.rb +++ b/lib/dry/system/loader/autoloading.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative "../loader" - module Dry module System class Loader diff --git a/lib/dry/system/provider.rb b/lib/dry/system/provider.rb index f242b95d9..4c0f79a09 100644 --- a/lib/dry/system/provider.rb +++ b/lib/dry/system/provider.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -require_relative "constants" -require_relative "provider/source" +require "dry/system/constants" module Dry module System diff --git a/lib/dry/system/provider_registrar.rb b/lib/dry/system/provider_registrar.rb index 5dda25f46..69397b40c 100644 --- a/lib/dry/system/provider_registrar.rb +++ b/lib/dry/system/provider_registrar.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -require "dry/system" require "pathname" -require_relative "errors" -require_relative "constants" -require_relative "provider" + +require "dry/system" +require "dry/system/errors" +require "dry/system/constants" module Dry module System diff --git a/lib/dry/system/provider_source_registry.rb b/lib/dry/system/provider_source_registry.rb index fc2a2f4b7..76236e01e 100644 --- a/lib/dry/system/provider_source_registry.rb +++ b/lib/dry/system/provider_source_registry.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -require_relative "constants" -require_relative "provider/source" +require "dry/system/constants" module Dry module System diff --git a/lib/dry/system/provider_sources/settings/config.rb b/lib/dry/system/provider_sources/settings/config.rb index fff00fb10..37e3b03e4 100644 --- a/lib/dry/system/provider_sources/settings/config.rb +++ b/lib/dry/system/provider_sources/settings/config.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative "loader" - module Dry module System module ProviderSources diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index eb74b94fd..8f1beeacd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,7 +14,7 @@ Dir[SPEC_ROOT.join("support/*.rb").to_s].sort.each { |f| require f } Dir[SPEC_ROOT.join("shared/*.rb").to_s].sort.each { |f| require f } -require "dry/system/container" +require "dry/system" require "dry/system/stubs" require "dry/events" require "dry/types"