Blob Blame History Raw
# Generated from gem2rpm-0.5.2.gem by gem2rpm -*- rpm-spec -*-
%global gemname gem2rpm

%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
%global gemdocdir %{gemdir}/doc/%{gemname}-%{version}
%global rubyabi 1.8

Summary: Generate rpm specfiles from gems
Name: rubygem-%{gemname}
Version: 0.10.1
Release: 1%{?dist}
Group: Development/Languages
License: GPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
URL: https://github.com/lutter/gem2rpm/
Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
# git clone https://github.com/lutter/gem2rpm.git && cd gem2rpm && git checkout v0.10.1
# tar czvf gem2rpm-0.10.1-tests.tgz test/
Source1: %{gemname}-%{version}-tests.tgz
Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems)
Requires: ruby
BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: ruby(rubygems)
BuildRequires: ruby
BuildRequires: rubygem(minitest)
BuildArch: noarch
Provides: rubygem(%{gemname}) = %{version}

%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
%setup -q -c -T
mkdir -p .%{gemdir}
gem install --local --install-dir .%{gemdir} \
            --bindir .%{_bindir} \
            --force %{SOURCE0}

%build

%install
rm -rf %{buildroot}

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

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

find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x


%check
pushd .%{geminstdir}
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 - << \EOF
  require 'rubygems'
  require 'minitest/unit'

  module Minitest; end;

  Minitest::Test = MiniTest::Unit::TestCase
  Dir.glob "./test/**/test_*.rb", &method(:require)
EOF
popd

%files
%dir %{geminstdir}
%{_bindir}/gem2rpm
%{geminstdir}/bin
%{geminstdir}/lib
%{geminstdir}/templates
%doc %{geminstdir}/LICENSE
%{gemdir}/cache/%{gemname}-%{version}.gem
%{gemdir}/specifications/%{gemname}-%{version}.gemspec

%files doc
%doc %{gemdocdir}
%doc %{geminstdir}/README
%doc %{geminstdir}/AUTHORS

%changelog
* Mon May 05 2014 Vít Ondruch <vondruch@redhat.com> - 0.10.1-1
- Update to gem2rpm 0.10.1.

* Tue Apr 23 2013 Vít Ondruch <vondruch@redhat.com> - 0.9.2-1
- Update to gem2rpm 0.9.2.

* Thu Feb 09 2012 Vít Ondruch <vondruch@redhat.com> - 0.8.1-1
- Fix template for F17 and above.
- Fix release enumeration logic.

* Mon Jan 23 2012 Vít Ondruch <vondruch@redhat.com> - 0.8.0-1
- Updated to gem2rpm 0.8.0.

* Thu Jun 30 2011 Vít Ondruch <vondruch@redhat.com> - 0.7.1-1
- Updated to the 0.7.1 version.

* Mon Oct  6 2008 David Lutterkort <dlutter@redhat.com> - 0.6.0-1
- New version

* Tue Mar 11 2008 David Lutterkort <dlutter@redhat.com> - 0.5.3-1
- Bring in accordance with Fedora guidelines

* Thu Jan  3 2008 David Lutterkort <dlutter@redhat.com> - 0.5.2-2
- Own geminstdir
- Fix Source URL

* Mon Dec 10 2007 David Lutterkort <dlutter@redhat.com> - 0.5.1-1
- Initial package