class Teaspoon::Engine

Public Class Methods

add_precompiled_assets(assets) click to toggle source
# File lib/teaspoon/engine.rb, line 48
def self.add_precompiled_assets(assets)
  assets.precompile += Teaspoon.configuration.asset_manifest
end
append_asset_paths(assets) click to toggle source
# File lib/teaspoon/engine.rb, line 37
def self.append_asset_paths(assets)
  Teaspoon.configuration.asset_paths.each do |path|
    assets.paths << Teaspoon.configuration.root.join(path).to_s
  end

  # TODO: This breaks lazy loading of frameworks. Another way to avoid this?
  Teaspoon::Framework.available.keys.each do |framework|
    assets.paths += Teaspoon::Framework.fetch(framework).asset_paths
  end
end
default_root_path(root) click to toggle source
# File lib/teaspoon/engine.rb, line 33
def self.default_root_path(root)
  Teaspoon.configuration.root ||= root
end
inject_instrumentation() click to toggle source
# File lib/teaspoon/engine.rb, line 52
def self.inject_instrumentation
  Sprockets::Environment.send(:include, Teaspoon::SprocketsInstrumentation)
  Sprockets::CachedEnvironment.send(:include, Teaspoon::SprocketsInstrumentation)
rescue NameError
  # Handle cached environment in Sprockets 2.x
  Sprockets::Index.send(:include, Teaspoon::SprocketsInstrumentation)
end
prepend_routes(app) click to toggle source
# File lib/teaspoon/engine.rb, line 60
def self.prepend_routes(app)
  mount_at = Teaspoon.configuration.mount_at

  return if app.routes.recognize_path(mount_at)[:action] != "routing_error" rescue nil
  ActiveSupport.on_load(:action_controller) do
    require Teaspoon::Engine.root.join("app/controllers/teaspoon/suite_controller")
  end

  app.routes.prepend { mount Teaspoon::Engine => mount_at, as: "teaspoon" }
end