Sha256: 1be5e1dc3356bbe65eb770ecf47c7a2c8151a60ee6f7c7666d0b334df8ab2f88

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true
require_dependency 'thredded/main_app_route_delegator'
module Thredded
  class Engine < ::Rails::Engine
    isolate_namespace Thredded

    %w(app/view_models app/forms app/commands app/jobs lib).each do |path|
      config.autoload_paths << File.expand_path("../../#{path}", File.dirname(__FILE__))
    end

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

    config.to_prepare do
      if Thredded.user_class
        Thredded.user_class.send(:include, Thredded::UserExtender)
      end

      unless Thredded.standalone_layout?
        # Delegate all main_app routes to allow calling them directly.
        ::Thredded::ApplicationController.helper ::Thredded::MainAppRouteDelegator
      end
    end

    initializer 'thredded.setup_assets' do
      Thredded::Engine.config.assets.precompile += %w(
        thredded.js
        thredded.css
        thredded/*.svg
      )
    end

    initializer 'thredded.setup_bbcoder' do
      BBCoder.configure do
        tag :img, match: %r{^https?://.*(png|bmp|jpe?g|gif)$}, singular: false do
          %(<img src="#{singular? ? meta : content}" />)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thredded-0.3.1 lib/thredded/engine.rb
thredded-0.3.0 lib/thredded/engine.rb