Sha256: 03686bfdde84283906b21f01ca5bbc219f8d6cff74c532f9cf923486bc1c27ba

Contents?: true

Size: 1.2 KB

Versions: 16

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require_relative "middleware/url_redirect"

module Koi
  class Engine < ::Rails::Engine
    engine_name "koi"

    initializer "koi.assets" do |app|
      app.middleware.use ::ActionDispatch::Static, "#{root}/public"
      app.middleware.insert_before Rack::Sendfile, Koi::UrlRedirect

      config.after_initialize do |a|
        if a.config.respond_to?(:assets)
          a.config.assets.precompile += %w(koi.js)
        end
      end
    end

    initializer "koi.importmap", before: "importmap" do |app|
      app.config.importmap.paths << root.join("config/importmap.rb")
      app.config.importmap.cache_sweepers << root.join("app/assets/javascripts")
    end

    initializer "koi.factories", after: "factory_bot.set_factory_paths" do
      FactoryBot.definition_file_paths << Engine.root.join("spec/factories") if defined?(FactoryBot)
    end

    config.generators do |g|
      g.test_framework :rspec
      g.fixture_replacement :factory_bot
      g.factory_bot dir: "spec/factories"
    end

    config.to_prepare do
      Katalyst::Navigation::BaseController.include Koi::Controller::IsAdminController
      Katalyst::Navigation::BaseController.helper Koi::Engine.helpers
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katalyst-koi-4.3.2 lib/koi/engine.rb
katalyst-koi-4.3.1 lib/koi/engine.rb
katalyst-koi-4.3.0 lib/koi/engine.rb
katalyst-koi-4.3.0.beta.3 lib/koi/engine.rb
katalyst-koi-4.3.0.beta.2 lib/koi/engine.rb
katalyst-koi-4.2.1 lib/koi/engine.rb
katalyst-koi-4.2.0 lib/koi/engine.rb
katalyst-koi-4.2.0.beta.2 lib/koi/engine.rb
katalyst-koi-4.2.0.beta.1 lib/koi/engine.rb
katalyst-koi-4.1.2 lib/koi/engine.rb
katalyst-koi-4.1.1 lib/koi/engine.rb
katalyst-koi-4.1.0 lib/koi/engine.rb
katalyst-koi-4.0.3 lib/koi/engine.rb
katalyst-koi-4.0.2 lib/koi/engine.rb
katalyst-koi-4.0.1 lib/koi/engine.rb
katalyst-koi-4.0.0 lib/koi/engine.rb