Sha256: 48f362f44d4b0d0c836b425c47cc466edc400b88d0e45b6fc239987c7e417152

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

module Elastics
  module Rails
    class Engine < ::Rails::Engine

      ActiveSupport.on_load(:before_configuration) do
        config.elastics = Conf
        config.elastics.variables[:index] = [self.class.name.split('::').first.underscore, ::Rails.env].join('_')
        config.elastics.config_file       = ::Rails.root.join('config', 'elastics.yml').to_s
        config.elastics.elastics_dir       = ::Rails.root.join('app', 'elastics').to_s
        config.elastics.logger            = Logger.new(STDOUT)
        config.elastics.logger.level      = ::Logger::DEBUG if ::Rails.env.development?
        config.elastics.result_extenders |= [ Elastics::Result::RailsHelper ]
      end

      ActiveSupport.on_load(:after_initialize) do
        Helper.after_initialize
      end

      rake_tasks do
        Elastics::LIB_PATHS.each do |path|
          task_path = "#{path}/tasks.rake"
          load task_path if File.file?(task_path)
        end
      end

      console do
        config.elastics.logger.log_to_rails_logger = false
        config.elastics.logger.log_to_stderr       = true
        config.elastics.logger.debug_variables     = false
        config.elastics.logger.debug_result        = false
      end

      config.to_prepare do
        Elastics.reload!
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elastics-rails-1.0.4 lib/elastics/rails/engine.rb