%global gem_name httpclient %if 0%{?rhel} <= 6 && 0%{?fedora} <= 16 %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version} %global gem_libdir %{gem_instdir}/lib %global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem %global gem_spec %{gem_dir}/specifications/%%{gem_name}-%{version}.gemspec %global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version} %global rubyabi 1.8 %else %global rubyabi 1.9.1 %endif Summary: HTTP Client interface for ruby Name: rubygem-%{gem_name} Version: 2.3.2 Release: 5%{?dist} Group: Development/Languages License: (Ruby or BSD) and Public Domain URL: https://github.com/nahi/httpclient Source0: http://gems.rubyforge.org/gems/%{gem_name}-%{version}.gem Requires: ruby(abi) >= %{rubyabi} Requires: rubygems %if 0%{?rhel} <= 6 && 0%{?fedora} <= 16 BuildRequires: rubygems %else BuildRequires: rubygems-devel BuildRequires: rubygem(minitest) %endif BuildArch: noarch Provides: rubygem(%{gem_name}) = %{version} %description an interface to HTTP Client for the ruby language %package doc Summary: Documentation for %{name} Group: Documentation Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc Documentation for %{name} %prep gem unpack %{SOURCE0} %setup -q -D -T -n %{gem_name}-%{version} gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec %build mkdir -p ./%{gem_dir} gem build %{gem_name}.gemspec gem install -V \ --local \ --install-dir ./%{gem_dir} \ --bindir ./%{_bindir} \ --force \ %if 0%{?rhel} <= 6 && 0%{?fedora} <= 16 --no-rdoc \ --no-ri \ %else --rdoc \ %endif %{gem_name}-%{version}.gem %install mkdir -p %{buildroot}%{gem_dir} cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/ # Remove backup and yardoc files find %{buildroot}/%{gem_instdir} -type f -name "*~" -delete rm -rf %{buildroot}%{gem_instdir}/.yardoc # Fix anything executable that does not have a shebang for file in `find %{buildroot}/%{gem_instdir} -type f -perm /a+x`; do [ -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 644 $file done # Find files with a shebang that do not have executable permissions for file in `find %{buildroot}/%{gem_instdir} -type f ! -perm /a+x -name "*.rb"`; do [ ! -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 755 $file done # Find files that have non-standard-executable-perm find %{buildroot}/%{gem_instdir} -type f -perm /g+wx -exec chmod -v g-w {} \; # Find files that are not readable find %{buildroot}/%{gem_instdir} -type f ! -perm /go+r -exec chmod -v go+r {} \; %check pushd %{buildroot}%{gem_instdir} testrb -Ilib test popd %files %dir %{gem_instdir} %{gem_instdir}/bin/ %{gem_instdir}/lib/ %doc %{gem_instdir}/sample %exclude %{gem_cache} %{gem_spec} %files doc %doc %{gem_docdir} %doc %{gem_instdir}/README.txt %doc %{gem_instdir}/test %changelog * Thu Feb 28 2013 Troy Dawson - 2.3.2-5 - Fix check to work on EPEL6 * Wed Feb 27 2013 Troy Dawson - 2.3.2-4 - Set License to (Ruby or BSD) and Public Domain * Tue Feb 05 2013 Troy Dawson - 2.3.2-3 - Fix URL - Removed line that changed /usr/bin/env to /usr/bin/ruby * Mon Jan 21 2013 Troy Dawson - 2.3.2-2 - Add Check section - Put docs in own rpm * Mon Jan 07 2013 Troy Dawson - 2.3.2-1 - Update to 2.3.2 - Change spec to Fedora ruby standards * Mon Sep 19 2011 Scott Henson - 2.2.1-1 - Initial Packaging