# Generated from ipaddr-1.2.6.gem by gem2rpm -*- rpm-spec -*-
%global gem_name ipaddr

Name: rubygem-%{gem_name}
Version: 1.2.6
Release: 1%{?dist}
Summary: A class to manipulate an IP address in ruby
License: BSD
URL: https://github.com/ruby/ipaddr
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Tests are not shipped with the gem.
# You can get them like so:
# git clone --no-checkout https://github.com/ruby/ipaddr.git
# git -C ipaddr archive -v -o ipaddr-1.2.6-tests.txz v1.2.6 test/
Source1: %{gem_name}-%{version}-tests.txz
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby
BuildRequires: rubygem(test-unit)
BuildArch: noarch

%description
IPAddr provides a set of methods to manipulate an IP address.
Both IPv4 and IPv6 are supported.


%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description doc
Documentation for %{name}.

%prep
%setup -q -n %{gem_name}-%{version} -b1

%build
gem build ../%{gem_name}-%{version}.gemspec
%gem_install

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

%check
pushd .%{gem_instdir}
ln -s %{_builddir}/test .
ruby -e 'Dir.glob "./test/**/test_*.rb", &method(:require)' ||:
popd

%files
%dir %{gem_instdir}
%exclude %{gem_instdir}/.*
%license %{gem_instdir}/LICENSE.txt
#%%{gem_instdir}/bin
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/README.md
%{gem_instdir}/ipaddr.gemspec

%changelog
* Mon May 18 2020 Pavel Valena <pvalena@redhat.com> - 1.2.6-1
- Initial package