1b29e6e
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
1b29e6e
%global gemname thin
1b29e6e
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
1b29e6e
%global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')
1b29e6e
%global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
1b29e6e
%global rubyabi 1.8 
1b29e6e
1b29e6e
Summary: A thin and fast web server
1b29e6e
Name: rubygem-%{gemname}
1b29e6e
Version: 1.2.5
1b29e6e
Release: 5%{?dist}
1b29e6e
Group: Development/Languages
1b29e6e
License: (GPLv2 or Ruby) and BSD and MIT
1b29e6e
URL: http://code.macournoyer.com/thin/
1b29e6e
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
1b29e6e
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
1b29e6e
Requires: ruby(abi) = %{rubyabi} 
1b29e6e
Requires: rubygems
1b29e6e
Requires: rubygem(rack) >= 1.0.0
1b29e6e
Requires: rubygem(eventmachine) >= 0.12.6
1b29e6e
Requires: rubygem(daemons) >= 1.0.9
1b29e6e
BuildRequires: ruby(abi) = %{rubyabi} 
1b29e6e
BuildRequires: ruby-devel
1b29e6e
BuildRequires: ruby(rubygems) 
1b29e6e
BuildRequires: rubygem(rake)
1b29e6e
BuildRequires: rubygem(rake-compiler)
1b29e6e
BuildRequires: rubygem(rspec)
1b29e6e
BuildRequires: rubygem(eventmachine) >= 0.12.6
1b29e6e
BuildRequires: rubygem(daemons) >= 1.0.9
1b29e6e
BuildRequires: rubygem(rack) >= 1.0.0
1b29e6e
Provides: rubygem(%{gemname}) = %{version}
1b29e6e
1b29e6e
%description
1b29e6e
Thin is a Ruby web server that glues together three of the best Ruby 
1b29e6e
libraries in web history. 
1b29e6e
The Mongrel parser, the root of Mongrel speed and security, 
1b29e6e
Event Machine, a network I/O library with extremely high scalability and
1b29e6e
Rack, a minimal interface between webservers and Ruby frameworks.
1b29e6e
1b29e6e
%prep
1b29e6e
%setup -q -c -T 
1b29e6e
mkdir -p ./%{gemdir}
1b29e6e
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
1b29e6e
gem install \
1b29e6e
	--local \
1b29e6e
	--install-dir ./%{gemdir} \
1b29e6e
	-V --force \
1b29e6e
	%{SOURCE0}
1b29e6e
1b29e6e
%build
1b29e6e
1b29e6e
%install
1b29e6e
rm -rf %{buildroot}
1b29e6e
mkdir -p %{buildroot}%{ruby_sitearch}/%{gemname}
1b29e6e
mkdir -p %{buildroot}%{gemdir}
1b29e6e
mkdir -p %{buildroot}%{_prefix} 
1b29e6e
cp -a ./%{gemdir}/* %{buildroot}%{gemdir}
1b29e6e
mv -f %{buildroot}%{geminstdir}/lib/*.so %{buildroot}%{ruby_sitearch}/
1b29e6e
mv -f %{buildroot}%{gemdir}/bin %{buildroot}%{_prefix} 
1b29e6e
for f in $(find %{buildroot}%{geminstdir} -name \*.rb); do
1b29e6e
  sed -i -e '/^#!/d' $f 
1b29e6e
  chmod 0644 $f 
1b29e6e
done
1b29e6e
find %{buildroot}%{geminstdir} -type f -exec sed -i 's/^#!\/usr\/local\/bin\/ruby/#!\/usr\/bin\/ruby/g' {} \;
1b29e6e
rm -f %{buildroot}/spec/request/processing_spec.rb
1b29e6e
rm -rf %{buildroot}%{geminstdir}/{ext,tmp}/ 
1b29e6e
rm -f %{buildroot}%{geminstdir}/{.autotest,.require_paths} 
1b29e6e
1b29e6e
%check
1b29e6e
# https://bugzilla.redhat.com/show_bug.cgi?id=566401
1b29e6e
%ifarch ppc64
1b29e6e
exit 0
1b29e6e
%endif
1b29e6e
pushd ./%{geminstdir}
1b29e6e
rake spec2 --trace
1b29e6e
popd
1b29e6e
1b29e6e
%clean
1b29e6e
rm -rf %{buildroot}
1b29e6e
1b29e6e
%files
1b29e6e
%defattr(-, root, root, -)
1b29e6e
%{_bindir}/%{gemname} 
1b29e6e
%{ruby_sitearch}/thin_parser.so 
1b29e6e
%dir %{geminstdir}/ 
1b29e6e
%{geminstdir}/bin/
1b29e6e
%dir %{geminstdir}/lib
1b29e6e
%{geminstdir}/lib/thin.rb
1b29e6e
%{geminstdir}/lib/rack/
1b29e6e
%dir %{geminstdir}/lib/thin/
1b29e6e
%{geminstdir}/lib/thin/*.rb
1b29e6e
%{geminstdir}/lib/thin/backends/
1b29e6e
%{geminstdir}/lib/thin/controllers/
1b29e6e
%{gemdir}/cache/%{gemname}-%{version}.gem 
1b29e6e
%{gemdir}/specifications/%{gemname}-%{version}.gemspec 
1b29e6e
%doc %{gemdir}/doc/%{gemname}-%{version}
1b29e6e
%doc %{geminstdir}/benchmark/
1b29e6e
%doc %{geminstdir}/tasks/
1b29e6e
%doc %{geminstdir}/example/
1b29e6e
%doc %{geminstdir}/CHANGELOG
1b29e6e
%doc %{geminstdir}/README
1b29e6e
%doc %{geminstdir}/Rakefile
1b29e6e
%dir %{geminstdir}/spec/
1b29e6e
%doc %{geminstdir}/spec/backends/
1b29e6e
%doc %{geminstdir}/spec/*.rb
1b29e6e
%doc %{geminstdir}/spec/configs/
1b29e6e
%doc %{geminstdir}/spec/controllers/
1b29e6e
%doc %{geminstdir}/spec/perf/
1b29e6e
%doc %{geminstdir}/spec/rack/
1b29e6e
%doc %{geminstdir}/spec/request/
1b29e6e
%doc %{geminstdir}/spec/server/
1b29e6e
%dir %{geminstdir}/spec/rails_app/
1b29e6e
%doc %{geminstdir}/spec/rails_app/app/
1b29e6e
%doc %{geminstdir}/spec/rails_app/config/
1b29e6e
%doc %{geminstdir}/spec/rails_app/script/
1b29e6e
# MIT
1b29e6e
%doc %{geminstdir}/COPYING
1b29e6e
%{geminstdir}/spec/rails_app/public/
1b29e6e
# BSD
1b29e6e
%{geminstdir}/lib/thin/stats.html.erb
1b29e6e
1b29e6e
%changelog
1b29e6e
* Tue Feb 04 2010 Michal Fojtik <mfojtik@redhat.com> - 1.2.5-5
1b29e6e
- Excluded ppc64 in tests (566401)
1b29e6e
- Fixed Licensing
1b29e6e
1b29e6e
* Tue Feb 03 2010 Michal Fojtik <mfojtik@redhat.com> - 1.2.5-4
1b29e6e
- Added rspec tests
1b29e6e
- Fixed unwanted recompilation
1b29e6e
- Fixed licensing
1b29e6e
1b29e6e
* Tue Feb 02 2010 Michal Fojtik <mfojtik@redhat.com> - 1.2.5-3
1b29e6e
- Fixed description
1b29e6e
1b29e6e
* Tue Feb 02 2010 Michal Fojtik <mfojtik@redhat.com> - 1.2.5-2
1b29e6e
- Build fixed
1b29e6e
- Licence corrected
1b29e6e
- Added missing requires
1b29e6e
- Marked relevant files as documentation
1b29e6e
1b29e6e
* Tue Feb 02 2010 Michal Fojtik <mfojtik@redhat.com> - 1.2.5-1
1b29e6e
- Initial package
1b29e6e
1b29e6e