File unicorn.spec of Package rubygem-unicorn

%if 0%{?fedora}%{?rhel} <= 6
  %global scl ruby193
  %global scl_prefix ruby193-
%{!?scl:%global pkg_name %{name}}
%{?scl:%scl_package rubygem-%{gem_name}}

%global gem_name unicorn
%global rubyabi 1.9.1

Summary: Rack HTTP server for fast clients and Unix
Name: %{?scl:%scl_prefix}rubygem-%{gem_name}
Version: 4.7.0
Release: 1%{?dist}
Group: Development/Languages
License: GPLv2+ and Ruby 1.8
%if 0%{?fedora} >= 19
Requires: ruby(release)
Requires: %{?scl:%scl_prefix}ruby(abi) >= %{rubyabi}
Requires: %{?scl:%scl_prefix}ruby(rubygems) 
Requires: %{?scl:%scl_prefix}rubygem(rack) 
Requires: %{?scl:%scl_prefix}rubygem(kgio) => 2.6
Requires: %{?scl:%scl_prefix}rubygem(kgio) < 3
Requires: %{?scl:%scl_prefix}rubygem(raindrops) => 0.7
Requires: %{?scl:%scl_prefix}rubygem(raindrops) < 1
%if 0%{?fedora}%{?rhel} <= 6
BuildRequires: %{?scl:%scl_prefix}build
BuildRequires: scl-utils-build
%if 0%{?fedora} >= 19
BuildRequires: ruby(release)
BuildRequires: rubypick
BuildRequires: %{?scl:%scl_prefix}ruby(abi) >= %{rubyabi}
BuildRequires: %{?scl:%scl_prefix}rubygems-devel 
BuildRequires: %{?scl:%scl_prefix}ruby-devel 
Provides: %{?scl:%scl_prefix}rubygem(%{gem_name}) = %{version}

\Unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between \Unicorn and slow clients.

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

%description doc
Documentation for %{name}

%{?scl:scl enable %scl "}
gem unpack %{SOURCE0}
%setup -q -D -T -n  %{gem_name}-%{version}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec

%{?scl:scl enable %scl - << \EOF}
gem build %{gem_name}.gemspec
%if 0%{?fedora} >= 19
export CONFIGURE_ARGS="--with-cflags='%{optflags}' $CONFIGURE_ARGS"
gem install -V \
        --local \
        --install-dir ./%{gem_dir}\
        --bindir ./%{_bindir} \
        --force \
        --rdoc \
        --ri \
        --backtrace \

rm -rf %{buildroot}

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

mkdir -p %{buildroot}%{gem_extdir_mri}/lib
mv %{buildroot}%{gem_instdir}/lib/ %{buildroot}%{gem_extdir_mri}/lib/

mkdir -p %{buildroot}%{_bindir}
cp -a .%{_bindir}/* %{buildroot}%{_bindir}/
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x

sed -i -e '1s/^#!.*$/#!\/usr\/bin\/env ruby/' %{buildroot}%{gem_instdir}/bin/unicorn
sed -i -e '1s/^#!.*$/#!\/usr\/bin\/env ruby/' %{buildroot}%{gem_instdir}/bin/unicorn_rails

# Remove build leftovers.
rm -rf %{buildroot}%{gem_instdir}/.yard*

%dir %{gem_instdir}
%doc %{gem_instdir}/COPYING
%doc %{gem_instdir}/Documentation
%doc %{gem_instdir}/man

%exclude %{gem_instdir}/.*

%exclude %{gem_instdir}/ext
%exclude %{gem_cache}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/GIT-VERSION-FILE
%doc %{gem_instdir}/GIT-VERSION-GEN
%doc %{gem_instdir}/FAQ
%doc %{gem_instdir}/README
%doc %{gem_instdir}/TUNING
%doc %{gem_instdir}/PHILOSOPHY
%doc %{gem_instdir}/HACKING
%doc %{gem_instdir}/DESIGN
%doc %{gem_instdir}/CONTRIBUTORS
%doc %{gem_instdir}/LICENSE
%doc %{gem_instdir}/SIGNALS
%doc %{gem_instdir}/KNOWN_ISSUES
%doc %{gem_instdir}/TODO
%doc %{gem_instdir}/NEWS
%doc %{gem_instdir}/ChangeLog
%doc %{gem_instdir}/LATEST
%doc %{gem_instdir}/ISSUES
%doc %{gem_instdir}/Sandbox
%doc %{gem_instdir}/Links
%doc %{gem_instdir}/Application_Timeouts

* Thu Oct 17 2013 Alex Lee <> - 4.7.0-1
- Initial package