haml-edge 3.1.40 → 3.1.41
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/haml/railtie.rb +13 -21
- data/lib/sass/plugin/rails.rb +1 -20
- data/test/haml/helper_test.rb +2 -2
- data/test/test_helper.rb +1 -1
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.41
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.41
|
data/lib/haml/railtie.rb
CHANGED
@@ -1,29 +1,21 @@
|
|
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
|
+
|
1
8
|
# Rails 3.0.0.beta.2+
|
2
9
|
if defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load)
|
3
10
|
require 'haml/template/options'
|
4
11
|
require 'sass/plugin/configuration'
|
5
|
-
ActiveSupport.on_load(:
|
6
|
-
|
12
|
+
ActiveSupport.on_load(:before_initialize) do
|
13
|
+
require 'sass'
|
14
|
+
require 'sass/plugin'
|
15
|
+
|
16
|
+
# Haml requires AV, but Sass doesn't
|
17
|
+
ActiveSupport.on_load(:action_view) do
|
7
18
|
Haml.init_rails(binding)
|
8
|
-
else
|
9
|
-
# I can't believe we have to do this, but we do.
|
10
|
-
# Rails 3's lovely lazy-loading means that it's possible to load ActionView
|
11
|
-
# before the application has even begin loading.
|
12
|
-
# This means that Rails.root doesn't exist yet.
|
13
|
-
# So if the application isn't loaded, we use this arcane initializer stuff
|
14
|
-
# to load Haml/Sass *after* the application loads.
|
15
|
-
#
|
16
|
-
# Of course, it's also possible that the application is loaded before ActionView,
|
17
|
-
# so we can't *just* rely on this method of loading.
|
18
|
-
#
|
19
|
-
# Ugh.
|
20
|
-
module Haml
|
21
|
-
class Railtie < Rails::Railtie
|
22
|
-
initializer :haml do
|
23
|
-
Haml.init_rails(binding)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
19
|
end
|
28
20
|
end
|
29
21
|
end
|
data/lib/sass/plugin/rails.rb
CHANGED
@@ -1,13 +1,4 @@
|
|
1
1
|
unless defined?(Sass::RAILS_LOADED)
|
2
|
-
if Haml::Util.ap_geq_3? && !Haml::Util.ap_geq?("3.0.0.beta4")
|
3
|
-
Haml::Util.haml_warn(<<WARNING)
|
4
|
-
DEPRECATION WARNING:
|
5
|
-
Haml/Sass support for Rails 3 versions before beta 4 is deprecated,
|
6
|
-
and will be removed in Haml/Sass 3.0.13.
|
7
|
-
Please upgrade to Rails 3.0.0.beta4 or later.
|
8
|
-
WARNING
|
9
|
-
end
|
10
|
-
|
11
2
|
Sass::RAILS_LOADED = true
|
12
3
|
|
13
4
|
# Reverse-merging (we're in Rails, anyway) so we dont' clobber what's already been defined further up-stream
|
@@ -21,17 +12,7 @@ WARNING
|
|
21
12
|
if defined?(ActionController::Metal)
|
22
13
|
# Rails >= 3.0
|
23
14
|
require 'sass/plugin/rack'
|
24
|
-
|
25
|
-
# The application has already been built,
|
26
|
-
# so we need to hack the middleware in
|
27
|
-
Rails.application.instance_variable_set('@app',
|
28
|
-
Sass::Plugin::Rack.new(Rails.application.app))
|
29
|
-
else
|
30
|
-
# The application hasn't been built yet,
|
31
|
-
# so we can just add Sass::Plugin::Rack
|
32
|
-
# to the pending middleware stack.
|
33
|
-
Rails.configuration.middleware.use(Sass::Plugin::Rack)
|
34
|
-
end
|
15
|
+
Rails.configuration.middleware.use(Sass::Plugin::Rack)
|
35
16
|
elsif defined?(ActionController::Dispatcher) &&
|
36
17
|
defined?(ActionController::Dispatcher.middleware)
|
37
18
|
# Rails >= 2.3
|
data/test/haml/helper_test.rb
CHANGED
@@ -165,7 +165,7 @@ HAML
|
|
165
165
|
|
166
166
|
def test_content_tag_error_wrapping
|
167
167
|
def @base.protect_against_forgery?; false; end
|
168
|
-
error_class = Haml::Util.
|
168
|
+
error_class = Haml::Util.ap_geq_3? ? "field_with_errors" : "fieldWithErrors"
|
169
169
|
assert_equal(<<HTML, render(<<HAML, :action_view))
|
170
170
|
<form action="" method="post">
|
171
171
|
<div class="#{error_class}"><label for="post_error_field">Error field</label></div>
|
@@ -315,7 +315,7 @@ HAML
|
|
315
315
|
end
|
316
316
|
|
317
317
|
def test_indented_capture
|
318
|
-
prior = Haml::Util.
|
318
|
+
prior = Haml::Util.ap_geq_3? ? "" : " \n"
|
319
319
|
assert_equal("#{prior} Foo\n ", @base.render(:inline => " <% res = capture do %>\n Foo\n <% end %><%= res %>"))
|
320
320
|
end
|
321
321
|
|
data/test/test_helper.rb
CHANGED
@@ -65,7 +65,7 @@ class Test::Unit::TestCase
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def form_for_calling_convention(name)
|
68
|
-
return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.
|
68
|
+
return "@#{name}, :as => :#{name}, :html => {:class => nil, :id => nil}" if Haml::Util.ap_geq_3?
|
69
69
|
return ":#{name}, @#{name}"
|
70
70
|
end
|
71
71
|
end
|