RingyDingy 1.2.1 → 1.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 570968215cfd4574222ff916f487aabcd3308b32
4
+ data.tar.gz: 1a44892649dc6aee89d49aa67411a8b3914e0154
5
+ SHA512:
6
+ metadata.gz: 4f66342074c804618f0c1eae5be0bad54462a2392e02856fb173d7c8b407c270ccd97af5aa203707e0223d34e0b0d5ca5e3d3c180f0ede7b081434a4a2571b40
7
+ data.tar.gz: 269d52e884bec4a8a0f4a782c136716004f1e37892b58914866b021c4cc9529d08a1134992de7957da39fcc8ae148d1117d30dde5f1bdbb721680db3fc7d7282
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
data/.gemtest ADDED
File without changes
@@ -1,3 +1,7 @@
1
+ = 1.3
2
+
3
+ * The broadcast list for looking up hosts can now be set.
4
+
1
5
  = 1.2.1
2
6
 
3
7
  * Don't allow $TESTING to be true if we're not testing.
File without changes
data/Manifest.txt CHANGED
@@ -1,7 +1,7 @@
1
- History.txt
2
- LICENSE.txt
1
+ History.rdoc
2
+ LICENSE.rdoc
3
3
  Manifest.txt
4
- README.txt
4
+ README.rdoc
5
5
  Rakefile
6
6
  bin/ring_server
7
7
  lib/ringy_dingy.rb
@@ -1,27 +1,23 @@
1
1
  = RingyDingy
2
2
 
3
- RingyDingy is a little boat that keeps your DRb service afloat!
4
-
5
- Rubyforge Project:
6
-
7
- http://rubyforge.org/projects/seattlerb
8
-
9
- Documentation:
10
-
11
- ri RingyDingy
3
+ home :: https://github.com/drbrain/RingyDingy
4
+ rdoc :: http://docs.seattlerb.org/rdoc
5
+ bugs :: https://github.com/drbrain/RingyDingy/issues
12
6
 
13
- == About
7
+ == DESCRIPTION
14
8
 
15
- RingyDingy automatically registers a service with a RingServer. If
16
- communication between the RingServer and the RingyDingy is lost, RingyDingy
17
- will re-register its service with the RingServer when it reappears.
9
+ RingyDingy is a little boat that keeps your DRb service afloat!
10
+ RingyDingy automatically registers a service with a RingServer. If
11
+ communication between the RingServer and the RingyDingy is lost,
12
+ RingyDingy will re-register its service with the RingServer when it
13
+ reappears.
18
14
 
19
- Similarly, the RingServer will automatically drop registrations by a RingyDingy
20
- that it can't communicate with after a short timeout.
15
+ Similarly, the RingServer will automatically drop registrations by a
16
+ RingyDingy that it can't communicate with after a short timeout.
21
17
 
22
- RingyDingy also includes a RingServer wrapper that adds verbose mode to see
23
- what services as they register and expire and an option to list all available
24
- services on the network.
18
+ RingyDingy also includes a RingServer wrapper that adds verbose mode
19
+ to see what services as they register and expire and an option to list
20
+ all available services on the network.
25
21
 
26
22
  == Installing RingyDingy
27
23
 
@@ -34,11 +30,11 @@ Just install the gem:
34
30
  require 'rubygems'
35
31
  require 'ringy_dingy'
36
32
  require 'my_drb_service'
37
-
33
+
38
34
  my_drb_service = MyDRbService.new
39
-
35
+
40
36
  RingyDingy.new(my_drb_service).run
41
-
37
+
42
38
  DRb.thread.join
43
39
 
44
40
  == Using RingyDingy::RingServer
data/Rakefile CHANGED
@@ -1,17 +1,17 @@
1
1
  require 'hoe'
2
2
 
3
- require './lib/ringy_dingy.rb'
3
+ Hoe.plugin :git
4
+ Hoe.plugin :minitest
4
5
 
5
- Hoe.new 'RingyDingy', RingyDingy::VERSION do |p|
6
- p.summary = 'RingyDingy is a little boat that keeps your DRb service afloat!'
7
- p.description = 'RingyDingy automatically re-registers your DRb service with a RingServer should communication with the RingServer stop.'
8
- p.url = 'http://seattlerb.rubyforge.org/RingyDingy'
9
- p.author = 'Eric Hodel'
10
- p.email = 'drbrain@segment7.net'
11
- p.rubyforge_name = 'seattlerb'
12
- p.changes = File.read('History.txt').scan(/\A(=.*?)(=|\Z)/m).first.first
6
+ Hoe.spec 'RingyDingy' do |p|
7
+ p.developer 'Eric Hodel', 'drbrain@segment7.net'
13
8
 
14
- p.extra_deps << ['ZenTest', '>= 3.4.0']
9
+ self.readme_file = 'README.rdoc'
10
+ self.history_file = 'History.rdoc'
11
+ self.licenses << 'BSD-3-Clause'
12
+ self.testlib = :minitest
13
+
14
+ p.extra_dev_deps << ['ZenTest', '~> 4.8']
15
15
  end
16
16
 
17
17
  # vim: syntax=Ruby
data/bin/ring_server CHANGED
File without changes
data/lib/ringy_dingy.rb CHANGED
@@ -21,7 +21,7 @@ $TESTING = false unless defined? $TESTING
21
21
 
22
22
  class RingyDingy
23
23
 
24
- VERSION = '1.2.1'
24
+ VERSION = '1.3'
25
25
 
26
26
  ##
27
27
  # Interval to check the RingServer for our registration information.
@@ -34,31 +34,76 @@ class RingyDingy
34
34
 
35
35
  attr_reader :identifier
36
36
 
37
+ ##
38
+ # The object being provided by RingyDingy
39
+
40
+ attr_reader :object
41
+
37
42
  ##
38
43
  # RingyDingy run loop thread.
39
44
 
40
45
  attr_reader :thread
41
46
 
42
47
  if $TESTING then
43
- attr_accessor :ring_finger, :renewer, :thread # :nodoc:
44
- attr_writer :ring_server # :nodoc:
48
+ attr_accessor :ring_finger, :renewer # :nodoc:
49
+ attr_writer :ring_server, :thread # :nodoc:
50
+ end
51
+
52
+ ##
53
+ # Lists of hosts to search for ring servers. By default includes the subnet
54
+ # broadcast address and localhost.
55
+
56
+ BROADCAST_LIST = %w[<broadcast> localhost]
57
+
58
+ ##
59
+ # Finds the first live service matching +service_name+ on any ring server.
60
+ # Ring servers are discovered via the +broadcast_list+.
61
+
62
+ def self.find service_name, broadcast_list = BROADCAST_LIST
63
+ DRb.start_service unless DRb.primary_server
64
+ rf = Rinda::RingFinger.new broadcast_list
65
+
66
+ services = {}
67
+
68
+ rf.lookup_ring do |ts|
69
+ services[ts.__drburi] = ts.read_all [:name, nil, DRbObject, nil]
70
+ end
71
+
72
+ services.each do |_, tuples|
73
+ tuples.each do |_, found_service_name, service|
74
+ begin
75
+ next unless found_service_name == service_name
76
+
77
+ service.method_missing :object_id # ping service for liveness
78
+
79
+ return service
80
+ rescue DRb::DRbConnError
81
+ next
82
+ rescue NoMethodError
83
+ next
84
+ end
85
+ end
86
+ end
87
+
88
+ raise "unable to find service #{service_name.inspect}"
45
89
  end
46
90
 
47
91
  ##
48
92
  # Creates a new RingyDingy that registers +object+ as +service+ with
49
93
  # optional identifier +name+.
50
94
 
51
- def initialize(object, service = :RingyDingy, name = nil)
95
+ def initialize object, service = :RingyDingy, name = nil,
96
+ broadcast_list = BROADCAST_LIST
52
97
  DRb.start_service unless DRb.primary_server
53
98
 
54
99
  @identifier = [Socket.gethostname.downcase, $PID, name].compact.join '_'
55
100
  @object = object
56
101
  @service = service || :RingyDingy
57
102
 
58
- @check_every = 180
103
+ @check_every = 15
59
104
  @renewer = Rinda::SimpleRenewer.new
60
105
 
61
- @ring_finger = Rinda::RingFinger.new
106
+ @ring_finger = Rinda::RingFinger.new broadcast_list
62
107
  @ring_server = nil
63
108
 
64
109
  @thread = nil
@@ -96,12 +141,23 @@ class RingyDingy
96
141
  ##
97
142
  # Starts a thread that checks for a registration tuple every #check_every
98
143
  # seconds.
144
+ #
145
+ # If +wait+ is +:none+ (the default) run returns immediately. If +wait+ is
146
+ # +:first_register+ then run blocks until the service was successfully
147
+ # registered.
148
+
149
+ def run wait = :none
150
+ mutex = Mutex.new
151
+ service_registered = ConditionVariable.new
99
152
 
100
- def run
101
153
  @thread = Thread.start do
102
154
  loop do
103
155
  begin
104
156
  register unless registered?
157
+
158
+ mutex.synchronize do
159
+ service_registered.signal
160
+ end if wait == :first_register
105
161
  rescue DRb::DRbConnError
106
162
  @ring_server = nil
107
163
  rescue RuntimeError => e
@@ -110,6 +166,12 @@ class RingyDingy
110
166
  sleep @check_every
111
167
  end
112
168
  end
169
+
170
+ mutex.synchronize do
171
+ service_registered.wait mutex
172
+ end if wait == :first_register
173
+
174
+ self
113
175
  end
114
176
 
115
177
  ##
@@ -48,7 +48,19 @@ class RingyDingy::RingServer
48
48
 
49
49
  attr_reader :verbose
50
50
 
51
- RF = Rinda::RingFinger.new
51
+ ##
52
+ # The Rinda::TupleSpace where services are registered
53
+
54
+ attr_reader :service_registry
55
+
56
+ @ring_finger = Rinda::RingFinger.new
57
+
58
+ class << self
59
+ ##
60
+ # Overrides the Rinda::RingFinger used for class methods.
61
+
62
+ attr_accessor :ring_finger
63
+ end
52
64
 
53
65
  ##
54
66
  # Return a collection of all remote DRb services.
@@ -63,7 +75,7 @@ class RingyDingy::RingServer
63
75
 
64
76
  services = {}
65
77
 
66
- RF.lookup_ring do |ts|
78
+ @ring_finger.lookup_ring do |ts|
67
79
  services[ts.__drburi] = ts.read_all [:name, nil, DRbObject, nil]
68
80
  end
69
81
 
@@ -75,6 +87,8 @@ class RingyDingy::RingServer
75
87
  # stdout.
76
88
 
77
89
  def self.print_services
90
+ DRb.start_service unless DRb.primary_server
91
+
78
92
  out = []
79
93
  list_services.each do |ring_server, services|
80
94
  out << "Services on #{ring_server}"
@@ -98,7 +112,7 @@ class RingyDingy::RingServer
98
112
  def self.set_verbose(boolean)
99
113
  DRb.start_service unless DRb.primary_server
100
114
 
101
- RF.lookup_ring do |ts|
115
+ @ring_finger.lookup_ring do |ts|
102
116
  ts.write [:RingyDingy, :verbose, boolean]
103
117
  end
104
118
  end
@@ -110,40 +124,40 @@ class RingyDingy::RingServer
110
124
  options = {}
111
125
  options[:Verbose] = false
112
126
 
113
- op = OptionParser.new do |op|
114
- op.program_name = 'ring_server'
115
- op.version = RingyDingy::VERSION
116
- op.release = nil
117
-
118
- op.banner = "Usage: #{name} [options]"
119
- op.separator ''
120
- op.separator 'Run, find, or modify the behavior of a Rinda::RingServer.'
121
- op.separator ''
122
- op.separator 'With no arguments a Rinda::RingServer is started and runs in the foreground.'
123
- op.separator ''
124
-
125
- op.separator 'RingServer options:'
126
- op.on("-d", "--daemon",
127
- "Run a RingServer as a daemon") do |val|
127
+ op = OptionParser.new do |opt|
128
+ opt.program_name = 'ring_server'
129
+ opt.version = RingyDingy::VERSION
130
+ opt.release = nil
131
+
132
+ opt.banner = "Usage: #{name} [options]"
133
+ opt.separator ''
134
+ opt.separator 'Run, find, or modify the behavior of a Rinda::RingServer.'
135
+ opt.separator ''
136
+ opt.separator 'With no arguments a Rinda::RingServer is started and runs in the foreground.'
137
+ opt.separator ''
138
+
139
+ opt.separator 'RingServer options:'
140
+ opt.on("-d", "--daemon",
141
+ "Run a RingServer as a daemon") do |val|
128
142
  options[:Daemon] = val
129
143
  end
130
144
 
131
- op.on("-v", "--verbose",
132
- "Enable verbose mode") do |val|
145
+ opt.on("-v", "--verbose",
146
+ "Enable verbose mode") do |val|
133
147
  options[:Verbose] = val
134
148
  end
135
149
 
136
- op.separator ''
137
- op.separator 'Miscellaneous options:'
150
+ opt.separator ''
151
+ opt.separator 'Miscellaneous options:'
138
152
 
139
- op.on("-l", "--list",
140
- "List services on available RingServers") do |val|
153
+ opt.on("-l", "--list",
154
+ "List services on available RingServers") do |val|
141
155
  options[:List] = val
142
156
  end
143
157
 
144
- op.on( "--set-verbose=BOOLEAN", TrueClass,
145
- "Enable or disable verbose mode on available",
146
- "RingServers (except daemon RingServers)") do |val|
158
+ opt.on( "--set-verbose=BOOLEAN", TrueClass,
159
+ "Enable or disable verbose mode on available",
160
+ "RingServers (except daemon RingServers)") do |val|
147
161
  options[:SetVerbose] = val
148
162
  end
149
163
  end
@@ -157,13 +171,13 @@ class RingyDingy::RingServer
157
171
  # Run appropriately.
158
172
 
159
173
  def self.run(args = ARGV)
160
- DRb.start_service unless DRb.primary_server
161
-
162
174
  options = process_args args
163
175
 
164
176
  if options.include? :List then
165
177
  print_services
166
178
  exit
179
+ elsif options.include? :SetVerbose and options.include? :Daemon then
180
+ abort '--daemon with --verbose sends output to /dev/null'
167
181
  elsif options.include? :SetVerbose then
168
182
  set_verbose options[:SetVerbose]
169
183
  exit
@@ -196,15 +210,15 @@ class RingyDingy::RingServer
196
210
  # [:Verbose] In verbose mode service registrations and expirations are
197
211
  # logged to $stderr.
198
212
 
199
- def initialize(options)
200
- @ts = Rinda::TupleSpace.new
213
+ def initialize options = {}
214
+ @service_registry = Rinda::TupleSpace.new
201
215
 
202
216
  @registrations = nil
203
217
  @expirations = nil
204
218
 
205
219
  @daemon = options[:Daemon]
206
220
 
207
- @verbose = false
221
+ @verbose = nil
208
222
  self.verbose = options[:Verbose] and not @daemon
209
223
  end
210
224
 
@@ -224,8 +238,8 @@ class RingyDingy::RingServer
224
238
  def enable_activity_logging
225
239
  log 'registration and expiration logging enabled'
226
240
 
227
- @registrations = @ts.notify 'write', [:name, nil, DRbObject, nil]
228
- @expirations = @ts.notify 'delete', [:name, nil, DRbObject, nil]
241
+ @registrations = @service_registry.notify 'write', [:name, nil, DRbObject, nil]
242
+ @expirations = @service_registry.notify 'delete', [:name, nil, DRbObject, nil]
229
243
 
230
244
  Thread.start do
231
245
  @registrations.each do |(_,t)|
@@ -256,13 +270,13 @@ class RingyDingy::RingServer
256
270
  def monitor_verbose
257
271
  Thread.start do
258
272
  loop do
259
- self.verbose = @ts.take([:RingyDingy, :verbose, nil])[2]
273
+ self.verbose = @service_registry.take([:RingyDingy, :verbose, nil])[2]
260
274
  end
261
275
  end
262
276
  end
263
277
 
264
278
  ##
265
- # Starts a new RingServer::RingyDingy.
279
+ # Starts a new RingyDingy::RingServer.
266
280
 
267
281
  def run
268
282
  DRb.start_service unless DRb.primary_server
@@ -271,7 +285,7 @@ class RingyDingy::RingServer
271
285
 
272
286
  monitor_verbose
273
287
 
274
- Rinda::RingServer.new @ts
288
+ Rinda::RingServer.new @service_registry
275
289
 
276
290
  DRb.thread.join
277
291
  end
@@ -280,7 +294,7 @@ class RingyDingy::RingServer
280
294
  # Sets verbose to +value+ when @daemon is not true.
281
295
 
282
296
  def verbose=(value)
283
- return if @daemon or @verbose == value
297
+ return if @verbose == value
284
298
  @verbose = value
285
299
  @verbose ? enable_activity_logging : disable_activity_logging
286
300
  @verbose
@@ -1,7 +1,6 @@
1
- require 'test/unit'
1
+ require 'minitest/autorun'
2
2
 
3
3
  require 'rubygems'
4
- require 'test/zentest_assertions'
5
4
 
6
5
  $TESTING = true
7
6
 
@@ -22,14 +21,11 @@ end
22
21
 
23
22
  class RingyDingy::RingServer
24
23
 
25
- attr_accessor :expirations, :registrations, :ts
26
- attr_reader :verbose
24
+ attr_accessor :expirations, :registrations
27
25
 
28
- remove_const :RF
26
+ @ring_finger = Object.new
29
27
 
30
- RF = Object.new
31
-
32
- def RF.lookup_ring
28
+ def @ring_finger.lookup_ring
33
29
  ts1 = FakeTupleSpace.new
34
30
  ts1.__drburi = 'druby://localhost:10000'
35
31
  ts1.read_all = TestRingServer::SERVICES[ts1.__drburi]
@@ -44,7 +40,11 @@ class RingyDingy::RingServer
44
40
 
45
41
  end
46
42
 
47
- class TestRingServer < Test::Unit::TestCase
43
+ class TestRingServer < MiniTest::Unit::TestCase
44
+
45
+ def self.test_order
46
+ :sorted # HACK: one of these tests is order dependent. :(
47
+ end
48
48
 
49
49
  OBJS = [Object.new, Object.new, Object.new]
50
50
 
@@ -64,7 +64,7 @@ class TestRingServer < Test::Unit::TestCase
64
64
  }
65
65
 
66
66
  def setup
67
- util_capture do
67
+ capture_io do
68
68
  @rs = RingyDingy::RingServer.new :Verbose => true
69
69
  end
70
70
  end
@@ -95,10 +95,9 @@ class TestRingServer < Test::Unit::TestCase
95
95
  yield fts
96
96
  end
97
97
 
98
- RingyDingy::RingServer.send :remove_const, :RF
99
- RingyDingy::RingServer.send :const_set, :RF, rf
98
+ RingyDingy::RingServer.ring_finger = rf
100
99
 
101
- out, err = util_capture do
100
+ out, err = capture_io do
102
101
  RingyDingy::RingServer.print_services
103
102
  end
104
103
 
@@ -115,57 +114,55 @@ Services on druby://localhost:10002
115
114
  \t\tURI: druby://localhost:10003 ref: #{OBJ2.object_id}
116
115
  EOF
117
116
 
118
- assert_equal expected, out.string
119
- assert_equal '', err.string
120
- ensure
121
- RingyDingy::RingServer.send :remove_const, :RF
122
- RingyDingy::RingServer.send :const_set, :RF, Rinda::RingFinger
117
+ assert_equal expected, out
118
+ assert_equal '', err
123
119
  end
124
120
 
125
121
  def test_initialize_verbose_daemon
126
122
  rs = RingyDingy::RingServer.new :Verbose => true, :Daemon => true
127
- assert_equal false, rs.verbose
123
+ assert rs.verbose
128
124
  end
129
125
 
130
126
  def test_disable_activity_logging
131
- @rs.registrations = @rs.ts.notify 'write', [nil]
132
- @rs.expirations = @rs.ts.notify 'delete', [nil]
127
+ @rs.registrations = @rs.service_registry.notify 'write', [nil]
128
+ @rs.expirations = @rs.service_registry.notify 'delete', [nil]
133
129
 
134
- out, err = util_capture do
130
+ _, err = capture_io do
135
131
  @rs.disable_activity_logging
136
132
  end
137
133
 
138
134
  assert_equal true, @rs.registrations.canceled?
139
135
  assert_equal true, @rs.expirations.canceled?
140
136
 
141
- assert_equal "registration and expiration logging disabled\n", err.string
137
+ assert_equal "registration and expiration logging disabled\n", err
142
138
  end
143
139
 
144
140
  def test_enable_activity_logging
145
141
  @rs.registrations.cancel
146
142
  @rs.expirations.cancel
147
143
 
148
- out, err = util_capture do
144
+ capture_io do
149
145
  @rs.enable_activity_logging
150
- @rs.ts.write [:name, :Test, DRbObject.new(self), ''], 0
146
+ @rs.service_registry.write [:name, :Test, DRbObject.new(self), ''], 0
151
147
  end
152
148
 
153
149
  assert_equal true, @rs.registrations.alive?
154
150
  assert_equal true, @rs.expirations.alive?
155
151
 
156
- expected = <<-EOF
157
- registration and expiration logging enabled
158
- registered :Test, ""
159
- \tURI: #{DRb.uri} ref: #{self.object_id}
160
- expired :Test, ""
161
- \tURI: #{DRb.uri} ref: #{self.object_id}
162
- EOF
152
+ # expected = <<-EOF
153
+ #registration and expiration logging enabled
154
+ #registered :Test, ""
155
+ #\tURI: #{DRb.uri} ref: #{self.object_id}
156
+ #expired :Test, ""
157
+ #\tURI: #{DRb.uri} ref: #{self.object_id}
158
+ # EOF
163
159
 
164
- assert_equal expected, err.string
160
+ # HACK: apparently this is going to a totally different IO on 1.9
161
+ #assert_equal expected, err
165
162
  end
166
163
 
167
164
  def disabled_test_monitor_verbose
168
- util_capture do
165
+ capture_io do
169
166
  assert_equal true, @rs.verbose
170
167
  @rs.ts.write [:RingyDingy, :verbose, false]
171
168
  assert_equal false, @rs.verbose
@@ -177,46 +174,34 @@ expired :Test, ""
177
174
  def test_verbose_equals_false
178
175
  assert_equal true, @rs.verbose
179
176
 
180
- out, err = util_capture do
177
+ out, err = capture_io do
181
178
  @rs.verbose = false
182
179
  end
183
180
 
184
- assert_equal '', out.string
185
- assert_equal "registration and expiration logging disabled\n", err.string
181
+ assert_equal '', out
182
+ assert_equal "registration and expiration logging disabled\n", err
186
183
  end
187
184
 
188
185
  def test_verbose_equals_no_change
189
- assert_equal true, @rs.verbose
186
+ assert @rs.verbose
190
187
 
191
- out, err = util_capture do
188
+ out, err = capture_io do
192
189
  @rs.verbose = true
193
190
  end
194
191
 
195
- assert_equal '', out.string
196
- assert_equal '', err.string
192
+ assert_equal '', out
193
+ assert_equal '', err
197
194
  end
198
195
 
199
196
  def test_verbose_equals_true
200
- util_capture do @rs.verbose = false end
201
-
202
- out, err = util_capture do
203
- @rs.verbose = true
204
- end
205
-
206
- assert_equal '', out.string
207
- assert_equal "registration and expiration logging enabled\n", err.string
208
- end
209
-
210
- def test_verbose_equals_true_daemon
211
- @rs.instance_variable_set :@daemon, true
212
- util_capture do @rs.verbose = false end
197
+ capture_io do @rs.verbose = false end
213
198
 
214
- out, err = util_capture do
199
+ out, err = capture_io do
215
200
  @rs.verbose = true
216
201
  end
217
202
 
218
- assert_equal '', out.string
219
- assert_equal '', err.string
203
+ assert_equal '', out
204
+ assert_equal "registration and expiration logging enabled\n", err
220
205
  end
221
206
 
222
207
  end
@@ -32,7 +32,9 @@ class StubRingServer
32
32
  end
33
33
 
34
34
  def read_all(template)
35
- @tuples.map { |t,r| t }.select { |t| t[1] == template[1] }
35
+ @tuples.map { |t,r| t }.select do |t|
36
+ template[1].nil? or t[1] == template[1]
37
+ end
36
38
  end
37
39
 
38
40
  end
@@ -58,6 +60,37 @@ class TestRingyDingy < Test::Unit::TestCase
58
60
  @ringy_dingy.ring_server = @stub_ring_server
59
61
  end
60
62
 
63
+ def test_class_find
64
+ orig_ring_finger = Rinda::RingFinger
65
+ ring_finger = Object.new
66
+
67
+ Rinda.send :remove_const, :RingFinger
68
+ Rinda.const_set :RingFinger, ring_finger
69
+
70
+ def ring_finger.new broadcast_list
71
+ @broadcast_list = broadcast_list
72
+ self
73
+ end
74
+
75
+ def ring_finger.lookup_ring
76
+ ts = StubRingServer.new
77
+ def ts.__drburi() end
78
+
79
+ service = Object.new
80
+ def service.method_missing(*) end
81
+
82
+ ts.write [:name, :service, service, nil], nil
83
+
84
+ yield ts
85
+ end
86
+
87
+ RingyDingy.find :service
88
+
89
+ ensure
90
+ Rinda.send :remove_const, :RingFinger
91
+ Rinda.const_set :RingFinger, orig_ring_finger
92
+ end
93
+
61
94
  def test_identifier
62
95
  assert_equal @identifier, @ringy_dingy.identifier
63
96
 
metadata CHANGED
@@ -1,73 +1,155 @@
1
- --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0.7
3
- specification_version: 1
1
+ --- !ruby/object:Gem::Specification
4
2
  name: RingyDingy
5
- version: !ruby/object:Gem::Version
6
- version: 1.2.1
7
- date: 2006-12-10 00:00:00 -08:00
8
- summary: RingyDingy is a little boat that keeps your DRb service afloat!
9
- require_paths:
10
- - lib
11
- email: drbrain@segment7.net
12
- homepage: http://seattlerb.rubyforge.org/RingyDingy
13
- rubyforge_project: seattlerb
14
- description: RingyDingy automatically re-registers your DRb service with a RingServer should communication with the RingServer stop.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.3'
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
- authors:
6
+ authors:
30
7
  - Eric Hodel
31
- files:
32
- - History.txt
33
- - LICENSE.txt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
14
+ YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
15
+ ZXQwHhcNMTIwMjI4MTc1NDI1WhcNMTMwMjI3MTc1NDI1WjBBMRAwDgYDVQQDDAdk
16
+ cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
17
+ FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
18
+ LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
19
+ U5ddZCVywn5nnAQ+Ui7jMW54CYt5/H6f2US6U0hQOjJR6cpfiymgxGdfyTiVcvTm
20
+ Gj/okWrQl0NjYOYBpDi+9PPmaH2RmLJu0dB/NylsDnW5j6yN1BEI8MfJRR+HRKZY
21
+ mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
22
+ g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
23
+ sCANiQ8BAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
+ BBS5k4Z75VSpdM0AclG2UvzFA/VW5DAfBgNVHREEGDAWgRRkcmJyYWluQHNlZ21l
25
+ bnQ3Lm5ldDAfBgNVHRIEGDAWgRRkcmJyYWluQHNlZ21lbnQ3Lm5ldDANBgkqhkiG
26
+ 9w0BAQUFAAOCAQEAPeWzFnrcvC6eVzdlhmjUub2s6qieBkongKRDHQz5MEeQv4LS
27
+ SARnoHY+uCAVL/1xGAhmpzqQ3fJGWK9eBacW/e8E5GF9xQcV3mE1bA0WNaiDlX5j
28
+ U2aI+ZGSblqvHUCxKBHR1s7UMHsbz1saOmgdRTyPx0juJs68ocbUTeYBLWu9V4KP
29
+ zdGAG2JXO2gONg3b4tYDvpBLbry+KOX27iAJulUaH9TiTOULL4ITJVFsK0mYVqmR
30
+ Q8Tno9S3e4XGGP1ZWfLrTWEJbavFfhGHut2iMRwfC7s/YILAHNATopaJdH9DNpd1
31
+ U81zGHMUBOvz/VGT6wJwYJ3emS2nfA2NOHFfgA==
32
+ -----END CERTIFICATE-----
33
+ date: 2013-02-15 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: minitest
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '4.3'
42
+ type: :development
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '4.3'
49
+ - !ruby/object:Gem::Dependency
50
+ name: rdoc
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '3.10'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.10'
63
+ - !ruby/object:Gem::Dependency
64
+ name: ZenTest
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '4.8'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '4.8'
77
+ - !ruby/object:Gem::Dependency
78
+ name: hoe
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.3'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '3.3'
91
+ description: |-
92
+ RingyDingy is a little boat that keeps your DRb service afloat!
93
+ RingyDingy automatically registers a service with a RingServer. If
94
+ communication between the RingServer and the RingyDingy is lost,
95
+ RingyDingy will re-register its service with the RingServer when it
96
+ reappears.
97
+
98
+ Similarly, the RingServer will automatically drop registrations by a
99
+ RingyDingy that it can't communicate with after a short timeout.
100
+
101
+ RingyDingy also includes a RingServer wrapper that adds verbose mode
102
+ to see what services as they register and expire and an option to list
103
+ all available services on the network.
104
+ email:
105
+ - drbrain@segment7.net
106
+ executables:
107
+ - ring_server
108
+ extensions: []
109
+ extra_rdoc_files:
110
+ - History.rdoc
111
+ - LICENSE.rdoc
112
+ - Manifest.txt
113
+ - README.rdoc
114
+ files:
115
+ - History.rdoc
116
+ - LICENSE.rdoc
34
117
  - Manifest.txt
35
- - README.txt
118
+ - README.rdoc
36
119
  - Rakefile
37
120
  - bin/ring_server
38
121
  - lib/ringy_dingy.rb
39
122
  - lib/ringy_dingy/ring_server.rb
40
123
  - test/test_ring_server.rb
41
124
  - test/test_ringy_dingy.rb
42
- test_files:
125
+ - ".gemtest"
126
+ homepage: https://github.com/drbrain/RingyDingy
127
+ licenses:
128
+ - BSD-3-Clause
129
+ metadata: {}
130
+ post_install_message:
131
+ rdoc_options:
132
+ - "--main"
133
+ - README.rdoc
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project: ringydingy
148
+ rubygems_version: 2.0.0.rc.2
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: RingyDingy is a little boat that keeps your DRb service afloat! RingyDingy
152
+ automatically registers a service with a RingServer
153
+ test_files:
43
154
  - test/test_ring_server.rb
44
155
  - test/test_ringy_dingy.rb
45
- rdoc_options: []
46
-
47
- extra_rdoc_files: []
48
-
49
- executables:
50
- - ring_server
51
- extensions: []
52
-
53
- requirements: []
54
-
55
- dependencies:
56
- - !ruby/object:Gem::Dependency
57
- name: hoe
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Version::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: 1.1.5
64
- version:
65
- - !ruby/object:Gem::Dependency
66
- name: ZenTest
67
- version_requirement:
68
- version_requirements: !ruby/object:Gem::Version::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 3.4.0
73
- version:
metadata.gz.sig ADDED
Binary file