%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %global gemname calendar_date_select %global geminstdir %{gemdir}/gems/%{gemname}-%{version} Summary: A popular date picker widget for ruby on rails and prototype.js Name: rubygem-%{gemname} Version: 1.15 Release: 4%{?dist} Group: Development/Languages License: MIT URL: http://rubyforge.org/projects/cds/ Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: ruby(abi) = 1.8 Requires: rubygems BuildRequires: dos2unix BuildRequires: rubygems BuildRequires: rubygem(activesupport) BuildRequires: rubygem(hoe) BuildRequires: rubygem(ZenTest) BuildArch: noarch Provides: rubygem(%{gemname}) = %{version} %description A popular date picker widget for ruby on rails and prototype.js %prep %build %install rm -rf %{buildroot} mkdir -p %{buildroot}%{gemdir} gem install --local --install-dir %{buildroot}%{gemdir} \ --force --rdoc %{SOURCE0} # Remove backup files find %{buildroot}/%{geminstdir} -type f -name "*~" -delete # Fix anything executable that does not have a shebang for file in `find %{buildroot}/%{geminstdir} -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}/%{geminstdir} -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}/%{geminstdir} -type f -perm /g+wx -exec chmod -v g-w {} \; # Find files that are not readable find %{buildroot}/%{geminstdir} -type f ! -perm /go+r -exec chmod -v go+r {} \; # Remove these hidden files rm -rf %{buildroot}/%{geminstdir}/.project rm -rf %{buildroot}/%{geminstdir}/.loadpath # Convert the LICENSE file to something READABLE dos2unix %{buildroot}/%{geminstdir}/MIT-LICENSE # Copy README.txt to the correct location cp -a %{buildroot}/%{geminstdir}/Readme.txt %{buildroot}/%{geminstdir}/README.txt %check pushd %{buildroot}/%{geminstdir} rake default # Should succeed rake audit || : # Doesn't necessarily succeed popd %clean rm -rf %{buildroot} %files %defattr(-, root, root, -) %dir %{geminstdir} %doc %{geminstdir}/History.txt %doc %{geminstdir}/MIT-LICENSE %doc %{geminstdir}/Manifest.txt %doc %{geminstdir}/Rakefile %doc %{geminstdir}/Readme.txt %doc %{geminstdir}/README.txt %{geminstdir}/js_test/ %{geminstdir}/lib/ %{geminstdir}/public/ %{geminstdir}/spec/ %{geminstdir}/init.rb %doc %{gemdir}/doc/%{gemname}-%{version} %{gemdir}/cache/%{gemname}-%{version}.gem %{gemdir}/specifications/%{gemname}-%{version}.gemspec %changelog * Sat Jan 9 2010 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 1.15-4 - Tidy up spec (remove unused macro) * Sun Dec 20 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 1.15-3 - Fix %%define -> %%global - Fix license file CRLFs (dos2unix) - Execute tests * Wed Oct 21 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 1.15-2 - Fix license * Wed Oct 14 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 1.15-1 - First package