Update to Builder 3.0.0.

epel9
Vít Ondruch 13 years ago
parent a506276a10
commit f414634e74

1
.gitignore vendored

@ -1 +1,2 @@
builder-2.1.2.gem builder-2.1.2.gem
/builder-3.0.0.gem

@ -0,0 +1,58 @@
From 973b558e48a5af79a7239ff53f0ef2d913d8e64f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@flameeyes.eu>
Date: Wed, 25 Jan 2012 03:04:23 +0100
Subject: [PATCH] Fix tests with Ruby 1.9.3, where UTF-16 is a supported
encoding.
While the UTF-16 encoding is supported, it's a dummy encoding, so regexp
matching is not properly implemented, so there is not much we can do but
reject dummy encodings altogether.
---
lib/builder/xmlbase.rb | 4 +++-
test/test_markupbuilder.rb | 9 ++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/builder/xmlbase.rb b/lib/builder/xmlbase.rb
index 1a1e5f9..0c9798f 100644
--- a/lib/builder/xmlbase.rb
+++ b/lib/builder/xmlbase.rb
@@ -122,7 +122,9 @@ module Builder
def _escape(text)
result = XChar.encode(text)
begin
- result.encode(@encoding)
+ encoding = ::Encoding::find(@encoding)
+ raise Exception if encoding.dummy?
+ result.encode(encoding)
rescue
# if the encoding can't be supported, use numeric character references
result.
diff --git a/test/test_markupbuilder.rb b/test/test_markupbuilder.rb
index 63864ad..2d9b853 100644
--- a/test/test_markupbuilder.rb
+++ b/test/test_markupbuilder.rb
@@ -446,13 +446,20 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
end
end
- def test_use_entities_if_kcode_is_utf_but_encoding_is_something_else
+ def test_use_entities_if_kcode_is_utf_but_encoding_is_dummy_encoding
xml = Builder::XmlMarkup.new
xml.instruct!(:xml, :encoding => 'UTF-16')
xml.p(encode("\xE2\x80\x99", 'UTF8'))
assert_match(%r(<p>&#8217;</p>), xml.target!) #
end
+ def test_use_entities_if_kcode_is_utf_but_encoding_is_unsupported_encoding
+ xml = Builder::XmlMarkup.new
+ xml.instruct!(:xml, :encoding => 'UCS-2')
+ xml.p(encode("\xE2\x80\x99", 'UTF8'))
+ assert_match(%r(<p>&#8217;</p>), xml.target!) #
+ end
+
def test_use_utf8_if_encoding_defaults_and_kcode_is_utf8
xml = Builder::XmlMarkup.new
xml.p(encode("\xE2\x80\x99",'UTF8'))
--
1.7.10.4

@ -1,66 +1,117 @@
%define gem_name builder %global gem_name builder
%global rubyabi 1.9.1
Name: rubygem-%{gem_name}
Summary: Builders for MarkUp Summary: Builders for MarkUp
Version: 2.1.2 Name: rubygem-%{gem_name}
Release: 9%{?dist} Version: 3.0.0
Release: 1%{?dist}
Group: Development/Languages Group: Development/Languages
License: MIT License: MIT
URL: http://onestepback.org URL: http://onestepback.org
# Source pulled from http://www.freshports.org/devel/rubygem-builder/, there's more listed Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
Source0: http://rubyforge.rubyuser.de/%{gem_name}/%{gem_name}-%{version}.gem # https://github.com/jimweirich/builder/pull/15
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Patch0: builder-3.0.0-fix-tests-with-Ruby-1.9.3-where-UTF-16-is-a-supporte.patch
Requires: rubygems Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems)
# Builder carries copy of Blankslate, which was in the meantime extracted into
# independent gem.
# https://github.com/jimweirich/builder/issues/24
#
# Moreover, rubygem-blankslate is not yet in Fedora.
# https://bugzilla.redhat.com/show_bug.cgi?id=771316
#
# Requires: rubygem(blankslate)
BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: rubygems-devel BuildRequires: rubygems-devel
BuildRequires: ruby
BuildRequires: rubygem(test-unit)
BuildArch: noarch BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version} Provides: rubygem(%{gem_name}) = %{version}
%description %description
Builder provides a number of builder objects that make creating structured Builder provides a number of builder objects that make creating structured
data simple to do. Currently the following builder objects are supported: * data simple to do. Currently the following builder objects are supported:
XML Markup * XML Events * XML Markup
* XML Events
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}
%prep %prep
%setup -q -c -T
mkdir -p .%{gem_dir}
gem install --local --install-dir .%{gem_dir} \
--force %{SOURCE0}
pushd .%{gem_instdir}
%patch0 -p1
popd
%build %build
%install %install
rm -rf %{buildroot} # test_cssbuilder.rb is part of the package just by mistake it seems.
# https://github.com/jimweirich/builder/pull/25
rm .%{gem_instdir}/test/test_cssbuilder.rb
mkdir -p %{buildroot}%{gem_dir} mkdir -p %{buildroot}%{gem_dir}
gem install --local --install-dir %{buildroot}%{gem_dir} \ cp -a .%{gem_dir}/* \
--force --rdoc %{SOURCE0} || \ %{buildroot}%{gem_dir}/
echo 'Workaround FTBFS rhbz#712927'
# Fix anything executable that does not have a shebang.
for file in `find %{buildroot}/%{gem_instdir} -name "*.rb"`; do for file in `find %{buildroot}/%{gem_instdir} -name "*.rb"`; do
[ ! -z "`head -n 1 $file | grep \"^#!\"`" ] && chmod +x $file [ ! -z "`head -n 1 $file | grep \"^#!\"`" ] && chmod +x $file
done done
chmod -x %{buildroot}%{gem_instdir}/doc/releases/builder-2.1.1.rdoc
# Convert README.rdoc to utf8
strings %{buildroot}/%{gem_instdir}/README.rdoc > %{buildroot}/%{gem_instdir}/README.rdoc.strings
mv -f %{buildroot}/%{gem_instdir}/README.rdoc.strings %{buildroot}/%{gem_instdir}/README.rdoc
# Convert README to utf8 # Convert README to utf8
strings %{buildroot}/%{gem_instdir}/README > %{buildroot}/%{gem_instdir}/README.strings strings %{buildroot}/%{gem_instdir}/README > %{buildroot}/%{gem_instdir}/README.strings
mv -f %{buildroot}/%{gem_instdir}/README.strings %{buildroot}/%{gem_instdir}/README mv -f %{buildroot}/%{gem_instdir}/README.strings %{buildroot}/%{gem_instdir}/README
# Remove zero-length file
rm -rf %{buildroot}/%{gem_instdir}/%{gem_name}-%{version}.gem
%clean %check
rm -rf %{buildroot} pushd .%{gem_instdir}
testrb2 -I.:lib test
popd
%files %files
%defattr(-, root, root, -) %dir %{gem_instdir}
%{gem_dir}/gems/%{gem_name}-%{version}/ # Two inconsitent readmes?
# https://github.com/jimweirich/builder/issues/22
%doc %{gem_instdir}/README
%doc %{gem_instdir}/README.rdoc
# Seems to be in package just by accident.
# https://github.com/jimweirich/builder/issues/10
%exclude %{gem_instdir}/TAGS
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir} %doc %{gem_docdir}
%doc %{gem_instdir}/CHANGES %doc %{gem_instdir}/CHANGES
%doc %{gem_instdir}/Rakefile %doc %{gem_instdir}/Rakefile
%doc %{gem_instdir}/README
%doc %{gem_instdir}/doc/releases/builder-1.2.4.rdoc %doc %{gem_instdir}/doc/releases/builder-1.2.4.rdoc
%doc %{gem_instdir}/doc/releases/builder-2.0.0.rdoc %doc %{gem_instdir}/doc/releases/builder-2.0.0.rdoc
%doc %{gem_instdir}/doc/releases/builder-2.1.1.rdoc %doc %{gem_instdir}/doc/releases/builder-2.1.1.rdoc
%{gem_cache} %{gem_instdir}/test
%{gem_spec}
%changelog %changelog
* Wed Jul 18 2012 Vít Ondruch <vondruch@redhat.com> - 3.0.0-1
- Update to Builder 3.0.0.
* Fri Feb 03 2012 Vít Ondruch <vondruch@redhat.com> - 2.1.2-9 * Fri Feb 03 2012 Vít Ondruch <vondruch@redhat.com> - 2.1.2-9
- Fixed license. - Fixed license.

@ -1 +1 @@
e96a525d9e0b42a2e2d5e77cbd02eb72 builder-2.1.2.gem cf9d2693d684a749e35dda886c4dc23c builder-3.0.0.gem

Loading…
Cancel
Save