turnpike 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/turnpike/queue.rb +5 -5
- data/lib/turnpike/version.rb +1 -1
- data/test/turnpike_test.rb +16 -0
- metadata +6 -6
data/README.md
CHANGED
data/lib/turnpike/queue.rb
CHANGED
@@ -52,7 +52,7 @@ module Turnpike
|
|
52
52
|
if redis_version >= '2.4'
|
53
53
|
redis.rpush name, items.map { |i| Marshal.dump i }
|
54
54
|
else
|
55
|
-
items.each { |i| redis.rpush name,
|
55
|
+
items.each { |i| redis.rpush name, Marshal.dump(i) }
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -73,7 +73,7 @@ module Turnpike
|
|
73
73
|
if redis_version >= '2.4'
|
74
74
|
redis.lpush name, items.map { |i| Marshal.dump i }
|
75
75
|
else
|
76
|
-
items.each { |i| redis.lpush name,
|
76
|
+
items.each { |i| redis.lpush name, Marshal.dump(i) }
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -83,8 +83,8 @@ module Turnpike
|
|
83
83
|
Redis.current ||= Redis.connect Turnpike.options
|
84
84
|
end
|
85
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
def redis_version
|
87
|
+
@redis_version ||= redis.info['redis_version']
|
88
|
+
end
|
89
89
|
end
|
90
90
|
end
|
data/lib/turnpike/version.rb
CHANGED
data/test/turnpike_test.rb
CHANGED
@@ -31,6 +31,14 @@ class TestTurnpike < Test::Unit::TestCase
|
|
31
31
|
assert_equal [1, 2, 3], queue.peek
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_push_2_2
|
35
|
+
queue = Turnpike::Queue.new
|
36
|
+
queue.instance_variable_set :@redis_version, '2.2'
|
37
|
+
queue.push 1
|
38
|
+
queue.push 2, 3
|
39
|
+
assert_equal [1, 2, 3], queue.peek
|
40
|
+
end
|
41
|
+
|
34
42
|
def test_unshift
|
35
43
|
queue = Turnpike::Queue.new
|
36
44
|
queue.unshift 1
|
@@ -40,6 +48,14 @@ class TestTurnpike < Test::Unit::TestCase
|
|
40
48
|
assert_equal [3, 2, 1], queue.peek
|
41
49
|
end
|
42
50
|
|
51
|
+
def test_unshift_2_2
|
52
|
+
queue = Turnpike::Queue.new
|
53
|
+
queue.instance_variable_set :@redis_version, '2.2'
|
54
|
+
queue.unshift 1
|
55
|
+
queue.unshift 2, 3
|
56
|
+
assert_equal [3, 2, 1], queue.peek
|
57
|
+
end
|
58
|
+
|
43
59
|
def test_pop
|
44
60
|
queue = Turnpike::Queue.new
|
45
61
|
queue.push 1, 2
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turnpike
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement: &
|
16
|
+
requirement: &70268575399240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0.rc1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70268575399240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70268575398480 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0.9'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70268575398480
|
36
36
|
description: Turnpike is a Redis-backed queue.
|
37
37
|
email:
|
38
38
|
- hakan.ensari@papercavalier.com
|