rubygem-multi_json/rubygem-multi_json.spec

66 lines
1.9 KiB
RPMSpec
Raw Normal View History

2020-08-28 14:18:44 +08:00
%global gem_name multi_json
Name: rubygem-%{gem_name}
Version: 1.13.1
Release: 1
Summary: A common interface to multiple JSON libraries
License: MIT
URL: http://github.com/intridea/multi_json
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# git clone https://github.com/intridea/multi_json.git && cd multi_json
# git checkout v1.13.1 && tar czvf multi_json-1.13.1-tests.tgz ./spec/
Source1: %{gem_name}-%{version}-tests.tgz
BuildRequires: ruby(release) rubygems-devel >= 1.3.5 ruby rubygem(rspec) rubygem(json_pure)
BuildArch: noarch
Provides: bundled(okjson) = 45
%description
A common interface to multiple JSON libraries, including Oj, Yajl, the JSON
gem (with C-extensions), the pure-Ruby JSON gem, NSJSONSerialization, gson.rb,
JrJackson, and OkJson.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -c -T
%gem_install -n %{SOURCE0}
%build
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd .%{gem_instdir}
tar xf %{SOURCE1}
sed -i '138,165 s/^/#/' spec/multi_json_spec.rb
sed -i "/expect(MultiJson.adapter.to_s).to eq('MultiJson::Adapters::Oj')/ s/Oj/JsonGem/" spec/multi_json_spec.rb
rspec spec/{multi_json,options_cache}_spec.rb
rm spec/{oj,yajl}_adapter_spec.rb
for adapter in spec/*_adapter_spec.rb; do
rspec $adapter
done
popd
%files
%dir %{gem_instdir}
%license %{gem_instdir}/LICENSE.md
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/CONTRIBUTING.md
%doc %{gem_instdir}/README.md
%changelog
* Sat Aug 22 2020 Jeffery.Gao <gaojianxing@huawei.com> - 1.13.1-1
- Package init