infopark-politics 0.3.1 → 0.3.2pg55d4620
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.rbenv-version +1 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/Manifest +17 -0
- data/Rakefile +25 -0
- data/VERSION +1 -0
- data/dcc_config.rb +5 -0
- data/examples/queue_worker_example.rb +3 -2
- data/examples/token_worker_example.rb +4 -3
- data/infopark-politics.gemspec +38 -0
- data/lib/init.rb +1 -0
- data/lib/politics/discoverable_node.rb +18 -17
- data/lib/politics/static_queue_worker.rb +6 -1
- data/lib/politics/token_worker.rb +15 -14
- data/lib/politics.rb +2 -1
- data/spec/spec_helper.rb +17 -0
- data/spec/static_queue_worker_spec.rb +224 -199
- data/test/static_queue_worker_test.rb +6 -5
- data/test/test_helper.rb +1 -0
- data/test/token_worker_test.rb +6 -5
- metadata +136 -29
- data/lib/politics/version.rb +0 -5
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.dirname(__FILE__) + '/test_helper'
|
2
3
|
|
3
4
|
Thread.abort_on_exception = true
|
@@ -7,7 +8,7 @@ class Worker
|
|
7
8
|
def initialize
|
8
9
|
register_worker 'worker', 10, :iteration_length => 10
|
9
10
|
end
|
10
|
-
|
11
|
+
|
11
12
|
def start
|
12
13
|
process_bucket do |bucket|
|
13
14
|
sleep 1
|
@@ -16,7 +17,7 @@ class Worker
|
|
16
17
|
end
|
17
18
|
|
18
19
|
class StaticQueueWorkerTest < Test::Unit::TestCase
|
19
|
-
|
20
|
+
|
20
21
|
context "nodes" do
|
21
22
|
setup do
|
22
23
|
@nodes = []
|
@@ -24,11 +25,11 @@ class StaticQueueWorkerTest < Test::Unit::TestCase
|
|
24
25
|
@nodes << nil
|
25
26
|
end
|
26
27
|
end
|
27
|
-
|
28
|
+
|
28
29
|
should "start up" do
|
29
30
|
processes = @nodes.map do
|
30
31
|
fork do
|
31
|
-
['INT', 'TERM'].each { |signal|
|
32
|
+
['INT', 'TERM'].each { |signal|
|
32
33
|
trap(signal) { exit(0) }
|
33
34
|
}
|
34
35
|
Worker.new.start
|
@@ -39,4 +40,4 @@ class StaticQueueWorkerTest < Test::Unit::TestCase
|
|
39
40
|
Process.kill('INT', *processes)
|
40
41
|
end
|
41
42
|
end
|
42
|
-
end
|
43
|
+
end
|
data/test/test_helper.rb
CHANGED
data/test/token_worker_test.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'test_helper'
|
2
3
|
|
3
4
|
class TokenWorkerTest < Test::Unit::TestCase
|
4
|
-
|
5
|
+
|
5
6
|
context "token workers" do
|
6
7
|
setup do
|
7
8
|
@harness = Class.new
|
@@ -24,7 +25,7 @@ class TokenWorkerTest < Test::Unit::TestCase
|
|
24
25
|
@worker.register_worker('testing')
|
25
26
|
assert_equal @worker.class.worker_instance, @worker
|
26
27
|
end
|
27
|
-
|
28
|
+
|
28
29
|
should 'not process if they are not leader' do
|
29
30
|
@worker.expects(:nominate)
|
30
31
|
@worker.expects(:leader?).returns(false)
|
@@ -57,7 +58,7 @@ class TokenWorkerTest < Test::Unit::TestCase
|
|
57
58
|
|
58
59
|
assert_equal 1, worked
|
59
60
|
end
|
60
|
-
|
61
|
+
|
61
62
|
should 'not allow processing without registration' do
|
62
63
|
assert_raises ArgumentError do
|
63
64
|
@worker.process
|
@@ -69,10 +70,10 @@ class TokenWorkerTest < Test::Unit::TestCase
|
|
69
70
|
|
70
71
|
foo = @worker.class.new
|
71
72
|
foo.register_worker('testing')
|
72
|
-
|
73
|
+
|
73
74
|
assert_raises SecurityError do
|
74
75
|
@worker.process
|
75
76
|
end
|
76
77
|
end
|
77
78
|
end
|
78
|
-
end
|
79
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark-politics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 3630819867
|
5
|
+
prerelease: 5
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 2
|
10
|
+
- pg
|
11
|
+
- 55
|
12
|
+
- d
|
13
|
+
- 4620
|
14
|
+
version: 0.3.2pg55d4620
|
5
15
|
platform: ruby
|
6
16
|
authors:
|
7
17
|
- Mike Perham
|
@@ -10,40 +20,116 @@ autorequire:
|
|
10
20
|
bindir: bin
|
11
21
|
cert_chain: []
|
12
22
|
|
13
|
-
date:
|
23
|
+
date: 2013-11-09 00:00:00 +01:00
|
14
24
|
default_executable:
|
15
25
|
dependencies:
|
16
26
|
- !ruby/object:Gem::Dependency
|
17
|
-
|
18
|
-
|
19
|
-
version_requirement:
|
20
|
-
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
21
29
|
requirements:
|
22
30
|
- - ">="
|
23
31
|
- !ruby/object:Gem::Version
|
24
|
-
|
25
|
-
|
32
|
+
hash: 31
|
33
|
+
segments:
|
34
|
+
- 2
|
35
|
+
- 14
|
36
|
+
version: "2.14"
|
37
|
+
name: rspec
|
38
|
+
version_requirements: *id001
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
26
41
|
- !ruby/object:Gem::Dependency
|
27
|
-
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 23
|
48
|
+
segments:
|
49
|
+
- 10
|
50
|
+
version: "10"
|
51
|
+
name: rake
|
52
|
+
version_requirements: *id002
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 21
|
62
|
+
segments:
|
63
|
+
- 3
|
64
|
+
- 9
|
65
|
+
version: "3.9"
|
66
|
+
name: rdoc
|
67
|
+
version_requirements: *id003
|
68
|
+
prerelease: false
|
69
|
+
type: :development
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 15
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 2
|
80
|
+
version: "0.2"
|
81
|
+
name: rubygems-tasks
|
82
|
+
version_requirements: *id004
|
83
|
+
prerelease: false
|
84
|
+
type: :development
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 1
|
94
|
+
- 5
|
95
|
+
- 0
|
96
|
+
version: 1.5.0
|
97
|
+
name: memcache-client
|
98
|
+
version_requirements: *id005
|
99
|
+
prerelease: false
|
28
100
|
type: :runtime
|
29
|
-
|
30
|
-
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
31
104
|
requirements:
|
32
105
|
- - ">="
|
33
106
|
- !ruby/object:Gem::Version
|
107
|
+
hash: 43
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
- 9
|
111
|
+
- 8
|
34
112
|
version: 0.9.8
|
35
|
-
|
36
|
-
|
37
|
-
|
113
|
+
name: starling-starling
|
114
|
+
version_requirements: *id006
|
115
|
+
prerelease: false
|
38
116
|
type: :runtime
|
39
|
-
|
40
|
-
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
41
120
|
requirements:
|
42
121
|
- - ">="
|
43
122
|
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
- 4
|
44
127
|
version: "0.4"
|
45
|
-
|
46
|
-
|
128
|
+
name: net-mdns
|
129
|
+
version_requirements: *id007
|
130
|
+
prerelease: false
|
131
|
+
type: :runtime
|
132
|
+
description: ""
|
47
133
|
email: tilo@infopark.de
|
48
134
|
executables: []
|
49
135
|
|
@@ -54,47 +140,68 @@ extra_rdoc_files:
|
|
54
140
|
- LICENSE
|
55
141
|
- README.rdoc
|
56
142
|
files:
|
143
|
+
- .gitignore
|
144
|
+
- .rbenv-version
|
145
|
+
- .rspec
|
146
|
+
- Gemfile
|
147
|
+
- History.rdoc
|
148
|
+
- LICENSE
|
149
|
+
- Manifest
|
150
|
+
- README.rdoc
|
151
|
+
- Rakefile
|
152
|
+
- VERSION
|
153
|
+
- dcc_config.rb
|
57
154
|
- examples/queue_worker_example.rb
|
58
155
|
- examples/token_worker_example.rb
|
156
|
+
- infopark-politics.gemspec
|
59
157
|
- lib/init.rb
|
60
158
|
- lib/politics.rb
|
61
159
|
- lib/politics/discoverable_node.rb
|
62
160
|
- lib/politics/static_queue_worker.rb
|
63
161
|
- lib/politics/token_worker.rb
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
162
|
+
- spec/spec_helper.rb
|
163
|
+
- spec/static_queue_worker_spec.rb
|
164
|
+
- test/static_queue_worker_test.rb
|
165
|
+
- test/test_helper.rb
|
166
|
+
- test/token_worker_test.rb
|
68
167
|
has_rdoc: true
|
69
168
|
homepage: http://github.com/infopark/politics
|
70
169
|
licenses: []
|
71
170
|
|
72
171
|
post_install_message:
|
73
|
-
rdoc_options:
|
74
|
-
|
172
|
+
rdoc_options: []
|
173
|
+
|
75
174
|
require_paths:
|
76
175
|
- lib
|
77
176
|
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
78
178
|
requirements:
|
79
179
|
- - ">="
|
80
180
|
- !ruby/object:Gem::Version
|
181
|
+
hash: 3
|
182
|
+
segments:
|
183
|
+
- 0
|
81
184
|
version: "0"
|
82
|
-
version:
|
83
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
84
187
|
requirements:
|
85
188
|
- - ">="
|
86
189
|
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
|
190
|
+
hash: 31
|
191
|
+
segments:
|
192
|
+
- 1
|
193
|
+
- 8
|
194
|
+
version: "1.8"
|
89
195
|
requirements: []
|
90
196
|
|
91
197
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.
|
198
|
+
rubygems_version: 1.6.2
|
93
199
|
signing_key:
|
94
200
|
specification_version: 3
|
95
201
|
summary: Algorithms and Tools for Distributed Computing in Ruby.
|
96
202
|
test_files:
|
203
|
+
- spec/spec_helper.rb
|
97
204
|
- spec/static_queue_worker_spec.rb
|
98
|
-
- test/test_helper.rb
|
99
205
|
- test/static_queue_worker_test.rb
|
206
|
+
- test/test_helper.rb
|
100
207
|
- test/token_worker_test.rb
|