lib/dry/system/booter.rb in dry-system-0.6.0 vs lib/dry/system/booter.rb in dry-system-0.7.0
- old
+ new
@@ -64,23 +64,28 @@
# @api private
def call(name)
container, finalizer = finalizers[name]
- if finalizer
- lifecycle = Lifecycle.new(container, &finalizer)
- yield(lifecycle) if block_given?
- lifecycle
- end
+ raise ComponentFileMismatchError.new(name, registered_booted_keys) unless finalizer
+
+ lifecycle = Lifecycle.new(container, &finalizer)
+ yield(lifecycle) if block_given?
+ lifecycle
end
# @api private
def boot_dependency(component)
boot_file = component.boot_file(path)
boot!(boot_file.basename('.*').to_s.to_sym) if boot_file.exist?
end
private
+
+ # @api private
+ def registered_booted_keys
+ finalizers.keys - booted.keys
+ end
# @api private
def boot_files
path.join('**/*.rb').to_s
end