lib/dry/system/container.rb in dry-system-0.10.1 vs lib/dry/system/container.rb in dry-system-0.11.0

- old
+ new

@@ -302,10 +302,11 @@ auto_registrar.finalize! @__finalized__ = true self.freeze if freeze + self end # Boots a specific component # # As a result, `init` and `start` lifecycle triggers are called @@ -354,10 +355,15 @@ def stop(name) booter.stop(name) self end + def shutdown! + booter.shutdown + self + end + # Sets load paths relative to the container's root dir # # @example # class MyApp < Dry::System::Container # configure do |config| @@ -554,12 +560,23 @@ unless component.file_exists?(load_paths) raise FileNotFoundError, component end - require component.path + require_path(component.path) yield + end + + # Allows subclasses to use a different strategy for required files. + # + # E.g. apps that use `ActiveSupport::Dependencies::Loadable#require_dependency` + # will override this method to allow container managed dependencies to be reloaded + # for non-finalized containers. + # + # @api private + def require_path(path) + require path end # @api private def load_component(key) return self if key?(key)