%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global gemname test-unit
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
%global rubyabi 1.8
Summary: Improved version of Test::Unit bundled in Ruby 1.8.x
Name: rubygem-%{gemname}
Version: 2.1.1
Release: 2%{?dist}
Group: Development/Languages
# lib/test/unit/diff.rb is under GPLv2 or Ruby or Python
# Other file: GPLv2 or Ruby
License: (GPLv2 or Ruby) and (GPLv2 or Ruby or Python)
URL: http://rubyforge.org/projects/test-unit/
Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: rubygems
BuildRequires(check): rubygem(rake)
BuildRequires(check): rubygem(hoe)
Requires: ruby(abi) = %{rubyabi}
Requires: rubygems
BuildArch: noarch
Provides: rubygem(%{gemname}) = %{version}-%{release}
%description
Test::Unit 2.x - Improved version of Test::Unit bundled in
Ruby 1.8.x.
Ruby 1.9.x bundles minitest not Test::Unit. Test::Unit
bundled in Ruby 1.8.x had not been improved but unbundled
Test::Unit (Test::Unit 2.x) will be improved actively.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
%description doc
This package contains documentation for %{name}.
%prep
%setup -q -c -T
mkdir -p .%{geminstdir}
gem install \
-V \
--local \
--install-dir .%{gemdir} \
--force \
--rdoc \
%{SOURCE0}
find . -name \*.gem | xargs chmod 0644
pushd .%{geminstdir}
# rdoc gem not needed
sed -i -e '/rdoc/s|^gem|#gem|' Rakefile
popd
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{gemdir}
cp -a .%{gemdir}/* \
%{buildroot}%{gemdir}/
# Move bin/ script to standard path
# The name "testrb" conflicts with ruby 1.8.x, rename it
mkdir -p %{buildroot}/%{_bindir}
mv %{buildroot}%{gemdir}/bin/* \
%{buildroot}/%{_bindir}/
rmdir %{buildroot}%{gemdir}/bin
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod 0755
## rename!!
mv %{buildroot}%{_bindir}/testrb{,2}
%clean
rm -rf %{buildroot}
%check
pushd .%{geminstdir}
rake test --trace
%files
%defattr(-,root,root,-)
%dir %{geminstdir}
%doc %{geminstdir}/[A-Z]*
%exclude %{geminstdir}/Rakefile
%{_bindir}/testrb2
%{geminstdir}/bin/
%{geminstdir}/lib/
%{gemdir}/cache/%{gemname}-%{version}.gem
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
%files doc
%defattr(-,root,root,-)
%{geminstdir}/Rakefile
%{geminstdir}/html/
%{geminstdir}/images/
%{geminstdir}/sample/
%{geminstdir}/test/
%{gemdir}/doc/%{gemname}-%{version}/
%changelog
* Sun Sep 19 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 2.1.1-2
- Fix up license tag
* Sat Sep 18 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 2.1.1-1
- Initial package