lib/hanami/app.rb in hanami-2.1.0 vs lib/hanami/app.rb in hanami-2.2.0.beta1
- old
+ new
@@ -127,11 +127,11 @@
container.config.component_dirs.add(File.join(APP_DIR, LIB_DIR)) do |dir|
dir.namespaces.add_root(key: nil, const: app_name.name)
end
end
- # When auto-registering components in app/, ignore files in `app/lib/` (these will be
+ # When auto-registering components in `app/`, ignore files in `app/lib/` (these will be
# auto-registered as above), as well as the configured no_auto_register_paths
no_auto_register_paths = ([LIB_DIR] + config.no_auto_register_paths)
.map { |path|
path.end_with?(File::SEPARATOR) ? path : "#{path}#{File::SEPARATOR}"
}
@@ -150,17 +150,21 @@
def prepare_app_providers
require_relative "providers/inflector"
register_provider(:inflector, source: Hanami::Providers::Inflector)
# Allow logger to be replaced by users with a manual provider, for advanced cases
- unless container.providers.find_and_load_provider(:logger)
+ unless container.providers[:logger]
require_relative "providers/logger"
register_provider(:logger, source: Hanami::Providers::Logger)
end
if Hanami.bundled?("rack")
require_relative "providers/rack"
register_provider(:rack, source: Hanami::Providers::Rack, namespace: true)
+ end
+
+ if Hanami.bundled?("hanami-db")
+ register_provider(:db_logging, source: Hanami::Providers::DBLogging)
end
end
def prepare_autoloader
# Component dirs are automatically pushed to the autoloader by dry-system's zeitwerk plugin.