lib/dry/system/container.rb in dry-system-0.7.1 vs lib/dry/system/container.rb in dry-system-0.7.2

- old
+ new

@@ -2,10 +2,12 @@ require 'dry-auto_inject' require 'dry-configurable' require 'dry-container' +require 'dry/core/deprecations' + require 'dry/system/errors' require 'dry/system/loader' require 'dry/system/booter' require 'dry/system/auto_registrar' require 'dry/system/manual_registrar' @@ -75,10 +77,11 @@ setting :auto_registrar, Dry::System::AutoRegistrar setting :manual_registrar, Dry::System::ManualRegistrar setting :importer, Dry::System::Importer class << self + extend Dry::Core::Deprecations['Dry::System::Container'] # Configures the container # # @example # class MyApp < Dry::System::Container # configure do |config| @@ -237,56 +240,58 @@ # end # # @return [self] frozen container # # @api public - def finalize!(&block) + def finalize!(freeze: true, &block) return self if frozen? yield(self) if block importer.finalize! booter.finalize! manual_registrar.finalize! auto_registrar.finalize! - freeze + self.freeze if freeze end # Boots a specific component # # As a result, `init` and `start` lifecycle triggers are called # # @example - # MyApp.boot!(:persistence) + # MyApp.start(:persistence) # # @param name [Symbol] the name of a registered bootable component # # @return [self] # # @api public - def boot!(name) - booter.boot!(name) + def start(name) + booter.start(name) self end + deprecate :boot!, :start # Boots a specific component but calls only `init` lifecycle trigger # # This way of booting is useful in places where a heavy dependency is # needed but its started environment is not required # # @example - # MyApp.boot(:persistence) + # MyApp.init(:persistence) # # @param [Symbol] name The name of a registered bootable component # # @return [self] # # @api public - def boot(name) - booter.boot(name) + def init(name) + booter.init(name) self end + deprecate :boot, :init # Sets load paths relative to the container's root dir # # @example # class MyApp < Dry::System::Container