Sha256: 5b2b3f4021f06975f4a5349bf8a7171191d529b7c9fb153a73af2d25f8e6f553

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module Passages
  # Engine class, subclass of Rails::Engine and the heart of
  #  namespace isolation, asset precompiliation hooks and
  #  authentication concerns.
  class Engine < ::Rails::Engine
    isolate_namespace Passages

    # Necessary for rake assets:precompile in a main application
    #  to compile this Engine's assets as well
    initializer 'passages.assets.precompile' do |app|
      app.config.assets.precompile += %w[application.css application.js]
    end

    # Optionally mount the /passages route at an applications top
    #  level.
    #
    # Optionally allow basic authentication
    initializer 'passages', after: :load_config_initializers do
      if Passages.config.automount
        Rails.application.routes.prepend do
          mount Passages::Engine, at: '/passages'
        end
      end

      unless Passages.config.no_auth?
        Passages::RoutesController.http_basic_authenticate_with(
          name: Passages.username,
          password: Passages.password
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
passages-2.2.0 lib/passages/engine.rb
passages-2.1.0 lib/passages/engine.rb