vetinari 0.2.2 → 0.2.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 +4 -4
- data/lib/vetinari/bot.rb +5 -0
- data/lib/vetinari/callback_container.rb +2 -1
- data/lib/vetinari/channel.rb +3 -3
- data/lib/vetinari/version.rb +1 -1
- data/spec/bot_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f608f5d572103adef5c02583257c53b4a31bd62c
|
4
|
+
data.tar.gz: 06dd6242f7bab98b151ec5b309677b498007efeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d92ea68da4913e79a56dd9d640359283bbe7a4bccfe2c000b6db3b45919dc8e4e456834e3eb60e3c8506c17ea1e5310a8a5d9604dd101a923b406cf53174e02d
|
7
|
+
data.tar.gz: 356eb42a77705a7d68780f427a76ea728a6d6764d84ca148229a534e997d24bf01a0216b115bd42dc3ff42d4e6a0940aae8461a26089689c398962069cd3bf62
|
data/lib/vetinari/bot.rb
CHANGED
@@ -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
|
data/lib/vetinari/channel.rb
CHANGED
@@ -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
|
data/lib/vetinari/version.rb
CHANGED
data/spec/bot_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-io
|