Sha256: bc88a377ff4ba44d4af3bd4e6007a0163f39cb041783d75551c4ce562754f647
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
# frozen_string_literal: true module Sail # Engine # Defines initializers and # after initialize hooks class Engine < ::Rails::Engine require "sprockets/railtie" isolate_namespace Sail config.generators do |g| g.test_framework :rspec end config.middleware.use ActionDispatch::Flash config.middleware.use ActionDispatch::Cookies config.middleware.use ActionDispatch::ContentSecurityPolicy::Middleware if defined?(ActionDispatch::ContentSecurityPolicy) config.middleware.use Rack::MethodOverride config.middleware.use Rails::Rack::Logger config.middleware.use Rack::Head config.middleware.use Rack::ConditionalGet config.middleware.use Rack::ETag initializer "sail.assets.precompile" do |app| app.config.assets.precompile += %w[sail/reset.svg sail/sort.svg sail/angle-left.svg sail/angle-right.svg sail/link.svg sail/cog.svg sail/checkmark.svg sail/error.svg sail/application.css sail/application.js] end initializer "sail" do unless Sail.configuration.dashboard_auth_lambda.nil? to_prepare do Sail::SettingsController.before_action(*Sail.configuration.dashboard_auth_lambda) end end end config.after_initialize do errors = [ActiveRecord::NoDatabaseError] errors << PG::ConnectionBad if defined?(PG) config.middleware.use Rails.application.config.session_store || ActionDispatch::Session::CookieStore begin Sail::Setting.load_defaults unless Rails.env.test? rescue *errors warn "Skipping setting creation because database doesn't exist" end end private def to_prepare(&block) klass = defined?(ActiveSupport::Reloader) ? ActiveSupport::Reloader : ActionDispatch::Reloader klass.to_prepare(&block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sail-3.6.0 | lib/sail/engine.rb |