From 11f45c7e78e7bd04224551e7930af1888a03d228 Mon Sep 17 00:00:00 2001 From: Antonio Tapiador del Dujo Date: Thu, 28 Nov 2024 13:32:45 +0100 Subject: [PATCH] Rename public/ folder Follow the standard Ruby structure of lib/gem_name This also helps us to understand the difference between resource_registry and schema_registry at first sight --- lib/resource_registry.rb | 14 ++++---- .../capabilities/capability_config.rb | 0 .../capability_factory.rb | 0 .../configuration.rb | 0 .../entity_finder.rb | 0 .../load_resources_from_cache.rb | 0 lib/{public => resource_registry}/registry.rb | 0 .../relationship.rb | 0 .../relationship_type.rb | 0 .../relationship_type_factory.rb | 0 .../relationship_types/belongs_to.rb | 0 .../relationship_types/has_many.rb | 0 .../relationship_types/has_many_through.rb | 0 .../relationship_types/has_one.rb | 0 .../repositories/base.rb | 0 lib/{public => resource_registry}/resource.rb | 0 .../resource_struct_builder.rb | 0 .../serializer.rb | 0 lib/{public => resource_registry}/verb.rb | 0 lib/{public => resource_registry}/versions.rb | 0 .../versions/version.rb | 0 lib/schema_registry/property.rb | 2 +- resource_registry.gemspec | 34 +++++++++++-------- spec/capability_factory_spec.rb | 2 +- spec/dummy_repo.rb | 2 +- .../registry_spec.rb | 2 +- .../relationship_spec.rb | 2 +- .../resource_spec.rb | 2 +- .../versions_spec.rb | 2 +- spec/resource_struct_builder_spec.rb | 2 +- 30 files changed, 34 insertions(+), 30 deletions(-) rename lib/{public => resource_registry}/capabilities/capability_config.rb (100%) rename lib/{public => resource_registry}/capability_factory.rb (100%) rename lib/{public => resource_registry}/configuration.rb (100%) rename lib/{public => resource_registry}/entity_finder.rb (100%) rename lib/{public => resource_registry}/load_resources_from_cache.rb (100%) rename lib/{public => resource_registry}/registry.rb (100%) rename lib/{public => resource_registry}/relationship.rb (100%) rename lib/{public => resource_registry}/relationship_type.rb (100%) rename lib/{public => resource_registry}/relationship_type_factory.rb (100%) rename lib/{public => resource_registry}/relationship_types/belongs_to.rb (100%) rename lib/{public => resource_registry}/relationship_types/has_many.rb (100%) rename lib/{public => resource_registry}/relationship_types/has_many_through.rb (100%) rename lib/{public => resource_registry}/relationship_types/has_one.rb (100%) rename lib/{public => resource_registry}/repositories/base.rb (100%) rename lib/{public => resource_registry}/resource.rb (100%) rename lib/{public => resource_registry}/resource_struct_builder.rb (100%) rename lib/{public => resource_registry}/serializer.rb (100%) rename lib/{public => resource_registry}/verb.rb (100%) rename lib/{public => resource_registry}/versions.rb (100%) rename lib/{public => resource_registry}/versions/version.rb (100%) rename spec/{public => resource_registry}/registry_spec.rb (97%) rename spec/{public => resource_registry}/relationship_spec.rb (93%) rename spec/{public => resource_registry}/resource_spec.rb (98%) rename spec/{public => resource_registry}/versions_spec.rb (98%) diff --git a/lib/resource_registry.rb b/lib/resource_registry.rb index 54132e7..6f13009 100644 --- a/lib/resource_registry.rb +++ b/lib/resource_registry.rb @@ -3,17 +3,17 @@ require "sorbet-runtime" -require "public/configuration" -require "public/resource" -require "public/versions" -require "public/versions/version" -require "public/entity_finder" +require "resource_registry/configuration" +require "resource_registry/resource" +require "resource_registry/versions" +require "resource_registry/versions/version" +require "resource_registry/entity_finder" require "schema_registry/json_schema_mapper" require "schema_registry/maybe" require "schema_registry/generate_from_struct" require "runtime_generic" -require "public/resource_struct_builder" -require "public/registry" +require "resource_registry/resource_struct_builder" +require "resource_registry/registry" # Entry point for ResourceRegistry module ResourceRegistry diff --git a/lib/public/capabilities/capability_config.rb b/lib/resource_registry/capabilities/capability_config.rb similarity index 100% rename from lib/public/capabilities/capability_config.rb rename to lib/resource_registry/capabilities/capability_config.rb diff --git a/lib/public/capability_factory.rb b/lib/resource_registry/capability_factory.rb similarity index 100% rename from lib/public/capability_factory.rb rename to lib/resource_registry/capability_factory.rb diff --git a/lib/public/configuration.rb b/lib/resource_registry/configuration.rb similarity index 100% rename from lib/public/configuration.rb rename to lib/resource_registry/configuration.rb diff --git a/lib/public/entity_finder.rb b/lib/resource_registry/entity_finder.rb similarity index 100% rename from lib/public/entity_finder.rb rename to lib/resource_registry/entity_finder.rb diff --git a/lib/public/load_resources_from_cache.rb b/lib/resource_registry/load_resources_from_cache.rb similarity index 100% rename from lib/public/load_resources_from_cache.rb rename to lib/resource_registry/load_resources_from_cache.rb diff --git a/lib/public/registry.rb b/lib/resource_registry/registry.rb similarity index 100% rename from lib/public/registry.rb rename to lib/resource_registry/registry.rb diff --git a/lib/public/relationship.rb b/lib/resource_registry/relationship.rb similarity index 100% rename from lib/public/relationship.rb rename to lib/resource_registry/relationship.rb diff --git a/lib/public/relationship_type.rb b/lib/resource_registry/relationship_type.rb similarity index 100% rename from lib/public/relationship_type.rb rename to lib/resource_registry/relationship_type.rb diff --git a/lib/public/relationship_type_factory.rb b/lib/resource_registry/relationship_type_factory.rb similarity index 100% rename from lib/public/relationship_type_factory.rb rename to lib/resource_registry/relationship_type_factory.rb diff --git a/lib/public/relationship_types/belongs_to.rb b/lib/resource_registry/relationship_types/belongs_to.rb similarity index 100% rename from lib/public/relationship_types/belongs_to.rb rename to lib/resource_registry/relationship_types/belongs_to.rb diff --git a/lib/public/relationship_types/has_many.rb b/lib/resource_registry/relationship_types/has_many.rb similarity index 100% rename from lib/public/relationship_types/has_many.rb rename to lib/resource_registry/relationship_types/has_many.rb diff --git a/lib/public/relationship_types/has_many_through.rb b/lib/resource_registry/relationship_types/has_many_through.rb similarity index 100% rename from lib/public/relationship_types/has_many_through.rb rename to lib/resource_registry/relationship_types/has_many_through.rb diff --git a/lib/public/relationship_types/has_one.rb b/lib/resource_registry/relationship_types/has_one.rb similarity index 100% rename from lib/public/relationship_types/has_one.rb rename to lib/resource_registry/relationship_types/has_one.rb diff --git a/lib/public/repositories/base.rb b/lib/resource_registry/repositories/base.rb similarity index 100% rename from lib/public/repositories/base.rb rename to lib/resource_registry/repositories/base.rb diff --git a/lib/public/resource.rb b/lib/resource_registry/resource.rb similarity index 100% rename from lib/public/resource.rb rename to lib/resource_registry/resource.rb diff --git a/lib/public/resource_struct_builder.rb b/lib/resource_registry/resource_struct_builder.rb similarity index 100% rename from lib/public/resource_struct_builder.rb rename to lib/resource_registry/resource_struct_builder.rb diff --git a/lib/public/serializer.rb b/lib/resource_registry/serializer.rb similarity index 100% rename from lib/public/serializer.rb rename to lib/resource_registry/serializer.rb diff --git a/lib/public/verb.rb b/lib/resource_registry/verb.rb similarity index 100% rename from lib/public/verb.rb rename to lib/resource_registry/verb.rb diff --git a/lib/public/versions.rb b/lib/resource_registry/versions.rb similarity index 100% rename from lib/public/versions.rb rename to lib/resource_registry/versions.rb diff --git a/lib/public/versions/version.rb b/lib/resource_registry/versions/version.rb similarity index 100% rename from lib/public/versions/version.rb rename to lib/resource_registry/versions/version.rb diff --git a/lib/schema_registry/property.rb b/lib/schema_registry/property.rb index 777b2d9..8c8fde0 100644 --- a/lib/schema_registry/property.rb +++ b/lib/schema_registry/property.rb @@ -5,7 +5,7 @@ require "bigdecimal" require_relative "property_type" require_relative "maybe" -require_relative "../public/versions/version" +require_relative "../resource_registry/versions/version" module SchemaRegistry class Property < T::Struct diff --git a/resource_registry.gemspec b/resource_registry.gemspec index 5d24fa9..f1d2abb 100644 --- a/resource_registry.gemspec +++ b/resource_registry.gemspec @@ -1,19 +1,23 @@ Gem::Specification.new do |s| - s.name = 'resource_registry' - s.version = '0.0.0' - s.summary = 'Resource Registry' - s.description = 'A declarative approach to define resources and their relationships' - s.authors = ['Genar Trias Ortiz'] - s.email = 'genar.factorial@factorial.co' - s.files = ['lib/resource_registry.rb', 'lib/public/repositories/base.rb', 'rbi/resource_registry.rbi'] - s.homepage = - 'https://rubygems.org/gems/resource_registry' - s.license = 'MIT' - s.add_dependency 'sorbet-coerce', '>= 0.2.6' + s.name = "resource_registry" + s.version = "0.0.0" + s.summary = "Resource Registry" + s.description = + "A declarative approach to define resources and their relationships" + s.authors = ["Genar Trias Ortiz"] + s.email = "genar.factorial@factorial.co" + s.files = %w[ + lib/resource_registry.rb + lib/resource_registry/repositories/base.rb + rbi/resource_registry.rbi + ] + s.homepage = "https://rubygems.org/gems/resource_registry" + s.license = "MIT" + s.add_dependency "sorbet-coerce", ">= 0.2.6" # s.add_runtime_dependency 'sorbet-runtime-stub', '0.2.0' - s.add_development_dependency 'sorbet', '0.5.11609' - s.add_runtime_dependency 'activesupport', '>= 7.1.3' - s.add_runtime_dependency 'dry-inflector', '>= 0.1.2' - s.add_runtime_dependency 'sorbet-runtime', '0.5.11609' + s.add_development_dependency "sorbet", "0.5.11609" + s.add_runtime_dependency "activesupport", ">= 7.1.3" + s.add_runtime_dependency "dry-inflector", ">= 0.1.2" + s.add_runtime_dependency "sorbet-runtime", "0.5.11609" # s.add_development_dependency 'tapioca' end diff --git a/spec/capability_factory_spec.rb b/spec/capability_factory_spec.rb index 1262aa1..f86a0c9 100644 --- a/spec/capability_factory_spec.rb +++ b/spec/capability_factory_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" require_relative "./dummy_capability" -require_relative "../lib/public/capability_factory" +require_relative "../lib/resource_registry/capability_factory" RSpec.describe ResourceRegistry::CapabilityFactory do let(:capability) { described_class } diff --git a/spec/dummy_repo.rb b/spec/dummy_repo.rb index 50237ca..87e471c 100644 --- a/spec/dummy_repo.rb +++ b/spec/dummy_repo.rb @@ -1,6 +1,6 @@ # typed: false -require_relative "../lib/public/repositories/base" +require_relative "../lib/resource_registry/repositories/base" class DummyEntity < T::Struct const :id, Integer diff --git a/spec/public/registry_spec.rb b/spec/resource_registry/registry_spec.rb similarity index 97% rename from spec/public/registry_spec.rb rename to spec/resource_registry/registry_spec.rb index 203ed4a..ea1d243 100644 --- a/spec/public/registry_spec.rb +++ b/spec/resource_registry/registry_spec.rb @@ -1,7 +1,7 @@ # typed: false require "spec_helper" -require_relative "../../lib/public/registry" +require_relative "../../lib/resource_registry/registry" require_relative "../dummy_repo" class DummyCapability < T::Struct diff --git a/spec/public/relationship_spec.rb b/spec/resource_registry/relationship_spec.rb similarity index 93% rename from spec/public/relationship_spec.rb rename to spec/resource_registry/relationship_spec.rb index c14cefb..6f0fbe6 100644 --- a/spec/public/relationship_spec.rb +++ b/spec/resource_registry/relationship_spec.rb @@ -2,7 +2,7 @@ # typed: false require "spec_helper" -require_relative "../../lib/public/relationship" +require_relative "../../lib/resource_registry/relationship" RSpec.describe ResourceRegistry::Relationship do describe "#load" do diff --git a/spec/public/resource_spec.rb b/spec/resource_registry/resource_spec.rb similarity index 98% rename from spec/public/resource_spec.rb rename to spec/resource_registry/resource_spec.rb index a0f864f..5a5cfb0 100644 --- a/spec/public/resource_spec.rb +++ b/spec/resource_registry/resource_spec.rb @@ -1,7 +1,7 @@ # typed: false require "spec_helper" -require_relative "../../lib/public/resource" +require_relative "../../lib/resource_registry/resource" require_relative "../dummy_repo" require_relative "../dummy_capability" require_relative "../void_capability" diff --git a/spec/public/versions_spec.rb b/spec/resource_registry/versions_spec.rb similarity index 98% rename from spec/public/versions_spec.rb rename to spec/resource_registry/versions_spec.rb index 03a972c..b3debb4 100644 --- a/spec/public/versions_spec.rb +++ b/spec/resource_registry/versions_spec.rb @@ -2,7 +2,7 @@ # typed: false require "spec_helper" -require_relative "../../lib/public/versions" +require_relative "../../lib/resource_registry/versions" RSpec.describe ResourceRegistry::Versions do subject { described_class.new(versions: versions) } diff --git a/spec/resource_struct_builder_spec.rb b/spec/resource_struct_builder_spec.rb index 518c88e..b1b4243 100644 --- a/spec/resource_struct_builder_spec.rb +++ b/spec/resource_struct_builder_spec.rb @@ -2,7 +2,7 @@ # typed: false require "spec_helper" -require_relative "../lib/public/resource_struct_builder" +require_relative "../lib/resource_registry/resource_struct_builder" module ResourceRegistry module DtoBuilderSpec