Sha256: 09320e7b7a43f85b00bffbc7ae0a7e30711dc9d17484cde46631d583f8c6383f

Contents?: true

Size: 1.74 KB

Versions: 8

Compression:

Stored size: 1.74 KB

Contents

module MnoEnterprise
  class Engine < ::Rails::Engine
    isolate_namespace MnoEnterprise

    # Autoload all files and sub-directories in
    # lib
    config.autoload_paths += Dir["#{config.root}/lib/**/"]

    # Autoload all translations from config/locales/**/*.yml
    initializer "mnoe.load_locales" do |app|
      # Engine:
      app.config.i18n.load_path += Dir[config.root.join('config', 'locales', '**/*.yml').to_s]

      # Host app:
      app.config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**/*.yml').to_s]
    end

    # Remove testing support when not in test
    unless Rails.env.test?
      path_rejector = lambda { |s| s.include?('/testing_support/') }
      config.autoload_paths.reject!(&path_rejector)
    end

    config.generators do |g|
      g.test_framework :rspec, fixture: true
      g.fixture_replacement :factory_girl, :dir => 'spec/factories'
    end

    # Allow class overriding using decorator pattern
    # See: http://edgeguides.rubyonrails.org/engines.html#overriding-models-and-controllers
    config.to_prepare do
      Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
        require_dependency(c)
      end
    end

    # Add responding to JSON to Devise
    config.to_prepare do
      DeviseController.respond_to :html, :json
    end

    # Use memory store
    config.before_configuration do
      ::Rails.configuration.cache_store = :memory_store, { size: 32.megabytes }
    end

    # Enable ActionController caching
    config.before_initialize do
      Rails.application.config.action_controller.perform_caching = true
    end

    # Make sure the MailAdapter is correctly configured
    config.to_prepare do
      MnoEnterprise::MailClient.adapter ||= MnoEnterprise.mail_adapter
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.3.3 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.3.2 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.2.1 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.3.1 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.3.0 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.2.0 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.1.4 lib/mno_enterprise/engine.rb