Sha256: 47bf7d66f841638fe92f7dcd66c82a5453474ce8c0104b8a161b32cbe01e2149

Contents?: true

Size: 1.95 KB

Versions: 151

Compression:

Stored size: 1.95 KB

Contents

require "action_controller/railtie"

module Sprockets
  autoload :Bootstrap,      "sprockets/bootstrap"
  autoload :Helpers,        "sprockets/helpers"
  autoload :Compressors,    "sprockets/compressors"
  autoload :LazyCompressor, "sprockets/compressors"
  autoload :NullCompressor, "sprockets/compressors"
  autoload :StaticCompiler, "sprockets/static_compiler"

  # TODO: Get rid of config.assets.enabled
  class Railtie < ::Rails::Railtie
    rake_tasks do
      load "sprockets/assets.rake"
    end

    initializer "sprockets.environment", :group => :all do |app|
      config = app.config
      next unless config.assets.enabled

      require 'sprockets'

      app.assets = Sprockets::Environment.new(app.root.to_s) do |env|
        env.version = ::Rails.env + "-#{config.assets.version}"

        if config.assets.logger != false
          env.logger  = config.assets.logger || ::Rails.logger
        end

        if config.assets.cache_store != false
          env.cache = ActiveSupport::Cache.lookup_store(config.assets.cache_store) || ::Rails.cache
        end
      end

      if config.assets.manifest
        path = File.join(config.assets.manifest, "manifest.yml")
      else
        path = File.join(Rails.public_path, config.assets.prefix, "manifest.yml")
      end

      if File.exist?(path)
        config.assets.digests = YAML.load_file(path)
      end

      ActiveSupport.on_load(:action_view) do
        include ::Sprockets::Helpers::RailsHelper
        app.assets.context_class.instance_eval do
          include ::Sprockets::Helpers::IsolatedHelper
          include ::Sprockets::Helpers::RailsHelper
        end
      end
    end

    # We need to configure this after initialization to ensure we collect
    # paths from all engines. This hook is invoked exactly before routes
    # are compiled, and so that other Railties have an opportunity to
    # register compressors.
    config.after_initialize do |app|
      Sprockets::Bootstrap.new(app).run
    end
  end
end

Version data entries

151 entries across 112 versions & 18 rubygems

Version Path
actionpack-3.2.22.5 lib/sprockets/railtie.rb
actionpack-3.2.22.4 lib/sprockets/railtie.rb
actionpack-3.2.22.3 lib/sprockets/railtie.rb
actionpack-3.2.22.2 lib/sprockets/railtie.rb
actionpack-3.2.22.1 lib/sprockets/railtie.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/railtie.rb
actionpack-3.2.22 lib/sprockets/railtie.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.12/lib/sprockets/railtie.rb
actionpack-3.2.21 lib/sprockets/railtie.rb
actionpack-3.2.20 lib/sprockets/railtie.rb
actionpack-3.2.19 lib/sprockets/railtie.rb
actionpack-3.2.18 lib/sprockets/railtie.rb
actionpack-3.2.17 lib/sprockets/railtie.rb
actionpack-3.2.16 lib/sprockets/railtie.rb
actionpack-3.2.15 lib/sprockets/railtie.rb
actionpack-3.2.15.rc3 lib/sprockets/railtie.rb
actionpack-3.2.15.rc2 lib/sprockets/railtie.rb
actionpack-3.2.15.rc1 lib/sprockets/railtie.rb
actionpack-3.2.14 lib/sprockets/railtie.rb
actionpack-3.2.14.rc2 lib/sprockets/railtie.rb