mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Split up calls to defined? so we don't accidentally load something we don't want to.
This commit is contained in:
parent
98f20b5f20
commit
7ddd9f3581
7 changed files with 18 additions and 7 deletions
|
@ -8,6 +8,9 @@
|
|||
* The `form_tag` Rails helper is now properly marked as HTML-safe
|
||||
when using Rails' XSS protection with Rails 2.3.5.
|
||||
|
||||
* Calls to `defined?` shouldn't interfere with Rails' autoloading
|
||||
in very old versions (1.2.x).
|
||||
|
||||
## 2.2.19
|
||||
|
||||
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.19).
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
rather than letting the exception bubble up.
|
||||
This is consistent with other sorts of sassc corruption handling.
|
||||
|
||||
* Calls to `defined?` shouldn't interfere with Rails' autoloading
|
||||
in very old versions (1.2.x).
|
||||
|
||||
## 2.2.19
|
||||
|
||||
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.18).
|
||||
|
|
|
@ -125,7 +125,7 @@ module ActionView
|
|||
@template_object.send :is_haml?
|
||||
end
|
||||
|
||||
unless defined?(ActionView::Helpers::ActiveRecordInstanceTag)
|
||||
unless defined?(ActionView::Helpers) && defined?(ActionView::Helpers::ActiveRecordInstanceTag)
|
||||
alias_method :content_tag_without_haml, :content_tag
|
||||
alias_method :content_tag, :content_tag_with_haml
|
||||
end
|
||||
|
|
|
@ -46,7 +46,8 @@ end
|
|||
# Decide how we want to load Haml into Rails.
|
||||
# Patching was necessary for versions <= 2.0.1,
|
||||
# but we can make it a normal handler for higher versions.
|
||||
if defined?(ActionView::TemplateHandler) || defined?(ActionView::Template::Handler)
|
||||
if defined?(ActionView::TemplateHandler) ||
|
||||
(defined?(ActionView::Template) && defined?(ActionView::Template::Handler))
|
||||
require 'haml/template/plugin'
|
||||
else
|
||||
require 'haml/template/patch'
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
|
||||
module Haml
|
||||
class Plugin < Haml::Util.av_template_class(:Handler)
|
||||
if defined?(ActionView::TemplateHandlers::Compilable) ||
|
||||
defined?(ActionView::Template::Handlers::Compilable)
|
||||
if (defined?(ActionView::TemplateHandlers) &&
|
||||
defined?(ActionView::TemplateHandlers::Compilable)) ||
|
||||
(defined?(ActionView::Template) &&
|
||||
defined?(ActionView::Template::Handlers) &&
|
||||
defined?(ActionView::Template::Handlers::Compilable))
|
||||
include Haml::Util.av_template_class(:Handlers)::Compilable
|
||||
end
|
||||
|
||||
|
|
|
@ -48,12 +48,12 @@ module Sass
|
|||
# This is automatically done once the Rack plugin is activated.
|
||||
# This is done so that the stylesheets aren't checked twice for each request.
|
||||
def self.disable_native_plugin!
|
||||
if defined?(Merb::Rack::Application) &&
|
||||
if defined?(Merb::Rack) && defined?(Merb::Rack::Application) &&
|
||||
Haml::Util.has?(:instance_method, Merb::Rack::Application, :call_without_sass)
|
||||
Merb::Rack::Application.instance_eval {alias_method :call, :call_without_sass}
|
||||
end
|
||||
|
||||
if defined?(ActionDispatch::Callbacks.to_prepare)
|
||||
if defined?(ActionDispatch::Callbacks) && defined?(ActionDispatch::Callbacks.to_prepare)
|
||||
ActionDispatch::Callbacks.skip_callback(:prepare, :__sass_process)
|
||||
elsif defined?(ActionController::Base) &&
|
||||
Haml::Util.has?(:instance_method, ActionController::Base, :sass_old_process)
|
||||
|
|
|
@ -7,7 +7,8 @@ unless defined?(Sass::RAILS_LOADED)
|
|||
:always_check => Haml::Util.rails_env != "production",
|
||||
:full_exception => Haml::Util.rails_env != "production")
|
||||
|
||||
if defined?(ActionDispatch::Callbacks.to_prepare)
|
||||
if defined?(ActionDispatch::Callbacks) &&
|
||||
defined?(ActionDispatch::Callbacks.to_prepare)
|
||||
# Rails >= 3.0.0
|
||||
ActionDispatch::Callbacks.to_prepare(:sass_process) {Sass::Plugin.check_for_updates}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue