diff --git a/.gitignore b/.gitignore index e2cec12..54a9c34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ haml-2.2.24.gem haml-3.0.17.gem /haml-3.0.25.gem +/haml-3.1.2.gem diff --git a/haml-issue-403-bugfix.patch b/haml-issue-403-bugfix.patch new file mode 100644 index 0000000..6660d09 --- /dev/null +++ b/haml-issue-403-bugfix.patch @@ -0,0 +1,45 @@ +--- lib/haml/helpers/action_view_mods.rb.orig 2011-07-12 14:20:20.000000000 -0400 ++++ lib/haml/helpers/action_view_mods.rb 2011-07-12 14:21:14.000000000 -0400 +@@ -51,10 +51,7 @@ module ActionView + # We've got to do the same thing for compatibility. + + if is_haml? && block_is_haml?(block) +- value = nil +- buffer = capture_haml(*args) { value = yield(*args) } +- return buffer unless buffer.empty? +- return value if value.is_a?(String) ++ capture_haml(*args, &block) + else + capture_without_haml(*args, &block) + end +@@ -88,16 +85,7 @@ module ActionView + module CaptureHelper + def capture_with_haml(*args, &block) + if Haml::Helpers.block_is_haml?(block) +- value = nil +- buffer = capture_haml(*args) { value = yield(*args) } +- str = +- if !buffer.empty? +- buffer +- elsif value.is_a?(String) +- value +- else +- '' +- end ++ str = capture_haml(*args, &block) + return ActionView::NonConcattingString.new(str) if defined?(ActionView::NonConcattingString) + return str + else +--- test/haml/helper_test.rb.orig 2011-07-12 14:21:25.000000000 -0400 ++++ test/haml/helper_test.rb 2011-07-12 14:21:31.000000000 -0400 +@@ -357,10 +357,6 @@ HAML + assert_equal("1\n\n2\n\n3\n\n", render("- trc([1, 2, 3]) do |i|\n = i.inspect")) + end + +- def test_capture_with_string_block +- assert_equal("foo\n", render("= capture { 'foo' }", :action_view)) +- end +- + def test_find_and_preserve_with_block + assert_equal("
Foo Bar\nFoo\nBar\n", + render("= find_and_preserve do\n %pre\n Foo\n Bar\n Foo\n Bar")) diff --git a/rubygem-haml.spec b/rubygem-haml.spec index a5a54f6..a36a8ee 100644 --- a/rubygem-haml.spec +++ b/rubygem-haml.spec @@ -5,13 +5,15 @@ Summary: An elegant, structured XHTML/XML templating engine Name: rubygem-%{gemname} -Version: 3.0.25 +Version: 3.1.2 Release: 1%{?dist} Group: Development/Languages License: MIT and WTFPL URL: http://haml-lang.com/ -Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem + +# interim fix for https://github.com/nex3/haml/issues/403 +Patch0: haml-issue-403-bugfix.patch Requires: rubygems Requires: ruby(abi) = 1.8 @@ -42,6 +44,14 @@ function as a stand-alone templating engine. %prep +%setup -q -c -T +%{__mkdir_p} .%{gemdir} +gem install --local --install-dir .%{gemdir} \ + --force -V --rdoc %{SOURCE0} + +pushd .%{geminstdir} +%patch0 +popd %build @@ -60,10 +70,9 @@ done popd %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{gemdir} -gem install --local --install-dir %{buildroot}%{gemdir} \ - --force --rdoc %{SOURCE0} +mv .%{gemdir}/* %{buildroot}%{gemdir} + mkdir -p %{buildroot}/%{_bindir} mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir} rmdir %{buildroot}%{gemdir}/bin @@ -91,16 +100,10 @@ find %{buildroot}/%{geminstdir} -type f ! -perm /go+r -exec chmod -v go+r {} \; find %{buildroot}%{geminstdir}/bin -type f | \ xargs -n 1 sed -i -e 's"^#!/usr/bin/env ruby"#!/usr/bin/ruby"' -%clean -rm -rf %{buildroot} - %files %defattr(-, root, root, -) %{_bindir}/haml %{_bindir}/html2haml -%{_bindir}/sass -%{_bindir}/css2sass -%{_bindir}/sass-convert %dir %{geminstdir} %{geminstdir}/Rakefile %{geminstdir}/bin @@ -123,6 +126,9 @@ rm -rf %{buildroot} %changelog +* Mon Jul 11 2011 Mo Morsi