Update to Haml 5.0.1.

f38
Vít Ondruch 8 years ago
parent 6df354a5a9
commit be022e3642

2
.gitignore vendored

@ -1,2 +1,4 @@
haml-3.1.7.gem/haml-4.0.5.gem haml-3.1.7.gem/haml-4.0.5.gem
/haml-4.0.7.gem /haml-4.0.7.gem
/haml-5.0.1-tests.tgz
/haml-5.0.1.gem

@ -1,130 +0,0 @@
From 1f8821ce8bea3d36b1b7fa01730dff5ec0c0377c Mon Sep 17 00:00:00 2001
From: Norman Clarke <norman@njclarke.com>
Date: Mon, 8 Jun 2015 14:55:59 -0300
Subject: [PATCH] Drop support for Rails 3.
---
lib/haml/helpers/action_view_mods.rb | 8 ++---
lib/haml/template/plugin.rb | 2 -
test/helper_test.rb | 52 ++++++++++++-----------------------
3 files changed, 23 insertions(+), 39 deletions(-)
diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb
index b17429d..ad0c13c 100644
--- a/lib/haml/helpers/action_view_mods.rb
+++ b/lib/haml/helpers/action_view_mods.rb
@@ -87,11 +87,9 @@ def is_haml?
end
end
- if ActionPack::VERSION::MAJOR == 4
- module Tags
- class TextArea
- include HamlSupport
- end
+ module Tags
+ class TextArea
+ include HamlSupport
end
end
diff --git a/lib/haml/template/plugin.rb b/lib/haml/template/plugin.rb
index 322e445..6d96aae 100644
--- a/lib/haml/template/plugin.rb
+++ b/lib/haml/template/plugin.rb
@@ -16,7 +16,7 @@ def handles_encoding?; true; end
def compile(template)
options = Haml::Template.options.dup
- if (ActionPack::VERSION::MAJOR >= 4) && template.respond_to?(:type)
+ if template.respond_to?(:type)
options[:mime_type] = template.type
elsif template.respond_to? :mime_type
options[:mime_type] = template.mime_type
diff --git a/test/helper_test.rb b/test/helper_test.rb
index f6293a8..b1f9701 100644
--- a/test/helper_test.rb
+++ b/test/helper_test.rb
@@ -27,6 +27,8 @@
end
class HelperTest < MiniTest::Unit::TestCase
+ TEXT_AREA_CONTENT_REGEX = /<(textarea)[^>]*>\n(.*?)<\/\1>/im
+
Post = Struct.new('Post', :body, :error_field, :errors)
class PostErrors
def on(name)
@@ -157,29 +159,15 @@ def test_pre
render('= content_tag "pre", "Foo bar\n baz"', :action_view))
end
- # Rails >= 3.2.3 adds a newline after opening textarea tags.
- def self.rails_text_area_helpers_emit_a_newline?
- major, minor, tiny = ActionPack::VERSION::MAJOR, ActionPack::VERSION::MINOR, ActionPack::VERSION::TINY
- major == 4 || ((major == 3) && (minor >= 2) && (tiny >= 3))
- end
-
- def text_area_content_regex
- @text_area_content_regex ||= if self.class.rails_text_area_helpers_emit_a_newline?
- /<(textarea)[^>]*>\n(.*?)<\/\1>/im
- else
- /<(textarea)[^>]*>(.*?)<\/\1>/im
- end
- end
-
def test_text_area_tag
output = render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view)
- match_data = output.match(text_area_content_regex)
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
assert_equal "Foo&#x000A;Bar&#x000A; Baz&#x000A; Boom", match_data[2]
end
def test_text_area
output = render('= text_area :post, :body', :action_view)
- match_data = output.match(text_area_content_regex)
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
assert_equal "Foo bar&#x000A;baz", match_data[2]
end
@@ -187,26 +175,24 @@ def test_partials_should_not_cause_textareas_to_be_indented
# non-indentation of textareas rendered inside partials
@base.instance_variable_set('@post', Post.new("Foo", nil, PostErrors.new))
output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
- match_data = output.match(text_area_content_regex)
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
assert_equal 'Foo', match_data[2]
end
- if rails_text_area_helpers_emit_a_newline?
- def test_textareas_should_prerve_leading_whitespace
- # leading whitespace preservation
- @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
- output = render(".foo\n = text_area :post, :body", :action_view)
- match_data = output.match(text_area_content_regex)
- assert_equal '&#x0020; Foo', match_data[2]
- end
-
- def test_textareas_should_prerve_leading_whitespace_in_partials
- # leading whitespace in textareas rendered inside partials
- @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
- output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
- match_data = output.match(text_area_content_regex)
- assert_equal '&#x0020; Foo', match_data[2]
- end
+ def test_textareas_should_prerve_leading_whitespace
+ # leading whitespace preservation
+ @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
+ output = render(".foo\n = text_area :post, :body", :action_view)
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
+ assert_equal '&#x0020; Foo', match_data[2]
+ end
+
+ def test_textareas_should_prerve_leading_whitespace_in_partials
+ # leading whitespace in textareas rendered inside partials
+ @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
+ output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
+ assert_equal '&#x0020; Foo', match_data[2]
end
def test_capture_haml

@ -2,22 +2,23 @@
%global gem_name haml %global gem_name haml
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Version: 4.0.7 Version: 5.0.1
Release: 2%{?dist} Release: 1%{?dist}
Summary: An elegant, structured (X)HTML/XML templating engine Summary: An elegant, structured (X)HTML/XML templating engine
Group: Development/Languages
License: MIT and WTFPL License: MIT and WTFPL
URL: http://haml.info/ URL: http://haml.info/
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Fix compatibility with recent Ruby on Rails (but drop RoR 3 support). # git clone https://github.com/haml/haml.git && cd haml
# https://github.com/haml/haml/commit/1f8821ce8bea3d36b1b7fa01730dff5ec0c0377c.patch # git checkout v5.0.1 && tar czvf haml-5.0.1-tests.tgz test/
Patch0: rubygem-haml-4.11.x-Drop-support-for-Rails-3.patch Source1: %{gem_name}-%{version}-tests.tgz
BuildRequires: ruby(release) BuildRequires: ruby(release)
BuildRequires: rubygems-devel BuildRequires: rubygems-devel
BuildRequires: ruby BuildRequires: ruby
BuildRequires: rubygem(activemodel)
BuildRequires: rubygem(minitest) BuildRequires: rubygem(minitest)
BuildRequires: rubygem(tilt)
BuildRequires: rubygem(railties) BuildRequires: rubygem(railties)
BuildRequires: rubygem(temple)
BuildRequires: rubygem(tilt)
BuildArch: noarch BuildArch: noarch
%description %description
@ -30,7 +31,6 @@ function as a stand-alone templating engine.
%package doc %package doc
Summary: Documentation for %{name} Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
BuildArch: noarch BuildArch: noarch
@ -44,11 +44,6 @@ gem unpack %{SOURCE0}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
# Bump the Rails dependency, just for sure.
sed -i '/rails/ s/3.2.0/4.0.0/' %{gem_name}.gemspec
%patch0 -p1
%build %build
gem build %{gem_name}.gemspec gem build %{gem_name}.gemspec
@ -61,17 +56,16 @@ cp -a .%{gem_dir}/* \
mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_bindir}
cp -pa .%{_bindir}/* \ cp -a .%{_bindir}/* \
%{buildroot}%{_bindir}/ %{buildroot}%{_bindir}/
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
# Fix the permissions.
# https://github.com/haml/haml/commit/70978595f5534c6fa4bd407edb6c4248f5e50554
chmod -x %{buildroot}%{gem_libdir}/haml/*.rb
%check %check
pushd .%{gem_instdir} pushd .%{gem_instdir}
# Move test into the place.
tar xzvf %{SOURCE1}
# Get rid of Bundler. # Get rid of Bundler.
sed -i '/bundler/ s/^/#/' test/test_helper.rb sed -i '/bundler/ s/^/#/' test/test_helper.rb
@ -84,6 +78,7 @@ popd
%exclude %{gem_instdir}/.* %exclude %{gem_instdir}/.*
%license %{gem_instdir}/MIT-LICENSE %license %{gem_instdir}/MIT-LICENSE
%{gem_instdir}/bin %{gem_instdir}/bin
%exclude %{gem_instdir}/haml.gemspec
%{gem_libdir} %{gem_libdir}
%exclude %{gem_cache} %exclude %{gem_cache}
%{gem_spec} %{gem_spec}
@ -92,12 +87,19 @@ popd
%doc %{gem_docdir} %doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md %doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/FAQ.md %doc %{gem_instdir}/FAQ.md
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/README.md %doc %{gem_instdir}/README.md
%doc %{gem_instdir}/REFERENCE.md %doc %{gem_instdir}/REFERENCE.md
%{gem_instdir}/Rakefile %{gem_instdir}/Rakefile
%doc %{gem_instdir}/TODO
%{gem_instdir}/benchmark.rb
%{gem_instdir}/test %{gem_instdir}/test
%{gem_instdir}/yard
%changelog %changelog
* Tue Jul 18 2017 Vít Ondruch <vondruch@redhat.com> - 5.0.1-1
- Update to Haml 5.0.1.
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.7-2 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

@ -1 +1,2 @@
54301683936cdf3678f5c513dab3871c haml-4.0.7.gem SHA512 (haml-5.0.1-tests.tgz) = 81782831437545c0f1023bd285a768ef3344c408eb6d492cb4ef9e7a34fa9cffbccf1d9ddacd2502113884e6e43903b4fb22a184f2d69ab458a5661301dbdd79
SHA512 (haml-5.0.1.gem) = 9300a810ae7dc30556c177b2eb75f67f0304cbe521ddfa212c6b0f90a193e49c3b78aaefef998fd2a8f9092c945fa54d2613910bc77f4c893febf5e874c81103

Loading…
Cancel
Save