mega_mutex 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/VERSION +1 -1
- data/lib/mega_mutex/distributed_mutex.rb +2 -1
- data/mega_mutex.gemspec +8 -6
- data/spec/lib/mega_mutex_spec.rb +9 -3
- metadata +4 -3
data/History.txt
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/mega_mutex.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mega_mutex}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Johnson", "Matt Wynne"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-16}
|
13
13
|
s.description = %q{Distributed mutex for Ruby}
|
14
14
|
s.email = %q{developers@songkick.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
"History.txt",
|
22
23
|
"LICENSE",
|
23
24
|
"README.markdown",
|
24
25
|
"Rakefile",
|
@@ -35,8 +36,8 @@ Gem::Specification.new do |s|
|
|
35
36
|
s.rubygems_version = %q{1.3.5}
|
36
37
|
s.summary = %q{Distributed mutex for Ruby}
|
37
38
|
s.test_files = [
|
38
|
-
"spec/
|
39
|
-
"spec/
|
39
|
+
"spec/spec_helper.rb",
|
40
|
+
"spec/lib/mega_mutex_spec.rb"
|
40
41
|
]
|
41
42
|
|
42
43
|
if s.respond_to? :specification_version then
|
@@ -55,3 +56,4 @@ Gem::Specification.new do |s|
|
|
55
56
|
s.add_dependency(%q<logging>, [">= 1.1.4"])
|
56
57
|
end
|
57
58
|
end
|
59
|
+
|
data/spec/lib/mega_mutex_spec.rb
CHANGED
@@ -2,12 +2,21 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
2
|
|
3
3
|
module MegaMutex
|
4
4
|
describe MegaMutex do
|
5
|
+
include MegaMutex
|
6
|
+
|
5
7
|
def logger
|
6
8
|
Logging::Logger['Specs']
|
7
9
|
end
|
8
10
|
|
9
11
|
abort_on_thread_exceptions
|
10
12
|
|
13
|
+
describe "#with_distributed_mutex" do
|
14
|
+
it "returns the value returned by the block" do
|
15
|
+
result = with_distributed_mutex(nil) { 12345 }
|
16
|
+
result.should == 12345
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
11
20
|
describe "two blocks, one fast, one slow" do
|
12
21
|
before(:each) do
|
13
22
|
@errors = []
|
@@ -37,8 +46,6 @@ module MegaMutex
|
|
37
46
|
'tests-mutex-key'
|
38
47
|
end
|
39
48
|
|
40
|
-
include MegaMutex
|
41
|
-
|
42
49
|
[2, 20].each do |n|
|
43
50
|
describe "when #{n} blocks try to run at the same instant in the same process" do
|
44
51
|
it "should run each in turn" do
|
@@ -99,7 +106,6 @@ module MegaMutex
|
|
99
106
|
end
|
100
107
|
|
101
108
|
describe "with a timeout" do
|
102
|
-
include MegaMutex
|
103
109
|
|
104
110
|
it "should raise an error if the code blocks for longer than the timeout" do
|
105
111
|
@exception = nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mega_mutex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Johnson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
13
|
+
date: 2010-02-16 00:00:00 +00:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -45,6 +45,7 @@ extra_rdoc_files:
|
|
45
45
|
files:
|
46
46
|
- .document
|
47
47
|
- .gitignore
|
48
|
+
- History.txt
|
48
49
|
- LICENSE
|
49
50
|
- README.markdown
|
50
51
|
- Rakefile
|
@@ -83,5 +84,5 @@ signing_key:
|
|
83
84
|
specification_version: 3
|
84
85
|
summary: Distributed mutex for Ruby
|
85
86
|
test_files:
|
86
|
-
- spec/lib/mega_mutex_spec.rb
|
87
87
|
- spec/spec_helper.rb
|
88
|
+
- spec/lib/mega_mutex_spec.rb
|