Sha256: b6bbf079000359dd18ca2b1ad6a4b4ae725e08c1f72ef0eca14a95ed7826f23a

Contents?: true

Size: 1.75 KB

Versions: 2

Compression:

Stored size: 1.75 KB

Contents

require "action_view"
require "postgresql/check"
require "devise"
require "haml-rails"
require "jquery-rails"
require "material_design_lite-sass"
require "pundit"
require "redis-rails"
require "rolify"
require "sass-rails"
require "simple_form"
require "turbolinks"

module Jobshop
  class Engine < ::Rails::Engine
    isolate_namespace Jobshop

    config.generators do |g|
      g.test_framework :rspec, view_specs: false
      g.helper false
      g.javascripts false
    end

    initializer "jobshop.append_migrations_paths", before: :load_config_initializers do
      config.paths["db/migrate"].expanded.each do |expanded_path|
        Rails.application.config.paths["db/migrate"] << expanded_path
      end
    end

    initializer "jobshop.redis_session_store" do
      Rails.application.config.session_store(:redis_store, {
        servers: Jobshop.configuration.session_store_url
      })
    end

    initializer "jobshop.action_mailer.default_url_options" do
      config.action_mailer.default_url_options = {
        host: Jobshop.configuration.mailer_host
      }
    end

    initializer "jobshop.active_sessions", after: :load_config_initializers do
      Warden::Manager.after_set_user except: :fetch do |user, warden, opts|
        SessionActivation.deactivate(warden.raw_session["activation_token"])
        warden.raw_session["activation_token"] = user.activate_session
      end

      Warden::Manager.after_fetch do |user, warden, opts|
        unless user.session_active?(warden.raw_session["activation_token"])
          warden.logout
          throw :warden, message: :unauthenticated
        end
      end

      Warden::Manager.before_logout do |user, warden, opts|
        SessionActivation.deactivate warden.raw_session["activation_token"]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jobshop-0.0.131 lib/jobshop/engine.rb
jobshop-0.0.127 lib/jobshop/engine.rb