summaryrefslogtreecommitdiffstats
path: root/rubygem-activerecord.spec
diff options
context:
space:
mode:
authorKen Dreyer <ktdreyer@ktdreyer.com>2013-02-07 09:05:34 -0700
committerKen Dreyer <ktdreyer@ktdreyer.com>2013-02-12 22:12:59 -0700
commitda7b4699c1edad0898db1e944f056c5b2c5103fa (patch)
treeea9f0d3e95fd49b83e788088a0fe58c3043fd666 /rubygem-activerecord.spec
parent5a5bf511690b1f58874755d6fa8507168f2e7ee5 (diff)
downloadrubygem-activerecord-da7b4699c1edad0898db1e944f056c5b2c5103fa.tar.gz
rubygem-activerecord-da7b4699c1edad0898db1e944f056c5b2c5103fa.tar.xz
rubygem-activerecord-da7b4699c1edad0898db1e944f056c5b2c5103fa.zip
Downgrade to ActiveRecord 2.3.16 and add RHEL 6 compatibility
Diffstat (limited to 'rubygem-activerecord.spec')
-rw-r--r--rubygem-activerecord.spec115
1 files changed, 78 insertions, 37 deletions
diff --git a/rubygem-activerecord.spec b/rubygem-activerecord.spec
index 88a9528..8ac996a 100644
--- a/rubygem-activerecord.spec
+++ b/rubygem-activerecord.spec
@@ -1,11 +1,15 @@
# Generated from activerecord-1.15.5.gem by gem2rpm -*- rpm-spec -*-
%global gem_name activerecord
+%if 0%{?el6}
+%global rubyabi 1.8
+%else
%global rubyabi 1.9.1
+%endif
Summary: Implements the ActiveRecord pattern for ORM
Name: rubygem-%{gem_name}
Epoch: 1
-Version: 3.2.11
+Version: 2.3.16
Release: 1%{?dist}
Group: Development/Languages
License: MIT
@@ -13,28 +17,62 @@ URL: http://www.rubyonrails.org
Source0: http://rubygems.org/downloads/activerecord-%{version}.gem
# git clone http://github.com/rails/rails.git
# cd rails/activerecord/
-# git checkout v3.2.11
-# tar czvf activerecord-3.2.11-tests.tgz test/
+# git checkout v2.3.16
+# tar czvf activerecord-2.3.16-tests.tgz test/
Source1: activerecord-%{version}-tests.tgz
+
+# RDoc on RHEL 6 is too old to work with Rake.
+# Patch the Rakefile to remove it.
+Patch1: rubygem-activerecord-remove-rdoc-task.patch
+
+# Tests fail without f748d36b4014418c48553836a56b4bec74e15e49
+# See https://github.com/rails/rails/issues/4292
+# (Merged in Rails 3.0)
+# I've cherry-picked onto v2.3.16 to account for line number differences.
+Patch2: rubygem-activerecord-fix-more-failing-tests.patch
+
+# Test test_bind_enumerable fails without
+# a307fd6bd37d12d8ad6baa7e7fcfd0207e8b354a (merged in Rails 3.0)
+# I've cherry-picked onto v2.3.16.
+Patch3: rubygem-activerecord-fix-set-order.patch
+
+# Test test_cache_does_not_wrap_string_results_in_arrays fails:
+# NameError: uninitialized constant SQLite3::Version::VERSION
+# Fix is in b7e5a64e1612220d315f5a67d28879d331cee546
+# (merged in Rails 3.0).
+Patch4: rubygem-activerecord-sqlite-api.patch
+
+# Test test_serialize_should_allow_attribute_except_filtering and
+# test_serialize_should_be_reversible fail:
+# ActiveSupport::CoreExtensions::Hash::Conversions::DisallowedType: Disallowed type attribute: "yaml"
+# Patch the tests to avoid calling "from_xml".
+Patch5: rubygem-activerecord-xml-serialization.patch
+
Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems)
Requires: rubygem(activesupport) = %{version}
-Requires: rubygem(activemodel) = %{version}
-Requires: rubygem(arel)
-Requires: rubygem(tzinfo) >= 0.3.23
+%if 0%{?fedora}
BuildRequires: rubygems-devel
-BuildRequires: rubygem(bcrypt-ruby)
-BuildRequires: rubygem(activesupport) = %{version}
-BuildRequires: rubygem(activemodel) = %{version}
-BuildRequires: rubygem(sqlite3)
-BuildRequires: rubygem(erubis)
-BuildRequires: rubygem(mocha)
-BuildRequires: rubygem(arel)
-BuildRequires: rubygem(tzinfo) >= 0.3.23
-BuildRequires: rubygem(minitest)
+%else
+BuildRequires: ruby(rubygems)
+%endif
+BuildRequires(check): rubygem(rake)
+BuildRequires(check): rubygem(activesupport) = %{version}
+BuildRequires(check): rubygem(sqlite3-ruby)
+BuildRequires(check): rubygem(mocha)
+
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}
+# macros for RHEL6 compatibility:
+%{!?gem_dir: %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)}
+%{!?gem_instdir: %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}}
+%{!?gem_libdir: %global gem_libdir %{gem_instdir}/lib}
+%{!?gem_cache: %global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem}
+%{!?gem_spec: %global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec}
+%{!?gem_docdir: %global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}}
+%{!?gem_extdir: %global gem_extdir %{_libdir}/gems/exts/%{gem_name}-%{version}}
+
%description
Implements the ActiveRecord pattern (Fowler, PoEAA) for ORM. It ties database
tables and classes together for business objects, like Customer or
@@ -56,6 +94,20 @@ mkdir -p .%{gem_dir}
gem install --local --install-dir .%{gem_dir} \
--force --rdoc %{SOURCE0}
+# move the tests into place
+tar xzf %{SOURCE1} -C .%{gem_instdir}
+
+pushd .%{gem_instdir}
+%patch1 -p2
+%patch2 -p2
+%patch3 -p2
+%if 0%{?el6}
+# ActiveRecord needs Patch4 with RHEL 6's rubygem-sqlite3-ruby
+%patch4 -p2
+%endif
+%patch5 -p2
+popd
+
%build
%install
@@ -64,42 +116,31 @@ cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}
%check
pushd .%{gem_instdir}
-
-tar xzvf %{SOURCE1}
-
-# load_path is not available, remove its require.
-sed -i '1,2d' test/cases/helper.rb
-
-ruby -I.:test:lib << EOF
- test_files = Dir.glob( "test/cases/**/*_test.rb" )
- test_files.reject! { |x| x =~ %r|/adapters/| }
-
- # Only test sqlite3 backend
- test_files += Dir.glob("test/cases/adapters/sqlite3/*_test.rb")
-
- # To prevent a circular dependency w/ actionpack.
- test_files.delete('test/cases/session_store/session_test.rb')
-
- test_files.each { |f| require f }
-EOF
-
+ rake test_sqlite3 --trace
popd
%files
%dir %{gem_instdir}
%{gem_libdir}
-%doc %{gem_instdir}/MIT-LICENSE
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
-%doc %{gem_instdir}/CHANGELOG.md
-%doc %{gem_instdir}/README.rdoc
+%doc %{gem_instdir}/CHANGELOG
+%doc %{gem_instdir}/README
%doc %{gem_instdir}/examples
+%{gem_instdir}/RUNNING_UNIT_TESTS
+%{gem_instdir}/test
+%{gem_instdir}/install.rb
+%{gem_instdir}/Rakefile
%changelog
+* Thu Feb 07 2013 Ken Dreyer <ktdreyer@ktdreyer.com> - 1:2.3.16-1
+- Downgrade to ActiveRecord 2.3.16.
+- RHEL 6 compatibility
+
* Wed Jan 09 2013 Vít Ondruch <vondruch@redhat.com> - 1:3.2.11-1
- Update to ActiveRecord 3.2.11.