Update to Haml 4.0.7.

f38
Vít Ondruch 8 years ago
parent 11ae151034
commit 51b29d53e2

1
.gitignore vendored

@ -1 +1,2 @@
haml-3.1.7.gem/haml-4.0.5.gem
/haml-4.0.7.gem

@ -1,169 +0,0 @@
diff --git a/test/engine_test.rb b/test/engine_test.rb
index 3b47217..5049340 100644
--- a/test/engine_test.rb
+++ b/test/engine_test.rb
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
require 'test_helper'
-class EngineTest < MiniTest::Unit::TestCase
+class EngineTest < Haml::TestCase
# A map of erroneous Haml documents to the error messages they should produce.
# The error messages may be arrays;
# if so, the second element should be the line number that should be reported for the error.
diff --git a/test/filters_test.rb b/test/filters_test.rb
index 5f16d2e..ca767ed 100644
--- a/test/filters_test.rb
+++ b/test/filters_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class FiltersTest < MiniTest::Unit::TestCase
+class FiltersTest < Haml::TestCase
test "should be registered as filters when including Haml::Filters::Base" do
begin
refute Haml::Filters.defined.has_key? "bar"
@@ -116,7 +116,7 @@ class FiltersTest < MiniTest::Unit::TestCase
end
-class ErbFilterTest < MiniTest::Unit::TestCase
+class ErbFilterTest < Haml::TestCase
test "multiline expressions should work" do
html = "foobarbaz\n"
haml = %Q{:erb\n <%= "foo" +\n "bar" +\n "baz" %>}
@@ -137,7 +137,7 @@ class ErbFilterTest < MiniTest::Unit::TestCase
end
-class JavascriptFilterTest < MiniTest::Unit::TestCase
+class JavascriptFilterTest < Haml::TestCase
test "should interpolate" do
scope = Object.new.instance_eval {foo = "bar"; nil if foo; binding}
haml = ":javascript\n \#{foo}"
@@ -183,7 +183,7 @@ class JavascriptFilterTest < MiniTest::Unit::TestCase
end
end
-class CSSFilterTest < MiniTest::Unit::TestCase
+class CSSFilterTest < Haml::TestCase
test "should wrap output in CDATA and a CSS tag when output is XHTML" do
html = "<style type='text/css'>\n /*<![CDATA[*/\n foo\n /*]]>*/\n</style>\n"
haml = ":css\n foo"
@@ -222,7 +222,7 @@ class CSSFilterTest < MiniTest::Unit::TestCase
end
end
-class CDATAFilterTest < MiniTest::Unit::TestCase
+class CDATAFilterTest < Haml::TestCase
test "should wrap output in CDATA tag" do
html = "<![CDATA[\n foo\n]]>\n"
haml = ":cdata\n foo"
@@ -230,7 +230,7 @@ class CDATAFilterTest < MiniTest::Unit::TestCase
end
end
-class EscapedFilterTest < MiniTest::Unit::TestCase
+class EscapedFilterTest < Haml::TestCase
test "should escape ampersands" do
html = "&amp;\n"
haml = ":escaped\n &"
@@ -238,7 +238,7 @@ class EscapedFilterTest < MiniTest::Unit::TestCase
end
end
-class RubyFilterTest < MiniTest::Unit::TestCase
+class RubyFilterTest < Haml::TestCase
test "can write to haml_io" do
haml = ":ruby\n haml_io.puts 'hello'\n"
html = "hello\n"
@@ -256,4 +256,4 @@ class RubyFilterTest < MiniTest::Unit::TestCase
html = "7\n"
assert_equal(html, render(haml))
end
-end
\ No newline at end of file
+end
diff --git a/test/helper_test.rb b/test/helper_test.rb
index bf6b718..c845436 100644
--- a/test/helper_test.rb
+++ b/test/helper_test.rb
@@ -27,6 +27,6 @@ class FormModel
end
-class HelperTest < MiniTest::Unit::TestCase
+class HelperTest < Haml::TestCase
Post = Struct.new('Post', :body, :error_field, :errors)
class PostErrors
def on(name)
diff --git a/test/parser_test.rb b/test/parser_test.rb
index 3435562..b11c075 100644
--- a/test/parser_test.rb
+++ b/test/parser_test.rb
@@ -1,7 +1,7 @@
require 'test_helper'
module Haml
- class ParserTest < MiniTest::Unit::TestCase
+ class ParserTest < Haml::TestCase
test "should raise error for 'else' at wrong indent level" do
begin
@@ -124,4 +124,4 @@ module Haml
parser.parse
end
end
-end
\ No newline at end of file
+end
diff --git a/test/template_test.rb b/test/template_test.rb
index 59ccd75..0c8e636 100644
--- a/test/template_test.rb
+++ b/test/template_test.rb
@@ -38,7 +38,7 @@ class DummyController
end
end
-class TemplateTest < MiniTest::Unit::TestCase
+class TemplateTest < Haml::TestCase
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
TEMPLATES = %w{ very_basic standard helpers
whitespace_handling original_engine list helpful
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 5119945..394e7eb 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -41,14 +41,19 @@ require 'haml/template'
Haml::Template.options[:ugly] = false
Haml::Template.options[:format] = :xhtml
+BASE_TEST_CLASS = if defined?(Minitest::Test)
+ Minitest::Test
+ else
+ MiniTest::Unit::TestCase
+ end
+
module Declarative
def test(name, &block)
define_method("test #{name}", &block)
end
end
-class MiniTest::Unit::TestCase
-
+class Haml::TestCase < BASE_TEST_CLASS
extend Declarative
def render(text, options = {}, base = nil, &block)
diff --git a/test/util_test.rb b/test/util_test.rb
index 5c9222a..481decf 100644
--- a/test/util_test.rb
+++ b/test/util_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class UtilTest < MiniTest::Unit::TestCase
+class UtilTest < Haml::TestCase
include Haml::Util
def test_powerset

@ -0,0 +1,130 @@
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

@ -1,39 +1,29 @@
# Generated from haml-2.2.14.gem by gem2rpm -*- rpm-spec -*-
%global gem_name haml
Summary: An elegant, structured XHTML/XML templating engine
Name: rubygem-%{gem_name}
Version: 4.0.5
Release: 6%{?dist}
Version: 4.0.7
Release: 1%{?dist}
Summary: An elegant, structured (X)HTML/XML templating engine
Group: Development/Languages
License: MIT and WTFPL
URL: http://haml-lang.com/
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
# from https://github.com/haml/haml/commit/5017d332604a9b77b19401f6d2bcbef6479c3210
# slightly modified to apply against current release
Patch0: 5017d332-Add-Haml-TestCase.patch
Requires: ruby(rubygems)
Requires: ruby(release)
Requires: rubygem(erubis)
Requires: rubygem(sass)
Requires: rubygem(tilt)
URL: http://haml.info/
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Fix compatibility with recent Ruby on Rails (but drop RoR 3 support).
# https://github.com/haml/haml/commit/1f8821ce8bea3d36b1b7fa01730dff5ec0c0377c.patch
Patch0: rubygem-haml-4.11.x-Drop-support-for-Rails-3.patch
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: rubygem(erubis)
BuildRequires: ruby
BuildRequires: rubygem(minitest)
BuildRequires: rubygem(rails)
BuildRequires: rubygem(sass)
BuildRequires: rubygem(nokogiri)
BuildRequires: rubygem(tilt)
BuildRequires: rubygem(railties)
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}
%description
Haml (HTML Abstraction Markup Language) is a layer on top of XHTML or XML
that's designed to express the structure of XHTML or XML documents in a
non-repetitive, elegant, easy way, using indentation rather than closing
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML
that's designed to express the structure documents in a non-repetitive,
elegant, easy way by using indentation rather than closing
tags and allowing Ruby to be embedded with ease.
It was originally envisioned as a plugin for Ruby on Rails, but it can
function as a stand-alone templating engine.
@ -45,7 +35,7 @@ Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}
Documentation for %{name}.
%prep
gem unpack %{SOURCE0}
@ -54,6 +44,9 @@ gem unpack %{SOURCE0}
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
@ -61,15 +54,9 @@ gem build %{gem_name}.gemspec
%gem_install
%check
pushd %{buildroot}%{gem_instdir}
ruby -Ilib:test test/*_test.rb
popd
%install
mkdir -p %{buildroot}%{gem_dir}
cp -pa .%{gem_dir}/* \
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
@ -79,26 +66,41 @@ cp -pa .%{_bindir}/* \
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
pushd .%{gem_instdir}
# Get rid of Bundler.
sed -i '/bundler/ s/^/#/' test/test_helper.rb
ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'
popd
%files
%{_bindir}/haml
%dir %{gem_instdir}
%{gem_libdir}
%{gem_instdir}/bin
%{_bindir}/haml
%exclude %{gem_instdir}/.*
%doc %{gem_instdir}/MIT-LICENSE
%license %{gem_instdir}/MIT-LICENSE
%{gem_instdir}/bin
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/FAQ.md
%doc %{gem_instdir}/REFERENCE.md
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/FAQ.md
%doc %{gem_instdir}/README.md
%doc %{gem_instdir}/REFERENCE.md
%{gem_instdir}/Rakefile
%{gem_instdir}/test
%changelog
* Thu Oct 13 2016 Vít Ondruch <vondruch@redhat.com> - 4.0.7-1
- Update to Haml 4.0.7.
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

@ -1 +1 @@
60c17bbec24a4c8e44568380c96f60ad haml-4.0.5.gem
54301683936cdf3678f5c513dab3871c haml-4.0.7.gem

Loading…
Cancel
Save