File rubygem-faker.spec of Package rubygem-faker
%global gem_name faker
Name: rubygem-%{gem_name}
Version: 1.6.6
Release: 1%{?dist}
Summary: Easily generate fake data
Group: Development/Languages
License: MIT
URL: http://faker.rubyforge.org
Source0: https://github.com/stympy/%{gem_name}/archive/v%{version}/%{gem_name}-%{version}.tar.gz
Patch0: rubygem-%{gem_name}-fix-test-locales.patch
Patch1: rubygem-%{gem_name}-fix-test-install.patch
%if 0%{fedora} < 21
Requires: ruby(release)
Requires: ruby(rubygems)
Requires: rubygem(i18n) => 0.5
Requires: rubygem(i18n) < 1
%endif
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby
BuildRequires: rubygem(i18n)
BuildRequires: rubygem(minitest) >= 4.3.0
BuildRequires: rubygem(minitest) < 5.0.0
BuildRequires: rubygem(test-unit)
BuildRequires: rubygem(timecop)
BuildArch: noarch
%if 0%{fedora} < 21
Provides: rubygem(%{gem_name}) = %{version}
%endif
%description
Faker, a port of Data::Faker from Perl, is used to easily generate fake data:
names, addresses, phone numbers, etc.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}
%prep
%setup -q -n %{gem_name}-%{version}
%patch0 -p1
%patch1 -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
%install
mkdir -p %{buildroot}%{gem_dir}
cp -pa .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd ./%{gem_instdir}
ruby -Ilib -e 'Dir.glob "./test/test_*.rb", &method(:require)'
popd
%files
%dir %{gem_instdir}
%doc %{gem_instdir}/README.md
%doc %{gem_instdir}/History.txt
%doc %{gem_instdir}/License.txt
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%{gem_instdir}/test