%global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global gemname typhoeus
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
%global rubyabi 1.8
Summary: A library for interacting with web services at blinding speed
Name: rubygem-%{gemname}
Version: 0.1.31
Release: 3%{?dist}
Group: Development/Languages
License: MIT
URL: http://github.com/pauldix/typhoeus
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
Patch0: %{name}-gcc-flags-fix.patch
Requires: rubygems
Requires: ruby(abi) = %{rubyabi}
Requires: rubygem(rack)
BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: rubygems
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(rake)
BuildRequires: rubygem(rack)
BuildRequires: rubygem(diff-lcs)
BuildRequires: rubygem(json)
BuildRequires: ruby-devel
BuildRequires: libcurl-devel
Provides: rubygem(%{gemname}) = %{version}
%description
Like a modern code version of the mythical beast with 100 serpent heads,
Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling
logic.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires:%{name} = %{version}-%{release}
%description doc
Documentation for %{name}
%prep
%setup -q -c -T
mkdir -p ./%{gemdir}
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
gem install \
--local \
--install-dir ./%{gemdir} \
-V --force --rdoc \
%{SOURCE0}
pushd .%{geminstdir}
%patch0
popd
%build
pushd .%{geminstdir}/ext/%{gemname}
(%_bindir/ruby extconf.rb && make clean all)
popd
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{gemdir}
cp -a ./%{gemdir}/* %{buildroot}%{gemdir}
mkdir -p %{buildroot}%{ruby_sitearch}/%{gemname}
mv -f %{buildroot}%{geminstdir}/ext/%{gemname}/*.so %{buildroot}%{ruby_sitearch}/%{gemname}
rm -rf %{buildroot}%{geminstdir}/ext
find %{buildroot}/%{geminstdir} -name .gitignore | xargs rm -f
# remove all shebang, set permission to 0644 (mtasaka)
for f in $(find %{buildroot}%{geminstdir} -name \*.rb)
do
sed -i -e '/^#!/d' $f
chmod 0644 $f
done
%check
pushd .%{geminstdir}
ln -sf %{buildroot}%{ruby_sitearch}/%{gemname}/native.so lib/%{gemname}/native.so
NEEDSKIP=""
for needskip in \
spec/%{gemname}/request_spec.rb \
spec/%{gemname}/hydra_spec.rb \
spec/%{gemname}/remote_spec.rb \
spec/%{gemname}/multi_spec.rb \
spec/%{gemname}/easy_spec.rb \
spec/%{gemname}/remote_proxy_object_spec.rb
do
NEEDSKIP="$NEEDSKIP $needskip"
done
for needskip in $NEEDSKIP
do
mv $needskip ${needskip}.save
done
rake spec --trace
for needskip in $NEEDSKIP
do
mv ${needskip}.save $needskip
done
rm -f lib/%{gemname}/native.so
popd
%clean
rm -rf %{buildroot}
%files
%defattr(-, root, root, -)
%dir %{geminstdir}
%dir %{ruby_sitearch}/%{gemname}
%{geminstdir}/lib
%{ruby_sitearch}/%{gemname}/*.so
%doc %{geminstdir}/VERSION
%doc %{geminstdir}/README.textile
%doc %{geminstdir}/CHANGELOG.markdown
%{gemdir}/cache/%{gemname}-%{version}.gem
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
%files doc
%defattr(-, root, root, -)
%{geminstdir}/Rakefile
%{geminstdir}/spec
%{geminstdir}/benchmarks
%{geminstdir}/examples
%{geminstdir}/profilers
%{geminstdir}/%{gemname}.gemspec
%{gemdir}/doc/%{gemname}-%{version}
%changelog
* Thu Oct 14 2010 Michal Fojtik <mfojtik@redhat.com> - 0.1.31-3
- Preserved failing test files (thx. to mtasaka)
- Fixed macros usage
- Replaced path with macro
- Removed libcurl from requires
* Wed Oct 13 2010 Michal Fojtik <mfojtik@redhat.com> - 0.1.31-2
- Fixed License to MIT
- Fixed libcurl BuildRequire
- Gem now recompiles with correct GCC flags
- Directory issues should be fixed
- Removed -devel subpackage
- Added tests
* Wed Oct 06 2010 Michal Fojtik <mfojtik@redhat.com> - 0.1.31-1
- Initial package