Sha256: b3c3c36f57eff5619c68a85868c56b6896d11db1ce4e2fe17f19d5da3d8239d6

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

module RailsConfig
  module Integration
    module Rails
      if defined?(::Rails::Railtie)
        class Railtie < ::Rails::Railtie
          # Load rake tasks (eg. Heroku)
          rake_tasks do
            Dir[File.join(File.dirname(__FILE__),'../tasks/*.rake')].each { |f| load f }
          end

          ActiveSupport.on_load :before_configuration, :yield => true do
            # Manually load the custom initializer before everything else
            initializer = ::Rails.root.join("config", "initializers", "rails_config.rb")
            require initializer if File.exist?(initializer)

            # Parse the settings before any of the initializers
            RailsConfig.load_and_set_settings(
              ::Rails.root.join("config", "settings.yml").to_s,
              ::Rails.root.join("config", "settings", "#{::Rails.env}.yml").to_s,
              ::Rails.root.join("config", "environments", "#{::Rails.env}.yml").to_s,

              ::Rails.root.join("config", "settings.local.yml").to_s,
              ::Rails.root.join("config", "settings", "#{::Rails.env}.local.yml").to_s,
              ::Rails.root.join("config", "environments", "#{::Rails.env}.local.yml").to_s
            )
          end

          # Rails Dev environment should reload the Settings on every request
          if ::Rails.env.development?
            initializer :rails_config_reload_on_development do
              ActionController::Base.class_eval do
                prepend_before_filter { ::RailsConfig.reload! }
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_config-0.4.2 lib/rails_config/integration/rails.rb
rails_config-0.4.1 lib/rails_config/integration/rails.rb