Sha256: 7d0c3a952949e3056525323179378f114ce60eed7d206b8e49cade5a74413842

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

require "decidim/dev/needs_development_tools"

module Decidim
  module Dev
    # Decidim's development Rails Engine.
    class Engine < ::Rails::Engine
      isolate_namespace Decidim::Dev
      engine_name "decidim_dev"

      routes do
        root to: proc { [200, {}, ["DUMMY ENGINE"]] }

        resources :dummy_resources do
          resources :nested_dummy_resources
          get :foo, on: :member
        end
      end

      initializer "decidim_dev.tools" do
        # Disable if the boost performance mode is enabled
        next if Rails.application.config.try(:boost_performance)

        ActiveSupport.on_load(:action_controller) { include Decidim::Dev::NeedsDevelopmentTools } if Rails.env.development? || ENV.fetch("DECIDIM_DEV_ENGINE", nil)
      end

      initializer "decidim_dev.webpacker.assets_path" do
        Decidim.register_assets_path File.expand_path("app/packs", root)
      end

      initializer "decidim_dev.middleware.test_map_server" do |app|
        next unless Rails.env.test?

        require "decidim/dev/test/map_server"

        # Add the test map server as the first middleware in the stack
        app.config.middleware.insert_before 0, Decidim::Dev::Test::MapServer
      end

      initializer "decidim_dev.moderation_content" do
        config.to_prepare do
          ActiveSupport::Notifications.subscribe("decidim.admin.block_user:after") do |_event_name, data|
            Decidim::Dev::HideAllCreatedByAuthorJob.perform_later(**data)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-dev-0.29.1 lib/decidim/dev/engine.rb
decidim-dev-0.29.0 lib/decidim/dev/engine.rb
decidim-dev-0.29.0.rc4 lib/decidim/dev/engine.rb
decidim-dev-0.29.0.rc3 lib/decidim/dev/engine.rb
decidim-dev-0.29.0.rc2 lib/decidim/dev/engine.rb
decidim-dev-0.29.0.rc1 lib/decidim/dev/engine.rb