vetinari 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe414b4c35924d0c5fa15e67e84494b74b23f31f
4
- data.tar.gz: 5e82b546876eb70fe159d0c9480fdeffbecbfacf
3
+ metadata.gz: f608f5d572103adef5c02583257c53b4a31bd62c
4
+ data.tar.gz: 06dd6242f7bab98b151ec5b309677b498007efeb
5
5
  SHA512:
6
- metadata.gz: d0c60adeae677929cb9d903674432787c854c9185fd924e89443a65ffc5b1c1f1668e4c26e3fd2ea307405c453324f4a7faa509b6e12de97890ce80065742227
7
- data.tar.gz: 9760ed1524abde7e444ada03ec74c4728467ceffb65ec21879ff0b7bcdab9c989af0fc1e9a88e77751e648ea9c12eeca763e5ded23e794d5f60df0e3baad82a0
6
+ metadata.gz: d92ea68da4913e79a56dd9d640359283bbe7a4bccfe2c000b6db3b45919dc8e4e456834e3eb60e3c8506c17ea1e5310a8a5d9604dd101a923b406cf53174e02d
7
+ data.tar.gz: 356eb42a77705a7d68780f427a76ea728a6d6764d84ca148229a534e997d24bf01a0216b115bd42dc3ff42d4e6a0940aae8461a26089689c398962069cd3bf62
@@ -5,6 +5,7 @@ module Vetinari
5
5
  attr_reader :config, :users, :user, :channels, :server_manager, :callbacks
6
6
 
7
7
  finalizer :finalize
8
+ trap_exit :dont_die
8
9
 
9
10
  def initialize(&block)
10
11
  @actor = Actor.current
@@ -92,6 +93,10 @@ module Vetinari
92
93
  end
93
94
  end
94
95
 
96
+ def dont_die(actor)
97
+ # nothing!
98
+ end
99
+
95
100
  private
96
101
 
97
102
  def disconnected
@@ -89,7 +89,8 @@ module Vetinari
89
89
  def terminate_callbacks
90
90
  @callbacks.each do |event, hash|
91
91
  hash.each do |uuid, _hash|
92
- _hash[:callback].terminate
92
+ actor = _hash[:callback]
93
+ actor.terminate if actor.alive?
93
94
  end
94
95
  end
95
96
  end
@@ -107,7 +107,7 @@ module Vetinari
107
107
  callbacks << @bot.on(:join) do |env|
108
108
  if env[:channel].name == @name
109
109
  condition.signal :joined
110
- callbacks.each { |cb| cb.remove_and_terminate if cb.alive? }
110
+ callbacks.each { |cb| cb.async.remove_and_terminate if cb.alive? }
111
111
  end
112
112
  end
113
113
 
@@ -124,14 +124,14 @@ module Vetinari
124
124
 
125
125
  if channel_name == @name
126
126
  condition.signal msg
127
- callbacks.each { |cb| cb.remove_and_terminate if cb.alive? }
127
+ callbacks.each { |cb| cb.async.remove_and_terminate if cb.alive? }
128
128
  end
129
129
  end
130
130
  end
131
131
 
132
132
  after(5) do
133
133
  condition.signal :timeout
134
- callbacks.each { |cb| cb.remove_and_terminate if cb.alive? }
134
+ callbacks.each { |cb| cb.async.remove_and_terminate if cb.alive? }
135
135
  end
136
136
 
137
137
  if key
@@ -1,3 +1,3 @@
1
1
  module Vetinari
2
- VERSION = Gem::Version.new('0.2.2')
2
+ VERSION = Gem::Version.new('0.2.3')
3
3
  end
@@ -27,4 +27,17 @@ describe Vetinari::Bot.new do
27
27
  subject.terminate
28
28
  end.to_not change { Celluloid::Actor.all.size }
29
29
  end
30
+
31
+ it 'should not die if a linked channel dies' do
32
+ channel = Vetinari::Channel.new('#mended_drum', subject)
33
+
34
+ def (channel.bare_object).crash
35
+ raise 'boom'
36
+ end
37
+
38
+ expect(subject.links).to include(channel)
39
+ channel.crash rescue nil
40
+ expect(channel).to_not be_alive
41
+ expect(subject).to be_alive
42
+ end
30
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vetinari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Bühlmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2013-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid-io