%global gem_name mongo
%global rubyabi 1.9.1
Summary: Ruby driver for the MongoDB
Name: rubygem-%{gem_name}
Version: 1.6.4
Release: 5%{?dist}
Group: Development/Languages
License: ASL 2.0
URL: http://www.mongodb.org
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
Requires: rubygems
Requires: rubygem(bson) = %{version}
%if 0%{?fedora} >= 19
Requires: ruby(release)
BuildRequires: ruby(release)
%else
Requires: ruby(abi) >= %{rubyabi}
BuildRequires: ruby(abi) >= %{rubyabi}
%endif
BuildRequires: rubygems
BuildRequires: rubygems-devel
# For running the tests
BuildRequires: rubygem(bson)
BuildRequires: rubygem(shoulda)
BuildRequires: rubygem(mocha)
#BuildRequires: rubygem(minitest)
BuildRequires: rubygem(test-unit)
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}
%description
A Ruby driver for MongoDB. For more information about Mongo, see
http://www.mongodb.org.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires:%{name} = %{version}-%{release}
%description doc
Documentation for %{name}
%prep
gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%build
mkdir -p .%{gem_dir}
# Create the gem as gem install only works on a gem file
gem build %{gem_name}.gemspec
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
# gem install compiles any C extensions and installs into a directory
# We set that to be a local directory so that we can move it into the
# buildroot in %%install
gem install -V \
--local \
--install-dir .%{gem_dir} \
--bindir .%{_bindir} \
--force \
--rdoc \
%{gem_name}-%{version}.gem
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{_bindir}
cp -a .%{_bindir}/* %{buildroot}%{_bindir}
chmod 755 %{buildroot}%{gem_instdir}/test/tools/repl_set_manager.rb
%check
pushd .%{gem_instdir}
# Most tests require a mongo server to be running
# We are only running tests that do not require the server
RUBYOPT="-rdate" testrb test/conversions_test.rb \
test/support_test.rb \
test/uri_test.rb \
test/unit/*_test.rb
popd
%files
%doc %{gem_instdir}/LICENSE.txt
%dir %{gem_instdir}
%{_bindir}/mongo_console
%{gem_instdir}/bin
%{gem_libdir}
%{gem_spec}
%exclude %{gem_cache}
%files doc
%doc %{gem_instdir}/README.md
%doc %{gem_docdir}
%doc %{gem_instdir}/docs
%{gem_instdir}/test
%{gem_instdir}/mongo.gemspec
%{gem_instdir}/Rakefile
%changelog
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Mar 13 2013 Troy Dawson <tdawson@redhat.com> - 1.6.4-4
- Fix to make it build/install on F19+
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Fri Aug 10 2012 Troy Dawson <tdawson@redhat.com> - 1.6.4-2
- Fixed doc
- removed more BuildRequires that are not required
* Thu Aug 09 2012 Troy Dawson <tdawson@redhat.com> - 1.6.4-1
- Updated to latest version
- Removed BuildRequires that are not needed
* Thu Aug 09 2012 Troy Dawson <tdawson@redhat.com> - 1.4.0-7
- Fixed checks.
Only run checks that do not require a running mongodb server
* Tue Aug 07 2012 Troy Dawson <tdawson@redhat.com> - 1.4.0-6
- Changed .gemspec and Rakefile to not be doc
- Added checks
* Thu Aug 02 2012 Troy Dawson <tdawson@redhat.com> - 1.4.0-5
- Fixed rubygem(bson) requires
* Mon Jul 23 2012 Troy Dawson <tdawson@redhat.com> - 1.4.0-4
- Updated to meet new fedora rubygem guidelines
* Thu Nov 17 2011 Troy Dawson <tdawson@redhat.com> - 1.4.0-3
- Changed group to Development/Languages
- Changed the global variables
- Seperated the doc and test into the doc rpm
* Thu Nov 17 2011 Troy Dawson <tdawson@redhat.com> - 1.4.0-2
- Added %{?dist} to version
* Tue Nov 15 2011 <tdawson@redhat.com> - 1.4.0-1
- Initial package