Sha256: 041a76e93137118928d1a02513c399d34a70c0d8976968fa099cc304c898186c

Contents?: true

Size: 1.9 KB

Versions: 27

Compression:

Stored size: 1.9 KB

Contents

require 'rails'

module Bastion
  class Engine < ::Rails::Engine

    isolate_namespace Bastion

    initializer 'bastion.assets_dispatcher', :before => :build_middleware_stack do |app|
      app.middleware.use ::ActionDispatch::Static, "#{Bastion::Engine.root}/app/assets/javascripts/bastion"
    end

    initializer 'bastion.mount_engine', :after => :build_middleware_stack do |app|
      app.routes_reloader.paths << "#{Bastion::Engine.root}/config/routes/mount_engine.rb"
      app.routes_reloader.paths.unshift("#{Bastion::Engine.root}/config/routes.rb")
    end

    initializer "bastion.assets", :group => :all do |app|
      app.config.assets.paths << "#{Bastion::Engine.root}/vendor/assets/stylesheets/bastion"
    end

    initializer "bastion.configure_assets", :group => :all do |app|
      SETTINGS[:bastion] = {:assets => {}} if SETTINGS[:bastion].nil?
      SETTINGS[:bastion][:assets] = {} if SETTINGS[:bastion][:assets].nil?

      SETTINGS[:bastion][:assets][:precompile] = [
        'bastion/bastion.css',
        'bastion/bastion.js',
      ]

      locale_files = Dir.glob("#{Bastion::Engine.root}/vendor/assets/javascripts/#{Bastion.localization_path("*")}")
      locale_files.map do |file|
        file.gsub!("#{Bastion::Engine.root}/vendor/assets/javascripts/", "")
      end

      SETTINGS[:bastion][:assets][:precompile].concat(locale_files)
    end

    initializer 'bastion.assets.precompile', :after => 'bastion.configure_assets' do |app|
      app.config.assets.precompile += SETTINGS[:bastion][:assets][:precompile]
    end

    initializer "angular_templates", :group => :all do |app|
      app.config.angular_templates.ignore_prefix = %w([bastion]*\/+)
    end

    initializer 'bastion.register_plugin', :before => :finisher_hook do
      Foreman::Plugin.register :bastion do
        requires_foreman '>= 1.15'
      end
    end

    rake_tasks do
      load "#{Bastion::Engine.root}/Rakefile"
    end

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
bastion-6.1.22 lib/bastion/engine.rb
bastion-6.1.21 lib/bastion/engine.rb
bastion-6.1.20 lib/bastion/engine.rb
bastion-6.1.19 lib/bastion/engine.rb
bastion-6.1.18 lib/bastion/engine.rb
bastion-6.1.17 lib/bastion/engine.rb
bastion-6.1.16 lib/bastion/engine.rb
bastion-6.1.15 lib/bastion/engine.rb
bastion-6.1.14 lib/bastion/engine.rb
bastion-6.1.13 lib/bastion/engine.rb
bastion-6.1.12 lib/bastion/engine.rb
bastion-6.1.11 lib/bastion/engine.rb
bastion-6.1.10 lib/bastion/engine.rb
bastion-6.1.9 lib/bastion/engine.rb
bastion-6.1.8 lib/bastion/engine.rb
bastion-6.1.7 lib/bastion/engine.rb
bastion-6.1.6 lib/bastion/engine.rb
bastion-6.1.5 lib/bastion/engine.rb
bastion-6.1.4 lib/bastion/engine.rb
bastion-6.1.3 lib/bastion/engine.rb