Sha256: 8e8650a214b15a29c69edd6ffbfa7f7d0592f490bd165ba3219fa8343ef5dfc4

Contents?: true

Size: 822 Bytes

Versions: 3

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

module Runger # :nodoc:
  DEFAULT_CONFIGS_PATH = 'config/configs'

  class Railtie < ::Rails::Railtie # :nodoc:
    # Add settings to Rails config
    config.runger_config = Runger::Settings

    config.before_configuration do
      next if ::Rails.application.initialized?

      config.runger_config.autoload_static_config_path = DEFAULT_CONFIGS_PATH
    end

    config.before_eager_load do
      Runger::Settings.autoloader&.eager_load
    end

    # Remove `autoload_static_config_path` from Rails `autoload_paths`
    # since we use our own autoloading mechanism
    initializer 'runger_config.cleanup_autoload' do
      Runger::Settings.cleanup_autoload_paths
    end

    # Make sure loaders are not changed in runtime
    config.after_initialize { Runger.loaders.freeze }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
runger_config-5.2.0 lib/runger/railtie.rb
runger_config-5.1.0 lib/runger/railtie.rb
runger_config-5.0.0 lib/runger/railtie.rb