Sha256: 70913d883e1912b6de7ac59a30ba08b3c90b35adad085affc861cbb38d07cd3a

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require "rails"
require "rails/active_expansions"
require 'active_support/ordered_options'
require 'active_assets/active_expansions/reload'

module ActiveAssets
  module ActiveExpansions
    class Railtie < Rails::Railtie
      rake_tasks do
        Dir[File.expand_path("../../../tasks/active_expansions/*.rake", __FILE__)].each {|f| load f}
      end

      config.active_expansions = ActiveSupport::OrderedOptions.new

      initializer 'active_expansion-extend-application' do
        Rails.application.extend(Rails::ActiveExpansions)
      end

      initializer 'active_expansions-set-configs' do
        options = config.active_expansions
        ActiveSupport.on_load(:active_expansions) do
          options.each { |k,v| send("#{k}=", v) }
        end
      end

      initializer 'active_expansions-load-definitions-and-register' do
        ActiveExpansions.load_expansions_and_register

        if ActiveAssets::ActiveExpansions::Expansions.reload_expansions
          ActionController::Base.extend(Reload)
        end
      end

      initializer 'active_expansions-cache' do
        if Expansions.precache_assets
          Rails.application.expansions.javascripts.cache!
          Rails.application.expansions.stylesheets.cache!
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_assets-1.1.3 lib/active_assets/active_expansions/railtie.rb
active_assets-1.1.2 lib/active_assets/active_expansions/railtie.rb
active_assets-1.1.1 lib/active_assets/active_expansions/railtie.rb
active_assets-1.0.3 lib/active_assets/active_expansions/railtie.rb