distributed_mutex 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Rakefile +4 -5
  2. data/VERSION +1 -1
  3. data/lib/mysql_mutex.rb +19 -11
  4. data/spec/spec_helper.rb +0 -1
  5. metadata +11 -8
data/Rakefile CHANGED
@@ -17,13 +17,12 @@ rescue LoadError
17
17
  end
18
18
 
19
19
  begin
20
- require 'spec/rake/spectask'
20
+ require 'rspec/core/rake_task'
21
21
 
22
- Spec::Rake::SpecTask.new('spec') do |t|
23
- t.spec_opts = ["-f specdoc", "-c"]
24
- t.spec_files = FileList['spec/*_spec.rb']
22
+ RSpec::Core::RakeTask.new('spec') do |t|
23
+ t.rspec_opts = ["-fd", "-c"]
24
+ t.pattern = 'spec/**/*_spec.rb'
25
25
  end
26
-
27
26
  rescue LoadError
28
27
  desc 'Spec rake task not available'
29
28
  task :spec do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
data/lib/mysql_mutex.rb CHANGED
@@ -85,22 +85,30 @@ class MySQLMutex < DistributedMutex
85
85
  end
86
86
 
87
87
  at_exit do
88
- locks = MySQLMutex.active_locks
89
- locks.delete_if do |k, v|
90
- v.empty?
91
- end
88
+ begin
89
+ locks = MySQLMutex.active_locks
90
+ locks.delete_if do |k, v|
91
+ v.empty?
92
+ end
92
93
 
93
- if locks.size > 0
94
- if defined?(Rails)
95
- Rails.logger.error("MySQLMutex: Locks still active! - #{locks.inspect}")
94
+ if locks.size > 0
95
+ if defined?(Rails)
96
+ Rails.logger.error("MySQLMutex: Locks still active! - #{locks.inspect}")
97
+ else
98
+ STDERR.puts("MySQLMutex: Locks still active! - #{locks.inspect}")
99
+ end
96
100
  else
97
- STDERR.puts("MySQLMutex: Locks still active! - #{locks.inspect}")
101
+ if defined?(Rails)
102
+ Rails.logger.debug("MySQLMutex: All locks released.")
103
+ else
104
+ STDERR.puts("MySQLMutex: All locks released.")
105
+ end
98
106
  end
99
- else
107
+ rescue => err
100
108
  if defined?(Rails)
101
- Rails.logger.debug("MySQLMutex: All locks released.")
109
+ Rails.logger.error("MySQLMutex: #{err.message}")
102
110
  else
103
- STDERR.puts("MySQLMutex: All locks released.")
111
+ STDERR.puts("MySQLMutex: #{err.message}")
104
112
  end
105
113
  end
106
114
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
- require 'spec'
3
2
 
4
3
  $:.unshift "#{File.dirname(__FILE__)}/../lib"
5
4
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed_mutex
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 0
9
- version: 1.1.0
9
+ - 1
10
+ version: 1.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Birkir A. Barkarson
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-12-10 00:00:00 +09:00
18
+ date: 2011-09-29 00:00:00 +09:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -51,27 +52,29 @@ rdoc_options: []
51
52
  require_paths:
52
53
  - lib
53
54
  required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
54
56
  requirements:
55
57
  - - ">="
56
58
  - !ruby/object:Gem::Version
59
+ hash: 3
57
60
  segments:
58
61
  - 0
59
62
  version: "0"
60
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
61
65
  requirements:
62
66
  - - ">="
63
67
  - !ruby/object:Gem::Version
68
+ hash: 3
64
69
  segments:
65
70
  - 0
66
71
  version: "0"
67
72
  requirements: []
68
73
 
69
74
  rubyforge_project:
70
- rubygems_version: 1.3.6
75
+ rubygems_version: 1.3.7
71
76
  signing_key:
72
77
  specification_version: 3
73
78
  summary: API for using a unique mutex across all instances of your application.
74
- test_files:
75
- - spec/global_mutex_spec.rb
76
- - spec/mysql_mutex_spec.rb
77
- - spec/spec_helper.rb
79
+ test_files: []
80
+