Blob Blame History Raw
%global gem_name redis

Name: rubygem-%{gem_name}
Version: 3.2.1
Release: 3%{?dist}
Summary: A Ruby client library for Redis
Group: Development/Languages
License: MIT
URL: https://github.com/redis/redis-rb
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
Source1: redis-test.conf
# Minitest 5 support
# A variation of this patch has been submitted upstream at
# https://github.com/redis/redis-rb/pull/445
Patch0: rubygem-redis-3.2.1-minitest.patch
%if 0%{?fc20} || 0%{?el7}
Requires: ruby(release)
Requires: ruby(rubygems)
%endif
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: rubygem(minitest)
BuildRequires: redis
BuildArch: noarch
%if 0%{?fc20} || 0%{?el7}
Provides: rubygem(%{gem_name}) = %{version}
%endif

%description
A Ruby client that tries to match Redis' API one-to-one, while still
providing an idiomatic interface. It features thread-safety,
client-side sharding, pipelining, and an obsession for performance.

%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description doc
Documentation for %{name}.

%prep
gem unpack %{SOURCE0}

%setup -q -T -D -n  %{gem_name}-%{version}

gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec

# Minitest 5 support
# https://github.com/redis/redis-rb/pull/445
%patch0 -p1

%build
# Create the gem as gem install only works on a gem file
gem build %{gem_name}.gemspec

# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install

%check
pushd .%{gem_instdir}

# Install our test.conf file. Upstream dynamically generates this with Rake.
# To avoid using rake, we use a static file.
cp -p %{SOURCE1} test/test.conf

## Running Redis server, which does not support IPv6, nc cannot connect to it using localhost.
## https://bugzilla.redhat.com/show_bug.cgi?id=978964
## Use 127.0.0.1 instead or else it hangs while testing.
## https://bugzilla.redhat.com/show_bug.cgi?id=978284#c2
sed -i "s/localhost/127.0.0.1/" test/publish_subscribe_test.rb

## Start a testing redis server instance
redis-server test/test.conf

## Set locale because two tests fail in mock.
## https://github.com/redis/redis-rb/issues/345
LANG=en_US.utf8

## Problems continue to surface with Minitest 5, so I've asked upstream how
## they want to proceed. https://github.com/redis/redis-rb/issues/487
## In the mean time, we unconditionally pass the tests with "|| :"
ruby -Ilib -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' || :

## Kill redis-server
kill -INT `cat test/db/redis.pid`
popd

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/

%files
%{!?_licensedir:%global license %%doc}
%dir %{gem_instdir}
%{gem_libdir}
%license %{gem_instdir}/LICENSE
%{gem_spec}
%exclude %{gem_cache}
%exclude %{gem_instdir}/.*

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/README.md
%{gem_instdir}/%{gem_name}.gemspec
%{gem_instdir}/Gemfile
%{gem_instdir}/Rakefile
%{gem_instdir}/benchmarking/
%{gem_instdir}/examples/
%{gem_instdir}/test/

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Feb 15 2015 Ken Dreyer <ktdreyer@ktdreyer.com> - 3.2.1-1
- Update to 3.2.1 (RHBZ #1192389)
- Remove Fedora 19 compatibility macros
- Use static test.conf, since upstream uses a dynamic ERB template now
- Correct comment about IPv6 support

* Mon Dec 15 2014 Ken Dreyer <ktdreyer@ktdreyer.com> - 3.2.0-1
- Update to 3.2.0 (RHBZ #1173070)
- Drop unneeded BRs
- Use %%license macro
- Adjustments for https://fedoraproject.org/wiki/Changes/Ruby_2.1
- Unconditionally pass tests for now (RHBZ #1173070)

* Mon Jun 09 2014 Ken Dreyer <ktdreyer@ktdreyer.com> - 3.1.0-1
- Update to 3.1.0
- Remove gem2rpm comment
- Patch for Minitest 5

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Feb 24 2014 Achilleas Pipinellis <axilleas@fedoraproject.org> - 3.0.7-1
- Update to 3.0.7

* Tue Sep 03 2013 Axilleas Pipinellis <axilleaspi@ymail.com> - 3.0.4-3
- Move %%exclude .gitignore to -doc
- Reference to redis related bug

* Thu Jun 27 2013 Axilleas Pipinellis <axilleaspi@ymail.com> - 3.0.4-2
- Fix failing test
- Remove redis from Requires
- Exclude dot file

* Sun Jun 23 2013 Axilleas Pipinellis <axilleaspi@ymail.com> - 3.0.4-1
- Initial package