lib/hanami/components/components.rb in hanami-1.0.0.beta3 vs lib/hanami/components/components.rb in hanami-1.0.0.rc1
- old
+ new
@@ -26,11 +26,11 @@
prepare do
require 'hanami/logger'
end
resolve do |configuration|
- Hanami::Logger.new(Hanami.environment.project_name, configuration.logger) unless configuration.logger.nil?
+ Hanami::Logger.new(Hanami.environment.project_name, *configuration.logger) unless configuration.logger.nil?
end
end
# Check if code reloading is enabled
#
@@ -76,14 +76,10 @@
# Hanami::Components.resolve('model')
# Hanami::Components['model'] # => nil
register 'model' do
requires 'logger', 'model.configuration', 'model.sql'
- prepare do
- Hanami::Model.disconnect if Components['model.configuration']
- end
-
resolve do
if Components['model.configuration']
Hanami::Model.load!
Hanami::Model.configuration.logger = Components['logger']
true
@@ -180,12 +176,18 @@
require 'hanami/mailer'
require 'hanami/mailer/glue'
end
resolve do |configuration|
- unless configuration.mailer.nil?
- Hanami::Mailer.configuration = Hanami::Mailer::Configuration.new if Hanami.code_reloading?
- Hanami::Mailer.configure(&configuration.mailer)
+ unless configuration.mailer_settings.empty?
+ if Hanami.code_reloading? && !Hanami::Mailer.configuration.nil?
+ Hanami::Mailer.configuration = Hanami::Mailer.configuration.dup
+ end
+
+ configuration.mailer_settings.each do |settings|
+ Hanami::Mailer.configure(&settings)
+ end
+
Hanami::Mailer.configuration
end
end
end