lib/dry/system/auto_registrar.rb in dry-system-0.13.2 vs lib/dry/system/auto_registrar.rb in dry-system-0.14.0

- old
+ new

@@ -54,10 +54,16 @@ .reject { |component| registered?(component.identifier) } end # @api private def files(dir) - ::Dir["#{root}/#{dir}/**/#{RB_GLOB}"].sort + components_dir = File.join(root, dir) + + unless ::Dir.exist?(components_dir) + raise ComponentsDirMissing, "Components dir '#{components_dir}' not found" + end + + ::Dir["#{components_dir}/**/#{RB_GLOB}"].sort end # @api private def relative_path(dir, file_path) dir_root = root.join(dir.to_s.split('/')[0])