%global gem_name json-schema Name: rubygem-%{gem_name} Version: 2.8.0 Release: 1%{?dist} Summary: Ruby JSON Schema Validator Group: Development/Languages License: MIT URL: http://github.com/ruby-json-schema/json-schema Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem # git clone http://github.com/ruby-json-schema/json-schema && cd json-schema # git checkout 20734c1bc388fdc16d53837b2ce9599f21cfa4b7 # tar -czf rubygem-json-schema-2.8.0-test.tgz test/ Source1: %{name}-%{version}-test.tgz # for old addressable <= 2.3.8 # (not intended for upstream) Patch0: %{name}-addressable-2.3.patch # for even older addressable <= 2.3.6 # (not intended for upstream) Patch1: %{name}-addressable-epel7.patch BuildArch: noarch BuildRequires: rubygems-devel >= 1.8 BuildRequires: ruby >= 1.9 %if 0%{?rhel} && 0%{?rhel} <= 7 BuildRequires: rubygem(minitest5) %else BuildRequires: rubygem(minitest) >= 5.0 BuildRequires: rubygem(minitest) < 6 %endif BuildRequires: rubygem(webmock) %if 0%{?rhel} && 0%{?rhel} <= 7 Requires: ruby(rubygems) Requires: rubygem(addressable) Provides: rubygem(%{gem_name}) = %{version} %endif %description Ruby JSON Schema Validator. %package doc Summary: Documentation for %{name} Group: Documentation BuildArch: noarch Requires: %{name} = %{version}-%{release} %description doc Documentation for %{name}. %prep gem unpack %{SOURCE0} %setup -q -D -T -n %{gem_name}-%{version} tar -xzf %{SOURCE1} # addressable < 2.4 %patch0 -p1 %if 0%{?rhel} && 0%{?rhel} <= 7 # addressable <= 2.3.6 %patch1 -p1 %endif # remove unused shebang sed -e '1d' -i lib/json-schema/util/uuid.rb gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec # patched to support addresable < 2.4 sed -i -e 's/\(addressable.*\)\[.*\]/\1["<2.4"]/' %{gem_name}.gemspec %build gem build %{gem_name}.gemspec %gem_install %install mkdir -p %{buildroot}%{gem_dir} cp -a .%{gem_dir}/* \ %{buildroot}%{gem_dir}/ %check cp -pr test/ ./%{gem_instdir} pushd .%{gem_instdir} ruby -Ilib -e 'Dir.glob "./test/*_test.rb", &method(:require)' rm -rf test popd %files %dir %{gem_instdir}/ %license %{gem_instdir}/LICENSE.md %{gem_libdir}/ %{gem_instdir}/resources/ %{gem_spec} %exclude %{gem_cache} %files doc %doc %{gem_docdir}/ %doc %{gem_instdir}/README.md %changelog * Sun May 07 2017 František Dvořák - 2.8.0-1 - Initial package