haml 3.0.10 → 3.0.11
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/lib/haml/exec.rb +4 -1
- data/lib/haml/util.rb +9 -29
- data/lib/sass/plugin/rails.rb +2 -1
- data/test/haml/helper_test.rb +4 -2
- data/test/haml/templates/helpers.haml +1 -1
- data/test/test_helper.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.11
|
data/lib/haml/exec.rb
CHANGED
@@ -700,7 +700,10 @@ END
|
|
700
700
|
private
|
701
701
|
|
702
702
|
def process_directory
|
703
|
-
input = @options[:input] = @args.shift
|
703
|
+
unless input = @options[:input] = @args.shift
|
704
|
+
raise "Error: directory required when using --recursive."
|
705
|
+
end
|
706
|
+
|
704
707
|
output = @options[:output] = @args.shift
|
705
708
|
raise "Error: --from required when using --recursive." unless @options[:from]
|
706
709
|
raise "Error: --to required when using --recursive." unless @options[:to]
|
data/lib/haml/util.rb
CHANGED
@@ -291,42 +291,22 @@ module Haml
|
|
291
291
|
#
|
292
292
|
# @return [Boolean]
|
293
293
|
def ap_geq_3?
|
294
|
-
|
295
|
-
return false unless defined?(ActionPack) && defined?(ActionPack::VERSION)
|
296
|
-
|
297
|
-
version =
|
298
|
-
if defined?(ActionPack::VERSION::MAJOR)
|
299
|
-
ActionPack::VERSION::MAJOR
|
300
|
-
else
|
301
|
-
# Rails 1.2
|
302
|
-
ActionPack::VERSION::Major
|
303
|
-
end
|
304
|
-
|
305
|
-
version >= 3
|
294
|
+
ap_geq?("3.0.0.beta1")
|
306
295
|
end
|
307
296
|
|
308
297
|
# Returns whether this environment is using ActionPack
|
309
|
-
# version
|
298
|
+
# of a version greater than or equal to that specified.
|
310
299
|
#
|
300
|
+
# @param version [String] The string version number to check against.
|
301
|
+
# Should be greater than or equal to Rails 3,
|
302
|
+
# because otherwise ActionPack::VERSION isn't autoloaded
|
311
303
|
# @return [Boolean]
|
312
|
-
def
|
304
|
+
def ap_geq?(version)
|
313
305
|
# The ActionPack module is always loaded automatically in Rails >= 3
|
314
|
-
return false unless defined?(ActionPack) && defined?(ActionPack::VERSION)
|
306
|
+
return false unless defined?(ActionPack) && defined?(ActionPack::VERSION) &&
|
307
|
+
defined?(ActionPack::VERSION::STRING)
|
315
308
|
|
316
|
-
version
|
317
|
-
if defined?(ActionPack::VERSION::MAJOR)
|
318
|
-
ActionPack::VERSION::MAJOR
|
319
|
-
else
|
320
|
-
# Rails 1.2
|
321
|
-
ActionPack::VERSION::Major
|
322
|
-
end
|
323
|
-
version >= 3 &&
|
324
|
-
((defined?(ActionPack::VERSION::TINY) &&
|
325
|
-
ActionPack::VERSION::TINY.is_a?(Fixnum) &&
|
326
|
-
ActionPack::VERSION::TINY >= 1) ||
|
327
|
-
(defined?(ActionPack::VERSION::BUILD) &&
|
328
|
-
ActionPack::VERSION::BUILD =~ /beta(\d+)/ &&
|
329
|
-
$1.to_i >= 3))
|
309
|
+
ActionPack::VERSION::STRING >= version
|
330
310
|
end
|
331
311
|
|
332
312
|
# Returns an ActionView::Template* class.
|
data/lib/sass/plugin/rails.rb
CHANGED
@@ -12,7 +12,8 @@ unless defined?(Sass::RAILS_LOADED)
|
|
12
12
|
if defined?(ActionController::Metal)
|
13
13
|
# Rails >= 3.0
|
14
14
|
require 'sass/plugin/rack'
|
15
|
-
Rails.
|
15
|
+
Rails.application.instance_variable_set('@app',
|
16
|
+
Sass::Plugin::Rack.new(Rails.application.app))
|
16
17
|
elsif defined?(ActionController::Dispatcher) &&
|
17
18
|
defined?(ActionController::Dispatcher.middleware)
|
18
19
|
# Rails >= 2.3
|
data/test/haml/helper_test.rb
CHANGED
@@ -165,9 +165,10 @@ 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.ap_geq?("3.0.0.beta4") ? "field_with_errors" : "fieldWithErrors"
|
168
169
|
assert_equal(<<HTML, render(<<HAML, :action_view))
|
169
170
|
<form action="" method="post">
|
170
|
-
<div class="
|
171
|
+
<div class="#{error_class}"><label for="post_error_field">Error field</label></div>
|
171
172
|
</form>
|
172
173
|
HTML
|
173
174
|
#{rails_block_helper_char} form_for #{form_for_calling_convention('post')}, :url => '' do |f|
|
@@ -314,7 +315,8 @@ HAML
|
|
314
315
|
end
|
315
316
|
|
316
317
|
def test_indented_capture
|
317
|
-
|
318
|
+
prior = Haml::Util.ap_geq?("3.0.0.beta4") ? "" : " \n"
|
319
|
+
assert_equal("#{prior} Foo\n ", @base.render(:inline => " <% res = capture do %>\n Foo\n <% end %><%= res %>"))
|
318
320
|
end
|
319
321
|
|
320
322
|
def test_capture_deals_properly_with_collections
|
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.0.0.beta3")
|
69
69
|
return ":#{name}, @#{name}"
|
70
70
|
end
|
71
71
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 3
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 3.0.
|
8
|
+
- 11
|
9
|
+
version: 3.0.11
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nathan Weizenbaum
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-06-
|
19
|
+
date: 2010-06-09 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|