File rubygem-gem2rpm.spec of Package rubygem-gem2rpm
# Generated from gem2rpm-0.5.2.gem by gem2rpm -*- rpm-spec -*-
%global gem_name gem2rpm
Name: rubygem-%{gem_name}
Version: 0.11.2
Release: 1%{?dist}
Summary: Generate rpm specfiles from gems
Group: Development/Languages
License: GPLv2+
URL: https://github.com/fedora-ruby/gem2rpm
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# git clone https://github.com/fedora-ruby/gem2rpm.git && cd gem2rpm && git checkout v0.11.2
# tar czvf gem2rpm-0.11.2-tests.tgz test/
Source1: %{gem_name}-%{version}-tests.tgz
Patch0: rubygem-gem2rpm-0.11.2.fetchurl.patch
Requires: %{_bindir}/rpmdev-packager
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby
BuildRequires: %{_bindir}/rpmdev-packager
BuildRequires: rubygem(minitest)
BuildArch: noarch
%description
Generate source rpms and rpm spec files from a Ruby Gem. The spec file
tries to follow the gem as closely as possible, and be compliant with the
Fedora rubygem packaging guidelines.
%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 -D -T -n %{gem_name}-%{version}
%patch0 -p1
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%build
gem build %{gem_name}.gemspec
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{_bindir}
cp -a .%{_bindir}/* \
%{buildroot}%{_bindir}/
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
%check
pushd .%{gem_instdir}
tar xzvf %{SOURCE1}
# Disable this test, since it needs online access (see the comment on line 22).
sed -i "/test_find_download_url_for_source_address/,/ end/ s/^/#/" test/test_gem2rpm.rb
ruby -Itest -e 'Dir.glob "./test/**/test_*.rb", &method(:require)'
popd
%files
%dir %{gem_instdir}
%{_bindir}/gem2rpm
%license %{gem_instdir}/LICENSE
%{gem_instdir}/bin
%{gem_libdir}
%{gem_instdir}/templates
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/AUTHORS
%doc %{gem_instdir}/README.md