haml-edge 2.3.71 → 2.3.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/haml/template.rb +3 -3
- data/lib/haml/util.rb +13 -0
- data/lib/sass/plugin/rails.rb +3 -3
- data/test/haml/template_test.rb +15 -11
- data/test/test_helper.rb +0 -6
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.72
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.3.
|
|
1
|
+
2.3.72
|
data/lib/haml/template.rb
CHANGED
|
@@ -61,14 +61,14 @@ else
|
|
|
61
61
|
Haml::Template.try_enabling_xss_integration
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
if
|
|
64
|
+
if Haml::Util.rails_root
|
|
65
65
|
# Update init.rb to the current version
|
|
66
66
|
# if it's out of date.
|
|
67
67
|
#
|
|
68
68
|
# We can probably remove this as of v1.9,
|
|
69
69
|
# because the new init file is sufficiently flexible
|
|
70
70
|
# to not need updating.
|
|
71
|
-
rails_init_file = File.join(
|
|
71
|
+
rails_init_file = File.join(Haml::Util.rails_root, 'vendor', 'plugins', 'haml', 'init.rb')
|
|
72
72
|
haml_init_file = Haml::Util.scope('init.rb')
|
|
73
73
|
begin
|
|
74
74
|
if File.exists?(rails_init_file)
|
|
@@ -79,7 +79,7 @@ if defined?(RAILS_ROOT)
|
|
|
79
79
|
warn <<END
|
|
80
80
|
HAML WARNING:
|
|
81
81
|
#{rails_init_file} is out of date and couldn't be automatically updated.
|
|
82
|
-
Please run `haml --rails #{File.expand_path(
|
|
82
|
+
Please run `haml --rails #{File.expand_path(Haml::Util.rails_root)}' to update it.
|
|
83
83
|
END
|
|
84
84
|
end
|
|
85
85
|
end
|
data/lib/haml/util.rb
CHANGED
|
@@ -133,6 +133,19 @@ module Haml
|
|
|
133
133
|
info
|
|
134
134
|
end
|
|
135
135
|
|
|
136
|
+
## Cross Rails Version Compatibility
|
|
137
|
+
|
|
138
|
+
# Returns the root of the Rails application,
|
|
139
|
+
# if this is running in a Rails context.
|
|
140
|
+
# Returns `nil` if no such root is defined.
|
|
141
|
+
#
|
|
142
|
+
# @return [String, nil]
|
|
143
|
+
def rails_root
|
|
144
|
+
return Rails.root if defined?(Rails.root)
|
|
145
|
+
return RAILS_ROOT if defined?(RAILS_ROOT)
|
|
146
|
+
return nil
|
|
147
|
+
end
|
|
148
|
+
|
|
136
149
|
## Rails XSS Safety
|
|
137
150
|
|
|
138
151
|
# Whether or not ActionView's XSS protection is available and enabled,
|
data/lib/sass/plugin/rails.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
unless defined?(Sass::RAILS_LOADED)
|
|
2
2
|
Sass::RAILS_LOADED = true
|
|
3
3
|
|
|
4
|
-
Sass::Plugin.options.merge!(:template_location =>
|
|
5
|
-
:css_location =>
|
|
6
|
-
:cache_location =>
|
|
4
|
+
Sass::Plugin.options.merge!(:template_location => Haml::Util.rails_root + '/public/stylesheets/sass',
|
|
5
|
+
:css_location => Haml::Util.rails_root + '/public/stylesheets',
|
|
6
|
+
:cache_location => Haml::Util.rails_root + '/tmp/sass-cache',
|
|
7
7
|
:always_check => RAILS_ENV != "production",
|
|
8
8
|
:full_exception => RAILS_ENV != "production")
|
|
9
9
|
|
data/test/haml/template_test.rb
CHANGED
|
@@ -144,16 +144,20 @@ class TemplateTest < Test::Unit::TestCase
|
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
if ActionPack::VERSION::MAJOR < 3
|
|
148
|
+
# Rails 3.0.0 deprecates the use of yield with a layout
|
|
149
|
+
# for calls to render :file
|
|
150
|
+
def test_action_view_templates_render_correctly
|
|
151
|
+
proc = lambda do
|
|
152
|
+
@base.content_for(:layout) {'Lorem ipsum dolor sit amet'}
|
|
153
|
+
assert_renders_correctly 'content_for_layout'
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if @base.respond_to?(:with_output_buffer)
|
|
157
|
+
@base.with_output_buffer("", &proc)
|
|
158
|
+
else
|
|
159
|
+
proc.call
|
|
160
|
+
end
|
|
157
161
|
end
|
|
158
162
|
end
|
|
159
163
|
|
|
@@ -203,7 +207,7 @@ HTML
|
|
|
203
207
|
- with_output_buffer do
|
|
204
208
|
bar
|
|
205
209
|
= "foo".gsub(/./) do |s|
|
|
206
|
-
-
|
|
210
|
+
- "flup"
|
|
207
211
|
baz
|
|
208
212
|
HAML
|
|
209
213
|
end
|
data/test/test_helper.rb
CHANGED
|
@@ -9,12 +9,6 @@ require 'sass'
|
|
|
9
9
|
|
|
10
10
|
Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
|
|
11
11
|
|
|
12
|
-
# required because of Sass::Plugin
|
|
13
|
-
unless defined? RAILS_ROOT
|
|
14
|
-
RAILS_ROOT = '.'
|
|
15
|
-
MERB_ENV = RAILS_ENV = 'testing'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
12
|
class Test::Unit::TestCase
|
|
19
13
|
def munge_filename(opts)
|
|
20
14
|
return if opts[:filename]
|