Sha256: b6bdb6e40d00028b2500ca3e2846d8854ca0816ca0e1c51b924fd62ac05a6447

Contents?: true

Size: 1.64 KB

Versions: 8

Compression:

Stored size: 1.64 KB

Contents

require 'rails/engine'

module Jax
  class Engine < ::Rails::Engine
    engine_name "jax"
    isolate_namespace Jax
    
    routes do
      root :to => "suite#index"
      match "/:action(/*id)", :controller => "suite"
    end
    
    config.before_configuration do
      config.action_view.javascript_expansions[:jax] ||= [ 'jax', 'jax/application' ]
    end
    
    initializer 'jax.engine' do |app|
      app.config.assets.paths.unshift File.join(app.root, "app/assets/jax")
      app.config.assets.paths.unshift File.join(app.root, "lib/assets/jax")
      app.config.assets.paths.unshift File.join(app.root, "vendor/assets/jax")

      app.assets.register_engine '.resource', Jax::ResourceFile
      app.assets.register_engine '.glsl',     Jax::Shader

      app.assets.unregister_preprocessor 'application/javascript', Sprockets::DirectiveProcessor
      app.assets.register_preprocessor   'application/javascript', Jax::DirectiveProcessor
    end
        
    config.to_prepare do
      ActionController::Base.helper Jax::HelperMethods
    end
    
    config.to_prepare do
      ::Rails.application.assets.each_file do |path|
        path = path.to_s
        if path =~ /javascripts\/shaders\/.*\.ejs$/
          raise "Deprecated shader #{path}.\nTry renaming it to #{path.sub(/\.ejs$/, '.glsl')}."
        elsif path =~ /resources\/.*\.yml$/
          raise "Deprecated resource file #{path}.\nTry renaming it to #{path.sub(/\.yml$/, '.resource')}."
        end
      end unless @already_warned
      
      # only set @already_warned if no errors were raised, that way we ensure that
      # all files are iterated over
      @already_warned = true
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jax-2.0.7 lib/jax/engine.rb
jax-2.0.6 lib/jax/engine.rb
jax-2.0.5 lib/jax/engine.rb
jax-2.0.4 lib/jax/engine.rb
jax-2.0.3 lib/jax/engine.rb
jax-2.0.2 lib/jax/engine.rb
jax-2.0.1 lib/jax/engine.rb
jax-2.0.0 lib/jax/engine.rb