lib/ecrire/application.rb in ecrire-0.23.0 vs lib/ecrire/application.rb in ecrire-0.24.0

- old
+ new

@@ -5,14 +5,35 @@ require 'observejs' module Ecrire class Application < Rails::Application require 'ecrire/config/environment' - require 'ecrire/railtie' - # Let's not put anything in here. Because Rails instantiate the class as soon as it's defined, - # it's impossible to rely on any declaration made here. - # - # Instead, defined any configuration in config/environment.rb + alias :require_environment! :initialize! + + initializer 'ecrire.secrets', before: :bootstrap_hook do |app| + app.paths.add 'config/secrets', with: Dir.pwd + '/secrets.yml' + end + + Rails.application.paths.add 'config/database', with: Dir.pwd + '/secrets.yml' + + if File.exist?(Dir.pwd + '/secrets.yml') + require 'ecrire/theme/engine' + else + require 'ecrire/onboarding/engine' + end + + def paths + @paths ||= begin + paths = super + paths.add 'config/routes.rb', with: 'routes.rb' + paths.add 'config/locales', with: 'locales', glob: "*.{rb,yml}" + paths + end + end + + def self.onboarding? + defined?(Ecrire::Onboarding::Engine) + end end end