/scalate-jruby/src/main/resources/haml-3.0.25/lib/haml/railtie.rb

http://github.com/scalate/scalate · Ruby · 21 lines · 17 code · 2 blank · 2 comment · 4 complexity · ef9c36072f327ea15c48c7c5952180ba MD5 · raw file

  1. if Haml::Util.ap_geq_3? && !Haml::Util.ap_geq?("3.0.0.beta4")
  2. raise <<ERROR
  3. Haml and Sass no longer support Rails 3 versions before beta 4.
  4. Please upgrade to Rails 3.0.0.beta4 or later.
  5. ERROR
  6. end
  7. # Rails 3.0.0.beta.2+
  8. if defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load)
  9. require 'haml/template/options'
  10. require 'sass/plugin/configuration'
  11. ActiveSupport.on_load(:before_initialize) do
  12. require 'sass'
  13. require 'sass/plugin'
  14. # Haml requires AV, but Sass doesn't
  15. ActiveSupport.on_load(:action_view) do
  16. Haml.init_rails(binding)
  17. end
  18. end
  19. end