Sha256: 7d334792d21e27e98d160b4c736b574ff897de91faf6d9ae18dd51add9acdfcc

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

module Blazer
  class Engine < ::Rails::Engine
    isolate_namespace Blazer

    initializer "blazer" do |app|
      # use a proc instead of a string
      app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/application\.(js|css)\z/ }
      app.config.assets.precompile << proc { |path| path =~ /\Ablazer\/.+\.(eot|svg|ttf|woff)\z/ }

      Blazer.time_zone ||= Blazer.settings["time_zone"] || Time.zone
      Blazer.audit = Blazer.settings.key?("audit") ? Blazer.settings["audit"] : true
      Blazer.user_name = Blazer.settings["user_name"] if Blazer.settings["user_name"]
      Blazer.from_email = Blazer.settings["from_email"] if Blazer.settings["from_email"]
      Blazer.subdomain = Blazer.settings["subdomain"] if Blazer.settings["subdomain"]
      Blazer.before_action = Blazer.settings["before_action_method"] if Blazer.settings["before_action_method"]
      Blazer.check_schedules = Blazer.settings["check_schedules"] if Blazer.settings.key?("check_schedules")

      if Blazer.settings.key?("mapbox_access_token")
        Blazer.mapbox_access_token = Blazer.settings["mapbox_access_token"]
      elsif ENV["MAPBOX_ACCESS_TOKEN"].present?
        Blazer.mapbox_access_token = ENV["MAPBOX_ACCESS_TOKEN"]
      end

      if Blazer.user_class
        options = Blazer::BELONGS_TO_OPTIONAL.merge(class_name: Blazer.user_class.to_s)
        Blazer::Query.belongs_to :creator, options
        Blazer::Dashboard.belongs_to :creator, options
        Blazer::Check.belongs_to :creator, options
      end

      Blazer.cache ||= Rails.cache

      Blazer.anomaly_checks = Blazer.settings["anomaly_checks"] || false
      Blazer.async = Blazer.settings["async"] || false
      if Blazer.async
        require "blazer/run_statement_job"
      end

      Blazer.images = Blazer.settings["images"] || false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sql-jarvis-2.0.1 lib/blazer/engine.rb
sql-jarvis-1.9.9 lib/blazer/engine.rb