# gem2rpm gives a good spec ontline file. %global gemname faraday # We need check rubyabi and install dirs, because of the changes # of Fedora ruby packaging guidelines. Pls reference: # http://fedoraproject.org/wiki/Packaging:Ruby # Note: the macros, new, chkabi and chkdir, only work on Fedora and RHEL. %define new %(\ new=0;\ echo %{dist} | grep -q fc && [ %{fedora} -ge 17 ] && new=1;\ echo %{dist} | grep -q el && [ %{rhel} -ge 7 ] && new=1;\ echo $new;\ ) %define chkabi %([ %new -eq 1 ] && echo 1.91 || echo 1.8;) %define chkdir %([ %{new} -eq 1 ] && echo %{gem_dir} || ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gemdir %chkdir %global geminstdir %{gemdir}/gems/%{gemname}-%{version} %global rubyabi %chkabi Summary: HTTP/REST API client library Name: rubygem-%{gemname} Version: 0.8.0 Release: 1%{?dist} Group: Development/Languages License: GPLv2+ or Ruby URL: https://github.com/technoweenie/faraday Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem Requires: ruby(abi) = %{rubyabi} Requires: ruby(rubygems) >= 1.3.5 Requires: ruby Requires: rubygem(multipart-post) => 1.1 Requires: rubygem(multipart-post) < 2 BuildRequires: ruby(abi) = %{rubyabi} BuildRequires: ruby(rubygems) >= 1.3.5 BuildRequires: ruby BuildRequires: rubygem(webmock) BuildArch: noarch Provides: rubygem(%{gemname}) = %{version} %description Faraday is an HTTP client lib that provides a common interface over many adapters (such as Net::HTTP) and embraces the concept of Rack middleware when processing the request/response cycle. %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} \ --force %{SOURCE0} %build %install mkdir -p %{buildroot}%{gemdir} cp -a .%{gemdir}/* \ %{buildroot}%{gemdir}/ for f in Rakefile Gemfile LICENSE.md README.md config.ru faraday.gemspec;do rm -rf %{buildroot}%{geminstdir}/${f} done %check # test need some modules which aren't avaible now on Fedora. #pushd %{buildroot}%{geminstdir} #testrb -Ilib test #popd rm -rf %{buildroot}%{geminstdir}/test %files %dir %{geminstdir} %{geminstdir}/lib %exclude %{gemdir}/cache/%{gemname}-%{version}.gem %{gemdir}/specifications/%{gemname}-%{version}.gemspec %files doc %doc %{gemdir}/doc/%{gemname}-%{version} %changelog * Tue May 08 2012 xning - 0.8.0-1 - Initial package