Sha256: c598a30173b00686834fff5222f2b52037f3a1e9715e78c006c1584c1b0bf919

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 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|
      # Check for a blacklight_install envrionment variable - if set then blacklight
      # is actively being installed and we should not attempt an init at this time.
      if defined?(Rails::Server)
        Blacklight.init
      end      
    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

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-3.0.0pre4 lib/blacklight/engine.rb