rector 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rector/backends/redis.rb +5 -3
- data/rector.gemspec +1 -1
- data/spec/lib/backends/redis_spec.rb +3 -3
- metadata +14 -14
@@ -1,3 +1,5 @@
|
|
1
|
+
require "set"
|
2
|
+
|
1
3
|
module Rector
|
2
4
|
module Backends
|
3
5
|
class Redis
|
@@ -12,16 +14,16 @@ module Rector
|
|
12
14
|
|
13
15
|
def update_job_data_from_hash(hsh)
|
14
16
|
redis.multi do
|
15
|
-
redis.sadd(KEY_LIST_SET,
|
17
|
+
redis.sadd(KEY_LIST_SET, hsh.keys)
|
16
18
|
|
17
19
|
hsh.each do |key, val|
|
18
20
|
case val
|
19
21
|
when Numeric
|
20
22
|
redis.incrby(key, val)
|
21
23
|
when Set
|
22
|
-
redis.sadd(key,
|
24
|
+
redis.sadd(key, val.to_a)
|
23
25
|
when Enumerable
|
24
|
-
redis.rpush(key,
|
26
|
+
redis.rpush(key, val)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
data/rector.gemspec
CHANGED
@@ -23,7 +23,7 @@ describe Rector::Backends::Redis do
|
|
23
23
|
"bar" => 2
|
24
24
|
}
|
25
25
|
|
26
|
-
redis.expects(:sadd).with("#{job_id}:__keys__", "foo", "bar")
|
26
|
+
redis.expects(:sadd).with("#{job_id}:__keys__", ["foo", "bar"])
|
27
27
|
subject.update_job_data_from_hash(hsh)
|
28
28
|
end
|
29
29
|
|
@@ -37,14 +37,14 @@ describe Rector::Backends::Redis do
|
|
37
37
|
it "stores lists" do
|
38
38
|
hsh = { "foo" => ["a", "b", "c"] }
|
39
39
|
|
40
|
-
redis.expects(:rpush).with("#{job_id}:foo", "a", "b", "c")
|
40
|
+
redis.expects(:rpush).with("#{job_id}:foo", ["a", "b", "c"])
|
41
41
|
subject.update_job_data_from_hash(hsh)
|
42
42
|
end
|
43
43
|
|
44
44
|
it "stores sets" do
|
45
45
|
hsh = { "foo" => Set.new(["a", "b", "c"]) }
|
46
46
|
|
47
|
-
redis.expects(:sadd).with("#{job_id}:foo", "a", "b", "c")
|
47
|
+
redis.expects(:sadd).with("#{job_id}:foo", ["a", "b", "c"])
|
48
48
|
subject.update_job_data_from_hash(hsh)
|
49
49
|
end
|
50
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-02-
|
12
|
+
date: 2012-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement: &
|
16
|
+
requirement: &70159131664760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70159131664760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redis-namespace
|
27
|
-
requirement: &
|
27
|
+
requirement: &70159131664320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70159131664320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70159131663900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70159131663900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70159131663400 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.8.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70159131663400
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mocha
|
60
|
-
requirement: &
|
60
|
+
requirement: &70159131662900 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 0.10.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70159131662900
|
69
69
|
description: ! " Rector allows coordination of a number of jobs spawned with a
|
70
70
|
mechanism\n like Resque (though any job manager will do). If you are able to
|
71
71
|
parallelize\n the processing of a task, yet all these tasks are generating metrics,\n
|
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
segments:
|
110
110
|
- 0
|
111
|
-
hash:
|
111
|
+
hash: 3768729583706466489
|
112
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
segments:
|
119
119
|
- 0
|
120
|
-
hash:
|
120
|
+
hash: 3768729583706466489
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
123
|
rubygems_version: 1.8.14
|