switch_board 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +6 -1
- data/Gemfile.lock +6 -6
- data/lib/switch_board/datasets/redis_dataset.rb +3 -3
- data/lib/switch_board/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/switch_board_spec.rb +21 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b59f9575acf1038a007b8d98933603e0255dff44
|
4
|
+
data.tar.gz: 92ad04bcebe233e0c3e096da2463fe72be60127c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f88c09d7d9e96131d685589c10490f06ac60a429d785f01f496d0bf5292762f1dbbc9619660bf25ee4703e9c66ab2afebb08182c6268f3cc580443b4612f946
|
7
|
+
data.tar.gz: 83ad97ce6486f97bd6dbf15e788f734982ac764b241aa6a49e5e784b6bb6fabe5db8156dfb818b88c191ba4be5884bf628d0a3803173e80bf8b122b96512c111
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
switch_board (0.1.
|
4
|
+
switch_board (0.1.4)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -11,8 +11,8 @@ GEM
|
|
11
11
|
json (1.8.0)
|
12
12
|
rdoc (4.0.1)
|
13
13
|
json (~> 1.4)
|
14
|
-
redis (3.0.
|
15
|
-
redis-objects (0.
|
14
|
+
redis (3.0.4)
|
15
|
+
redis-objects (0.7.0)
|
16
16
|
redis (>= 3.0.2)
|
17
17
|
rsolr (1.0.9)
|
18
18
|
builder (>= 2.1.2)
|
@@ -20,10 +20,10 @@ GEM
|
|
20
20
|
rspec-core (~> 2.14.0)
|
21
21
|
rspec-expectations (~> 2.14.0)
|
22
22
|
rspec-mocks (~> 2.14.0)
|
23
|
-
rspec-core (2.14.
|
24
|
-
rspec-expectations (2.14.
|
23
|
+
rspec-core (2.14.5)
|
24
|
+
rspec-expectations (2.14.3)
|
25
25
|
diff-lcs (>= 1.1.3, < 2.0)
|
26
|
-
rspec-mocks (2.14.
|
26
|
+
rspec-mocks (2.14.3)
|
27
27
|
rubygems-tasks (0.2.4)
|
28
28
|
|
29
29
|
PLATFORMS
|
@@ -63,7 +63,7 @@ module SwitchBoard
|
|
63
63
|
|
64
64
|
|
65
65
|
def unlock_id(locker_uid, id_to_unlock)
|
66
|
-
@con.
|
66
|
+
@con.del("#{LOCK_MAP_KEY}_h", id_to_unlock, locker_uid)
|
67
67
|
end
|
68
68
|
|
69
69
|
def get_all_locked_ids
|
@@ -78,7 +78,7 @@ module SwitchBoard
|
|
78
78
|
|
79
79
|
def get_all_my_locked_ids(uid)
|
80
80
|
res = get_all_locked_ids
|
81
|
-
|
81
|
+
get_all_locked_ids.select {|key, key_uid| key_uid.to_s == uid.to_s }
|
82
82
|
end
|
83
83
|
|
84
84
|
##################### Private Methods #################
|
@@ -99,4 +99,4 @@ module SwitchBoard
|
|
99
99
|
|
100
100
|
end
|
101
101
|
|
102
|
-
end
|
102
|
+
end
|
data/lib/switch_board/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/switch_board_spec.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Add when debugging
|
4
|
+
# require 'pry'
|
5
|
+
# require 'pry-debugger'
|
6
|
+
|
1
7
|
describe SwitchBoard do
|
2
8
|
it "should have a VERSION constant" do
|
3
9
|
subject.const_get('VERSION').should_not be_empty
|
@@ -20,14 +26,14 @@ describe :Configuration do
|
|
20
26
|
end
|
21
27
|
|
22
28
|
describe :ApplicationLifeCycle do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
it "should not lose locks with multiple workers starting a new dataset" do
|
30
|
+
dataset1 = SwitchBoard::Configuration.new(SwitchBoard::RedisDataset.new("127.0.0.1", 6379, "testing_playground")).dataset
|
31
|
+
dataset1.cleanup
|
32
|
+
dataset1.register_locker(1, "Moshe")
|
33
|
+
dataset1.list_lockers.count.should eq 1
|
34
|
+
dataset2 = SwitchBoard::Configuration.new(SwitchBoard::RedisDataset.new("127.0.0.1", 6379, "testing_playground")).dataset
|
35
|
+
#dataset1 should still show single locker
|
36
|
+
dataset1.list_lockers.count.should eq 1
|
31
37
|
end
|
32
38
|
|
33
39
|
it "should be possible to name switchboard dataset" do
|
@@ -160,6 +166,13 @@ describe :RedisDataset do
|
|
160
166
|
dataset.get_all_my_locked_ids(2).count.should eq 1
|
161
167
|
end
|
162
168
|
|
169
|
+
it "should unlock id successfully", :focus => true do
|
170
|
+
dataset.register_locker(1, "Pupik")
|
171
|
+
dataset.lock_id(2, "SOME_ID_6", 100)
|
172
|
+
dataset.get_all_my_locked_ids(2).count.should eq 1
|
173
|
+
dataset.unlock_id(2, "SOME_ID_6")
|
174
|
+
dataset.get_all_my_locked_ids(2).count.should eq 0
|
175
|
+
end
|
163
176
|
|
164
177
|
end
|
165
178
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switch_board
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avner Cohen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|