Sha256: c5a134ea8662abcc17d13d67c16df806ceed32ed7ff48a9fe8e8741f17ca4dc9

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

# lib/blacklight/engine.rb
require "blacklight"
require "rails"

module Blackight
  class Engine < Rails::Engine

    # BlacklightHelper is needed by all helpers, so we inject it
    # into action view base here. 
    initializer 'blacklight.helpers' do |app|
      ActionView::Base.send :include, BlacklightHelper
    end

    # Go ahead and innitialize Blacklight at the very end of the rails 
    # innitilization process.  
    # See: http://www.cowboycoded.com/2010/08/02/hooking-in-your-rails-3-engine-or-railtie-initializer-in-the-right-place/
    initializer 'blacklight.init', :after=> :disable_dependency_loading do |app|
      # Note, check for configuration files before calling init, 
      # otherwise we can't generate these files with the Generator
      # and we can't tell at this point if we are begin run as a generator
      # or not (at least, I didn't see a way)
      Blacklight.init if File.exists?(Blacklight.solr_file)      
    end

    # This makes our rake tasks visible.
    rake_tasks do
      Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '..'))) do
        Dir.glob(File.join('railties', '*.rake')).each do |railtie|
          load railtie
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-3.0.0pre3 lib/blacklight/engine.rb
blacklight-3.0pre2 lib/blacklight/engine.rb