Permalink
Browse files

Project refresh for Rails 3.0 and Ruby 1.9

  • Loading branch information...
mperham committed Apr 20, 2011
1 parent b2f7dd2 commit 5d523d92695625db7a24acc3a6c9b65f58b780f7
Showing with 38 additions and 70 deletions.
  1. +5 −0 CHANGELOG
  2. +20 −0 LICENSE
  3. +3 −6 README
  4. +3 −16 Rakefile
  5. +0 −4 VERSION.yml
  6. +3 −20 deadlock_retry.gemspec
  7. +1 −22 lib/deadlock_retry.rb
  8. +3 −2 test/deadlock_retry_test.rb
View
@@ -1,5 +1,10 @@
deadlock_retry changes
+== v1.0.1
+
+* Modernize.
+* Drop support for Rails 2.1 and earlier.
+
== v1.0 - (2009-02-07)
* Add INNODB status logging for debugging deadlock issues.
View
20 LICENSE
@@ -0,0 +1,20 @@
+# Copyright (c) 2005 Jamis Buck
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
9 README
@@ -10,11 +10,8 @@ This capability is automatically added to ActiveRecord. No code changes or other
Add it to your Rails application by installing the gem:
- sudo gem install mperham-deadlock_retry
+ gem install deadlock_retry
-and including a reference to it in your application's config/environment.rb:
+and including a reference to it in your application's Gemfile:
- config.gem 'mperham-deadlock_retry', :lib => 'deadlock_retry', :source => 'http://gems.github.com'
-
-
-Copyright (c) 2005 Jamis Buck, released under the MIT license
+ gem 'deadlock_retry'
View
@@ -5,21 +5,8 @@ desc "Default task"
task :default => [ :test ]
Rake::TestTask.new do |t|
+ t.libs = ['lib', 'test']
t.test_files = Dir["test/**/*_test.rb"]
t.verbose = true
-end
-
-begin
- require 'jeweler'
-
- Jeweler::Tasks.new do |s|
- s.name = "deadlock_retry"
- s.email = "mperham@gmail.com"
- s.homepage = "http://github.com/mperham/deadlock_retry"
- s.description = s.summary = "Provides automatical deadlock retry and logging functionality for ActiveRecord and MySQL"
- s.authors = ["Jamis Buck", "Mike Perham"]
- s.files = FileList['README', 'Rakefile', 'version.yml', "{lib,test}/**/*", 'CHANGELOG']
- end
-rescue LoadError
- # Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com
-end
+ t.warning = true
+end
View
@@ -1,4 +0,0 @@
----
-:patch: 0
-:major: 1
-:minor: 0
View
@@ -2,28 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{deadlock_retry}
- s.version = "1.0.0"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.version = "1.1.0"
s.authors = ["Jamis Buck", "Mike Perham"]
- s.date = %q{2009-02-07}
- s.description = %q{Provides automatical deadlock retry and logging functionality for ActiveRecord and MySQL}
+ s.description = s.summary = %q{Provides automatic deadlock retry and logging functionality for ActiveRecord and MySQL}
s.email = %q{mperham@gmail.com}
- s.files = ["README", "Rakefile", "version.yml", "lib/deadlock_retry.rb", "test/deadlock_retry_test.rb", "CHANGELOG"]
- s.has_rdoc = true
+ s.files = `git ls-files`.split("\n")
s.homepage = %q{http://github.com/mperham/deadlock_retry}
- s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.1}
- s.summary = %q{Provides automatical deadlock retry and logging functionality for ActiveRecord and MySQL}
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 2
-
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
end
View
@@ -1,23 +1,3 @@
-# Copyright (c) 2005 Jamis Buck
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
module DeadlockRetry
def self.included(base)
@@ -59,9 +39,8 @@ def transaction_with_deadlock_handling(*objects, &block)
private
def in_nested_transaction?
- cn = connection
# open_transactions was added in 2.2's connection pooling changes.
- cn.respond_to?(:open_transactions) && cn.open_transactions != 0
+ connection.open_transactions != 0
end
def log_innodb_status
@@ -1,13 +1,14 @@
require 'rubygems'
# Change the version if you want to test a different version of ActiveRecord
-gem 'activerecord', '2.2.2'
+gem 'activerecord', '3.0.7'
require 'active_record'
require 'active_record/version'
puts "Testing ActiveRecord #{ActiveRecord::VERSION::STRING}"
require 'test/unit'
-require "#{File.dirname(__FILE__)}/../lib/deadlock_retry"
+require 'logger'
+require "deadlock_retry"
class MockModel
@@open_transactions = 0

0 comments on commit 5d523d9

Please sign in to comment.