Sha256: 8ff7532ae7814f91806f9632e305d4649a4b0d7f4d73f51a7a8d7b92388291c4

Contents?: true

Size: 821 Bytes

Versions: 30

Compression:

Stored size: 821 Bytes

Contents

# frozen_string_literal: true

module Anyway # :nodoc:
  DEFAULT_CONFIGS_PATH = "config/configs"

  class Railtie < ::Rails::Railtie # :nodoc:
    # Add settings to Rails config
    config.anyway_config = Anyway::Settings

    config.before_configuration do
      next if ::Rails.application.initialized?
      config.anyway_config.autoload_static_config_path = DEFAULT_CONFIGS_PATH
    end

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

    # Remove `autoload_static_config_path` from Rails `autoload_paths`
    # since we use our own autoloading mechanism
    initializer "anyway_config.cleanup_autoload" do
      Anyway::Settings.cleanup_autoload_paths
    end

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

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
anyway_config-2.6.4 lib/anyway/railtie.rb
anyway_config-2.6.3 lib/anyway/railtie.rb
anyway_config-2.6.2 lib/anyway/railtie.rb
anyway_config-2.6.1 lib/anyway/railtie.rb
anyway_config-2.6.0 lib/anyway/railtie.rb
runger_config-3.0.1 lib/anyway/railtie.rb
runger_config-3.0.0 lib/anyway/railtie.rb
runger_config-2.7.0 lib/anyway/railtie.rb
runger_config-2.6.1 lib/anyway/railtie.rb
runger_config-2.6.0 lib/anyway/railtie.rb
anyway_config-2.5.4 lib/anyway/railtie.rb
anyway_config-2.5.3 lib/anyway/railtie.rb
anyway_config-2.5.2 lib/anyway/railtie.rb
anyway_config-2.5.1 lib/anyway/railtie.rb
anyway_config-2.5.0 lib/anyway/railtie.rb
anyway_config-2.4.2 lib/anyway/railtie.rb
anyway_config-2.4.1 lib/anyway/railtie.rb
anyway_config-2.4.0 lib/anyway/railtie.rb
anyway_config-2.3.1 lib/anyway/railtie.rb
anyway_config-2.3.0 lib/anyway/railtie.rb