Sha256: d6aa71b79525f25981597ac9cff4823394a5cfeeb59b5aa33a89b164dba899b7

Contents?: true

Size: 1.59 KB

Versions: 12

Compression:

Stored size: 1.59 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
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mno-enterprise-core-3.0.7 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.1.3 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.0.6 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.1.2 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.0.5 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.1.1 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.0.4 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.1.0 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.0.3 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.0.2 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.0.1 lib/mno_enterprise/engine.rb
mno-enterprise-core-3.0.0 lib/mno_enterprise/engine.rb