diff --git a/.gitignore b/.gitignore index 8651709..f932bbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ builder-2.1.2.gem +/builder-3.0.0.gem diff --git a/builder-3.0.0-fix-tests-with-Ruby-1.9.3-where-UTF-16-is-a-supporte.patch b/builder-3.0.0-fix-tests-with-Ruby-1.9.3-where-UTF-16-is-a-supporte.patch new file mode 100644 index 0000000..1d67454 --- /dev/null +++ b/builder-3.0.0-fix-tests-with-Ruby-1.9.3-where-UTF-16-is-a-supporte.patch @@ -0,0 +1,58 @@ +From 973b558e48a5af79a7239ff53f0ef2d913d8e64f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= +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(

), 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(

), 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 + diff --git a/rubygem-builder.spec b/rubygem-builder.spec index e91e40b..0b92ee5 100644 --- a/rubygem-builder.spec +++ b/rubygem-builder.spec @@ -1,66 +1,117 @@ -%define gem_name builder - -Name: rubygem-%{gem_name} -Summary: Builders for MarkUp -Version: 2.1.2 -Release: 9%{?dist} -Group: Development/Languages -License: MIT -URL: http://onestepback.org -# Source pulled from http://www.freshports.org/devel/rubygem-builder/, there's more listed -Source0: http://rubyforge.rubyuser.de/%{gem_name}/%{gem_name}-%{version}.gem -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: rubygems +%global gem_name builder +%global rubyabi 1.9.1 + +Summary: Builders for MarkUp +Name: rubygem-%{gem_name} +Version: 3.0.0 +Release: 1%{?dist} +Group: Development/Languages +License: MIT +URL: http://onestepback.org +Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem +# https://github.com/jimweirich/builder/pull/15 +Patch0: builder-3.0.0-fix-tests-with-Ruby-1.9.3-where-UTF-16-is-a-supporte.patch +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 -BuildArch: noarch -Provides: rubygem(%{gem_name}) = %{version} +BuildRequires: ruby +BuildRequires: rubygem(test-unit) +BuildArch: noarch +Provides: rubygem(%{gem_name}) = %{version} %description Builder provides a number of builder objects that make creating structured -data simple to do. Currently the following builder objects are supported: * -XML Markup * XML Events +data simple to do. Currently the following builder objects are supported: +* XML Markup +* XML Events + +%package doc +Summary: Documentation for %{name} +Group: Documentation +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name} %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 %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} -gem install --local --install-dir %{buildroot}%{gem_dir} \ - --force --rdoc %{SOURCE0} || \ - echo 'Workaround FTBFS rhbz#712927' +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ +# Fix anything executable that does not have a shebang. for file in `find %{buildroot}/%{gem_instdir} -name "*.rb"`; do [ ! -z "`head -n 1 $file | grep \"^#!\"`" ] && chmod +x $file 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 strings %{buildroot}/%{gem_instdir}/README > %{buildroot}/%{gem_instdir}/README.strings - 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 -rm -rf %{buildroot} +%check +pushd .%{gem_instdir} +testrb2 -I.:lib test +popd %files -%defattr(-, root, root, -) -%{gem_dir}/gems/%{gem_name}-%{version}/ +%dir %{gem_instdir} +# 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_instdir}/CHANGES %doc %{gem_instdir}/Rakefile -%doc %{gem_instdir}/README %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.1.1.rdoc -%{gem_cache} -%{gem_spec} +%{gem_instdir}/test %changelog +* Wed Jul 18 2012 Vít Ondruch - 3.0.0-1 +- Update to Builder 3.0.0. + * Fri Feb 03 2012 Vít Ondruch - 2.1.2-9 - Fixed license. diff --git a/sources b/sources index 2ab3a51..96492f3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e96a525d9e0b42a2e2d5e77cbd02eb72 builder-2.1.2.gem +cf9d2693d684a749e35dda886c4dc23c builder-3.0.0.gem