Patch for CSV support (patch by upstream)

This commit is contained in:
TASAKA Mamoru 2013-02-28 13:30:07 +09:00
commit 8d8245ebdf
2 changed files with 41 additions and 4 deletions

View file

@ -0,0 +1,30 @@
From 936bb463e1e47f5bee767027a25bf211876d8be9 Mon Sep 17 00:00:00 2001
From: Kouhei Sutou <kou@clear-code.com>
Date: Thu, 28 Feb 2013 00:15:51 +0900
Subject: [PATCH] Use CSV::VERSION to detect newer CSV library
CSV.dump (and CSV.load) had been removed since Ruby 2.0.0.
GitHub: fix #54
Reported by mtasaka. Thanks!!!
---
lib/test/unit/data.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/test/unit/data.rb b/lib/test/unit/data.rb
index 3fec326..9f71f01 100644
--- a/lib/test/unit/data.rb
+++ b/lib/test/unit/data.rb
@@ -194,7 +194,7 @@ def load_csv(file_name)
# @api private
def load_tsv(file_name)
require "csv"
- if CSV.respond_to?(:dump)
+ if CSV.const_defined?(:VERSION)
first_row = true
header = nil
CSV.foreach(file_name, :col_sep => "\t") do |row|
--
1.7.10

View file

@ -6,7 +6,7 @@
Summary: Improved version of Test::Unit bundled in Ruby 1.8.x
Name: rubygem-%{gem_name}
Version: 2.5.4
Release: 2%{?dist}
Release: 3%{?dist}
Group: Development/Languages
# lib/test/unit/diff.rb is under GPLv2 or Ruby or Python
# lib/test-unit.rb is under LGPLv2+ or Ruby
@ -15,6 +15,10 @@ License: (GPLv2 or Ruby) and (GPLv2 or Ruby or Python) and (LGPLv2+ or Ruby)
URL: http://rubyforge.org/projects/test-unit/
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
# https://github.com/test-unit/test-unit/issues/54
# https://github.com/test-unit/test-unit/commit/936bb463e1e47f5bee76702.patch
Patch0: rubygem-gettext-2.3.7-CSV-detect-newer.patch
BuildRequires: ruby(release)
BuildRequires: rubygems
BuildRequires: rubygems-devel
@ -52,6 +56,8 @@ pushd tmpunpackdir
gem unpack %{SOURCE0}
cd %{gem_name}-%{version}
%patch0 -p1
gem specification -l --ruby %{SOURCE0} > %{gem_name}.gemspec
gem build %{gem_name}.gemspec
mv %{gem_name}-%{version}.gem $TOPDIR
@ -80,9 +86,7 @@ chmod 0755 %{buildroot}%{_bindir}/testrb2
%check
pushd .%{gem_instdir}
#rake test --trace
# Handling tsv does not work currently
# https://github.com/test-unit/test-unit/issues/54
ruby -Ilib ./test/run-test.rb || :
ruby -Ilib ./test/run-test.rb
popd
%files
@ -107,6 +111,9 @@ popd
%{gem_docdir}/
%changelog
* Thu Feb 28 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.5.4-3
- Patch for CSV support (patch by upstream)
* Wed Feb 27 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.5.4-2
- Rebuild for ruby 2.0.0