Sha256: a13f7b5b7a0346e5af35bb0077bc7dbd8e3b787b44ed6f3b67d0cde299035bb1

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# encoding: utf-8

module OpenSesame
  class Engine < ::Rails::Engine
    isolate_namespace OpenSesame

    config.generators do |g|
      g.test_framework :rspec, :view_specs => false
    end

    ActiveSupport.on_load(:action_controller) do
      include OpenSesame::Helpers::ControllerHelper
    end

    ActiveSupport.on_load(:action_view) do
      include OpenSesame::Helpers::ViewHelper
    end

    initializer "opensesame.precompile" do |app|
      app.config.assets.precompile += ['open_sesame/opensesame.css']
    end

    initializer "opensesame.middleware", :after => :load_config_initializers do |app|
      if OpenSesame.enabled?
        require 'open_sesame/github_warden'
        app.config.middleware.use OpenSesame::GithubAuth,
          OpenSesame.github_application[:client_id],
          OpenSesame.github_application[:client_secret],
          :path_prefix => OpenSesame.mount_prefix

        if defined?(Devise)
          require 'open_sesame/devise'
        else
          app.config.middleware.use ::Warden::Manager do |manager|
            manager.default_strategies(:opensesame_github, :scope => :opensesame)
            manager.failure_app = OpenSesame::Failure::App.new
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opensesame-0.4.0 lib/open_sesame/engine.rb