%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']") %define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) %define gemname rails %define geminstdir %{gemdir}/gems/%{gemname}-%{version} Summary: Web-application framework Name: rubygem-%{gemname} Version: 2.3.3 Release: 1 Group: Development/Languages License: MIT URL: http://www.rubyonrails.org Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: rubygems >= 1.1.1 Requires: rubygem-rake >= 0.8.3 Requires: rubygem-activesupport = %{version} Requires: rubygem-activerecord = %{version} Requires: rubygem-actionpack = %{version} Requires: rubygem-actionmailer = %{version} Requires: rubygem-activeresource = %{version} BuildRequires: rubygems BuildArch: noarch %description Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates. %prep %install rm -rf %{buildroot} mkdir -p %{buildroot}%{gemdir} gem install --local --install-dir %{buildroot}%{gemdir} \ -V \ --force %{SOURCE0} mkdir -p %{buildroot}/%{_bindir} mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir} rmdir %{buildroot}%{gemdir}/bin find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x sed -i '1i#!/usr/bin/ruby\n' %{buildroot}%{geminstdir}/bin/rails for file in `find %{buildroot}/%{geminstdir}/ -type f -perm /a+x`; do sed -i -e '1s|%{_bindir}/env ruby|%{_bindir}/ruby|' $file chmod 755 $file done find %{buildroot}/%{geminstdir} -type f -name "*~" -delete #find %{buildroot}/%{geminstdir} -type f -size 0c -exec rm -rvf {} \; for file in `find %{buildroot}/%{geminstdir} -type f -perm /a+x`; do [ -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 644 $file done # For sure... find %{buildroot} -name \*.gem | xargs chmod 0644 # 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 {} \; %clean rm -rf %{buildroot} %files %defattr(-, root, root, -) %dir %{geminstdir} %{geminstdir}/bin %{geminstdir}/builtin %doc %{geminstdir}/CHANGELOG %{geminstdir}/configs %{geminstdir}/dispatches %{geminstdir}/doc %{geminstdir}/environments %{geminstdir}/fresh_rakefile %{geminstdir}/guides %{geminstdir}/helpers %{geminstdir}/html %{geminstdir}/lib %doc %{geminstdir}/MIT-LICENSE %{geminstdir}/Rakefile %doc %{geminstdir}/README %{_bindir}/rails %{gemdir}/cache/%{gemname}-%{version}.gem %{gemdir}/specifications/%{gemname}-%{version}.gemspec