Sha256: 6826193de5dc4cc8c08044de9bdc1902df0c3851f79c4b0052bd177ce58ff6a2

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

require 'thebes'
require 'rails'

module Thebes

  class Railtie < Rails::Railtie
    
    rake_tasks do
      load "#{File.dirname(__FILE__)}/../../railties/thebes.rake"
    end

    generators do
      load "#{File.dirname(__FILE__)}/../../railties/sphinx_config_generator.rb"
    end

    initializer "thebes.initialize" do |app|

      config_file = File.join(Rails.root, 'config', 'sphinx_servers.yml')
      if File.exists?(config_file)
        config = YAML.load(ERB.new(IO.read(config_file)).result)[Rails.env.to_s]
        if config['sphinx_api']
          Thebes::Query.servers = config['sphinx_api']
        end
        if config['sphinxql']
          Thebes::Sphinxql::Client.servers = config['sphinxql']
        end
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thebes-0.0.3 lib/thebes/railtie.rb