Blob Blame History Raw
# Generated from activerecord-1.15.5.gem by gem2rpm -*- rpm-spec -*-
%global gemname activerecord

%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}

%global rubyabi 1.8

Summary: Implements the ActiveRecord pattern for ORM
Name: rubygem-%{gemname}
Epoch: 1
Version: 3.0.10
Release: 1%{?dist}
Group: Development/Languages
License: MIT
URL: http://www.rubyonrails.org
Source0: http://rubygems.org/downloads/activerecord-%{version}.gem

# The activerecord gem doesn't ship with the upstream Rakefile
Source1: http://github.com/rails/rails/raw/v%{version}/%{gemname}/Rakefile

# Also the activerecord gem doesn't ship with the test suite.
# You may check it out like so
# git clone http://github.com/rails/rails.git
# cd rails/activerecord/
# git checkout v3.0.10
# tar czvf activerecord-3.0.10-tests.tgz test/
Source2: activerecord-%{version}-tests.tgz

# Remove a task which breaks the Rakefile due to the gemspec
# not being present in the gem
Patch0: activerecord-rakefile-fix.patch

# Removes code which breaks the test suite due to a
# dependency on a file in the greater rails proj
Patch1: activerecord-tests-fix.patch

Patch2: activerecord-downgrade-dependencies.patch

Requires: ruby(abi) = %{rubyabi}
Requires: rubygems
Requires: rubygem(activesupport) = %{version}
Requires: rubygem(activemodel)   = %{version}
Requires: rubygem(arel) 
Requires: rubygem(tzinfo) >= 0.3.23
Requires: rubygem(i18n)
BuildRequires: rubygems
BuildRequires: rubygem(rake)
BuildRequires: rubygem(activesupport) = %{version}
BuildRequires: rubygem(activemodel)   = %{version}
BuildRequires: rubygem(sqlite3)
BuildRequires: rubygem(erubis)
BuildRequires: rubygem(mocha)
BuildRequires: rubygem(i18n)
BuildRequires: rubygem(arel) 
BuildRequires: rubygem(tzinfo) >= 0.3.23
BuildArch: noarch
Provides: rubygem(%{gemname}) = %{version}

%description
Implements the ActiveRecord pattern (Fowler, PoEAA) for ORM. It ties database
tables and classes together for business objects, like Customer or
Subscription, that can find, save, and destroy themselves without resorting to
manual SQL.

%prep
%setup -q -c -T

# rake test creates debug.log under %%{geminstdir},
# so let's install gem file under %%{_builddir} first

mkdir -p ./%{gemdir}
gem install --local --install-dir ./%{gemdir} \
            --force --rdoc %{SOURCE0}

# move the Rakefile in place
cp %{SOURCE1} .%{geminstdir}

# move the tests into place
tar xzvf %{SOURCE2} -C .%{geminstdir}

pushd ./%{geminstdir}
%patch0 -p0
%patch1 -p0
popd

pushd .%{gemdir}
%patch2 -p0
popd

# Remove backup files
find ./%{geminstdir} -type f -name "*~" -delete

# Delete zero-length files
# No! These are needed for rake test
# find ./%{geminstdir} -type f -size 0c -exec rm -rvf {} \;

# Fix anything executable that does not have a shebang
for file in `find ./%{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 ./%{geminstdir} -type f ! -perm /a+x -name "*.rb"`; do
    [ ! -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 755 $file
done

# this file is being marked as a doc, need to remove ruby executable path
# and mark as non-executable
sed -i -e 's/^#!\/usr\/bin\/env ruby//' ./%{geminstdir}/examples/performance.rb
chmod 0644 ./%{geminstdir}/examples/performance.rb

%build

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

%clean
rm -rf %{buildroot}

%check
pushd .%{geminstdir}

# to prevent a circular dependency w/ actionpack
mv test/cases/session_store/session_test.rb \
     test/cases/session_store/session_test.rb.norun

# Only test sqlite3 backend
rake test_sqlite3 --trace

%files
%defattr(-, root, root, -)
%dir %{geminstdir}
%doc %{geminstdir}/CHANGELOG
%doc %{geminstdir}/examples
%{geminstdir}/lib
%{geminstdir}/Rakefile
%doc %{geminstdir}/README.rdoc
%{geminstdir}/test

%doc %{gemdir}/doc/%{gemname}-%{version}
%{gemdir}/cache/%{gemname}-%{version}.gem
%{gemdir}/specifications/%{gemname}-%{version}.gemspec

%changelog
* Mon Aug 22 2011 Vít Ondruch <vondruch@redhat.com> - 1:3.0.10-1
- Update to ActiveRecord 3.0.10

* Mon Jul 04 2011 Vít Ondruch <vondruch@redhat.com> - 1:3.0.9-1
- Update to ActiveRecord 3.0.9

* Fri Mar 25 2011 Vít Ondruch <vondruch@redhat.com> - 1:3.0.5-1
- Updated to ActiveRecord 3.0.5

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:3.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Jan 10 2011 Mohammed Morsi <mmorsi@redhat.com> - 1:3.0.3-1
- Update to rails 3

* Wed Sep 08 2010 Mohammed Morsi <mmorsi@redhat.com> - 1:2.3.8-4
- Updated postgres fix to resolve security issue

* Mon Aug 16 2010 Mohammed Morsi <mmorsi@redhat.com> - 1:2.3.8-3
- Included postgres fix (patch also pushed upstream, see rails issue tracker)

* Thu Aug 12 2010 Mohammed Morsi <mmorsi@redhat.com> - 1:2.3.8-2
- Updated patch0 to correctly parse sqlite3 version

* Wed Aug 04 2010 Mohammed Morsi <mmorsi@redhat.com> - 1:2.3.8-1
- Update to 2.3.8

* Thu Jan 28 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1:2.3.5-1
- Update to 2.3.5

* Wed Oct  7 2009 David Lutterkort <lutter@redhat.com> - 1:2.3.4-2
- Bump Epoch to ensure upgrade path from F-11

* Fri Sep 18 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 2.3.4-1
- Update to 2.3.4
- Enable check

* Sun Jul 26 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 2.3.3-1
- New upstream version

* Mon Mar 16 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 2.3.2-1
- New upstream version

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Nov 24 2008 Jeroen van Meeuwen <kanarip@fedoraproject.org> - 2.2.2-1
- New upstream version
- Fixed rpmlint errors zero-length files and script-without-shebang

* Thu Nov 20 2008 David Lutterkort <lutter@redhat.com> - 2.1.1-2
- Do not mark lib/ as doc

* Tue Sep 16 2008 David Lutterkort <dlutter@redhat.com> - 2.1.1-1
- New version (fixes CVE-2008-4094)

* Thu Jul 31 2008 Michael Stahnke <stahnma@fedoraproject.org> - 2.1.0-1
- New Upstream

* Tue Apr  8 2008 David Lutterkort <dlutter@redhat.com> - 2.0.2-2
- Fix dependency

* Mon Apr 07 2008 David Lutterkort <dlutter@redhat.com> - 2.0.2-1
- New version

* Mon Dec 10 2007 David Lutterkort <dlutter@redhat.com> - 2.0.1-1
- New version

* Thu Nov 29 2007 David Lutterkort <dlutter@redhat.com> - 1.15.6-1
- New version

* Tue Nov 14 2007 David Lutterkort <dlutter@redhat.com> - 1.15.5-2
- Fix buildroot
- Properly mark docs in geminstdir

* Tue Oct 30 2007 David Lutterkort <dlutter@redhat.com> - 1.15.5-1
- Initial package