[rubygem-activeresource] update to activeresource 3.0.3

Mohammed Morsi mmorsi at fedoraproject.org
Thu Feb 3 16:24:12 UTC 2011


commit 424a7634fc90b3bd46ea18a6939b47635ffd3017
Author: Mohammed Morsi <mmorsi at redhat.com>
Date:   Thu Feb 3 11:23:45 2011 -0500

    update to activeresource 3.0.3

 .gitignore                        |    1 +
 Rakefile                          |   65 +++++++++++++++++++++++++++++++++++++
 activeresource-rakefile-fix.patch |   15 ++++++++
 activeresource-tests-fix.patch    |    8 ++++
 activeresource-tests.tgz          |  Bin 0 -> 22064 bytes
 rubygem-activeresource.spec       |   59 ++++++++++++++++++++++++++++------
 sources                           |    2 +-
 7 files changed, 139 insertions(+), 11 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 1fa07ea..28126d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 activeresource-2.3.5.gem
 /activeresource-2.3.8.gem
+/activeresource-3.0.3.gem
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..905241a
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,65 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/packagetask'
+require 'rake/gempackagetask'
+
+desc "Default Task"
+task :default => [ :test ]
+
+# Run the unit tests
+
+Rake::TestTask.new { |t|
+  t.libs << "test"
+  t.pattern = 'test/**/*_test.rb'
+  t.warning = true
+}
+
+namespace :test do
+  task :isolated do
+    ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
+    activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib"
+    Dir.glob("test/**/*_test.rb").all? do |file|
+      system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file)
+    end or raise "Failures"
+  end
+end
+
+spec = eval(File.read('activeresource.gemspec'))
+
+Rake::GemPackageTask.new(spec) do |p|
+  p.gem_spec = spec
+end
+
+task :lines do
+  lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
+
+  for file_name in FileList["lib/active_resource/**/*.rb"]
+    next if file_name =~ /vendor/
+    f = File.open(file_name)
+
+    while line = f.gets
+      lines += 1
+      next if line =~ /^\s*$/
+      next if line =~ /^\s*#/
+      codelines += 1
+    end
+    puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
+
+    total_lines     += lines
+    total_codelines += codelines
+
+    lines, codelines = 0, 0
+  end
+
+  puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
+end
+
+
+# Publishing ------------------------------------------------------
+
+desc "Release to gemcutter"
+task :release => :package do
+  require 'rake/gemcutter'
+  Rake::Gemcutter::Tasks.new(spec).define
+  Rake::Task['gem:push'].invoke
+end
diff --git a/activeresource-rakefile-fix.patch b/activeresource-rakefile-fix.patch
new file mode 100644
index 0000000..1f44f7c
--- /dev/null
+++ b/activeresource-rakefile-fix.patch
@@ -0,0 +1,15 @@
+--- Rakefile.orig	2011-01-11 00:54:44.250505942 -0500
++++ Rakefile	2011-01-11 00:54:51.394505931 -0500
+@@ -24,12 +24,6 @@ namespace :test do
+   end
+ end
+ 
+-spec = eval(File.read('activeresource.gemspec'))
+-
+-Rake::GemPackageTask.new(spec) do |p|
+-  p.gem_spec = spec
+-end
+-
+ task :lines do
+   lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
+ 
diff --git a/activeresource-tests-fix.patch b/activeresource-tests-fix.patch
new file mode 100644
index 0000000..b7ed35f
--- /dev/null
+++ b/activeresource-tests-fix.patch
@@ -0,0 +1,8 @@
+--- test/abstract_unit.rb.orig	2011-01-11 00:58:23.280505705 -0500
++++ test/abstract_unit.rb	2011-01-11 00:58:30.357505970 -0500
+@@ -1,4 +1,4 @@
+-require File.expand_path('../../../load_paths', __FILE__)
++require 'rubygems'
+ 
+ lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
+ $:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
diff --git a/activeresource-tests.tgz b/activeresource-tests.tgz
new file mode 100644
index 0000000..982a7ca
Binary files /dev/null and b/activeresource-tests.tgz differ
diff --git a/rubygem-activeresource.spec b/rubygem-activeresource.spec
index b339c2e..3babc06 100644
--- a/rubygem-activeresource.spec
+++ b/rubygem-activeresource.spec
@@ -1,5 +1,4 @@
 # Generated from activeresource-2.0.1.gem by gem2rpm -*- rpm-spec -*-
-%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
 %define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
 %define gemname activeresource
 %define geminstdir %{gemdir}/gems/%{gemname}-%{version}
@@ -9,20 +8,43 @@
 Summary: Active Record for web resources
 Name: rubygem-%{gemname}
 Epoch: 1
-Version: 2.3.8
+Version: 3.0.3
 Release: 1%{?dist}
 Group: Development/Languages
 License: MIT
 URL: http://www.rubyonrails.org
-Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
+
+Source0: http://rubygems.org/downloads/activeresource-%{version}.gem
+
+# The activeresource gem doesn't ship with the upstream Rakefile
+Source1: http://github.com/rails/rails/raw/v%{version}/%{gemname}/Rakefile
+
+# Also the activeresource 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/activeresource/
+# git checkout v3.0.3
+# tar czvf activeresource-tests.tgz test/
+Source2: activeresource-tests.tgz
+
+# Remove a task which breaks the Rakefile due to the gemspec
+# not being present in the gem
+Patch0: activeresource-rakefile-fix.patch
+
+# Removes code which breaks the test suite due to a
+# dependency on a file in the greater rails proj
+Patch1: activeresource-tests-fix.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: rubygems
 Requires: rubygem(activesupport) = %{version}
+Requires: rubygem(activemodel) = %{version}
 Requires: ruby(abi) = %{rubyabi}
 BuildRequires: rubygems
-BuildRequires(check): rubygem(rake)
-BuildRequires(check): rubygem(mocha)
-BuildRequires(check): rubygem(activesupport) = %{version}
+BuildRequires: rubygem(rake)
+BuildRequires: rubygem(mocha)
+BuildRequires: rubygem(activesupport) = %{version}
+BuildRequires: rubygem(activemodel) = %{version}
 BuildArch: noarch
 Provides: rubygem(%{gemname}) = %{version}
 
@@ -32,14 +54,27 @@ REST.
 
 
 %prep
+%setup -q -c -T
+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
 
 %build
 
 %install
-rm -rf %{buildroot}
 mkdir -p %{buildroot}%{gemdir}
-gem install --local --install-dir %{buildroot}%{gemdir} \
-            --force --rdoc %{SOURCE0}
+cp -a .%{gemdir}/* %{buildroot}%{gemdir}
 
 # Remove backup files
 find %{buildroot}/%{geminstdir} -type f -name "*~" -delete
@@ -68,8 +103,9 @@ rake test --trace
 %defattr(-, root, root, -)
 %dir %{geminstdir}
 %doc %{geminstdir}/CHANGELOG
+%doc %{geminstdir}/examples
 %{geminstdir}/lib
-%doc %{geminstdir}/README
+%doc %{geminstdir}/README.rdoc
 %{geminstdir}/Rakefile
 %{geminstdir}/test
 %doc %{gemdir}/doc/%{gemname}-%{version}
@@ -78,6 +114,9 @@ rake test --trace
 
 
 %changelog
+* Mon Jan 10 2011 Mohammed Morsi <mmorsi at redhat.com> - 1:3.0.3-1
+- Update to rails 3
+
 * Mon Aug 09 2010 Mohammed Morsi <mmorsi at redhat.com> - 1:2.3.8-1
 - Update to 2.3.8
 
diff --git a/sources b/sources
index 9335f15..c3e705c 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-7318e7652bd17433e4fec17fe9a201b7  activeresource-2.3.8.gem
+f07e36ed2d87ad33ec82e701cf9f6b6c  activeresource-3.0.3.gem


More information about the scm-commits mailing list