3 %bcond_with tests # build without tests
6 Summary: A Ruby client library for Redis
11 Group: Development/Languages
12 Source0: https://rubygems.org/gems/%{pkgname}-%{version}.gem
13 # Source0-md5: 432fa72404066a33ed4189bbf05396c4
14 Source1: redis-test.conf
15 Patch0: tests-localhost.patch
16 Patch1: rubygem-redis-3.2.2-minitest.patch
17 URL: https://github.com/redis/redis-rb
18 BuildRequires: rpm-rubyprov
19 BuildRequires: rpmbuild(macros) >= 1.665
21 BuildRequires: redis-server
22 BuildRequires: rubygem(minitest)
25 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28 A Ruby client that tries to match Redis' API one-to-one, while still
29 providing an idiomatic interface. It features thread-safety,
30 client-side sharding, pipelining, and an obsession for performance.
33 Summary: Documentation for %{name}
35 Requires: %{name} = %{version}-%{release}
39 Documentation for %{name}.
42 %setup -q -n %{pkgname}-%{version}
46 # Install our test.conf file. Upstream dynamically generates this with Rake.
47 # To avoid using rake, we use a static file.
48 cp -p %{SOURCE1} test/test.conf
57 sed -i -e "/^PORT/ s/6381/$port/" test/helper.rb
58 sed -i -e "/^port/ s/6381/$port/" test/test.conf
60 ## Start a testing redis server instance
61 /usr/sbin/redis-server test/test.conf
64 kill -0 `cat test/db/redis.pid`
65 ## configure kill for redis-server
66 trap 'kill -INT `cat test/db/redis.pid`' EXIT QUIT INT
68 ## Set locale because two tests fail in mock.
69 ## https://github.com/redis/redis-rb/issues/345
70 export LC_ALL=en_US.UTF-8
72 ## Problems continue to surface with Minitest 5, so I've asked upstream how
73 ## they want to proceed. https://github.com/redis/redis-rb/issues/487
74 ruby -Ilib -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'
78 rm -rf $RPM_BUILD_ROOT
79 install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir}}
80 cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir}
81 cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir}
84 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
85 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
88 rm -rf $RPM_BUILD_ROOT
91 %defattr(644,root,root,755)
92 %doc README.md CHANGELOG.md LICENSE
93 %{ruby_vendorlibdir}/redis.rb
94 %{ruby_vendorlibdir}/redis
95 %{ruby_specdir}/%{pkgname}-%{version}.gemspec
96 %{_examplesdir}/%{name}-%{version}