twitch-bot 3.2.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/twitch/bot/memory/redis.rb +8 -5
- data/lib/twitch/bot/version.rb +1 -1
- data/spec/twitch/bot/memory/redis_spec.rb +40 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97bde27ec4cc411f28c30523554adb7ad7a0d6dc3cf717704f1db493a507b3d8
|
4
|
+
data.tar.gz: e485c169f546a94351cfad4243cff63e56dd098326cec70ef1a1628e5e4052b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92caf967720585dc8d0c09ea9a2505bdb1d28b1b856287dc6bdb4d16ab0daac1b243a63c11b93817ece43920d7b70be657383787c0ec3c107fffb9ad4b772643
|
7
|
+
data.tar.gz: a27bd67581b402f6cfe84dbb4f467ff19b090c4c5969d0c6e9c6fc2864fa965702b8dcb06b4602ea28636bc4065e19bda4e8aa9215f20086daeaf82f1e955f0c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog Twitch::Bot
|
2
2
|
|
3
|
+
## v4.0.0
|
4
|
+
|
5
|
+
* [BREAKING] Using `REDIS_HOST` and `REDIS_PORT` for the connection details in `Twitch::Bot::Memory::Redis` was a bad choice. Providers like Heroku use a combined `REDIS_URL` instead. So do we now. (Alternatively, there's still the way via the `Config` object.)
|
6
|
+
|
3
7
|
## v3.2.1
|
4
8
|
|
5
9
|
* [FIXED] The Terminal adapter now returns all messages from the channel owner, allowing to test privileged functionality in dev mode.
|
@@ -25,12 +25,15 @@ module Twitch
|
|
25
25
|
attr_reader :client, :redis
|
26
26
|
|
27
27
|
def connect_db
|
28
|
+
url = ENV["REDIS_URL"] || redis_config_url
|
29
|
+
::Redis.new(url: url)
|
30
|
+
end
|
31
|
+
|
32
|
+
def redis_config_url
|
28
33
|
config = client.config
|
29
|
-
host = config.setting("redis_host") ||
|
30
|
-
|
31
|
-
port
|
32
|
-
ENV["REDIS_PORT"] || 6379
|
33
|
-
::Redis.new(host: host, port: port)
|
34
|
+
host = config.setting("redis_host") || "localhost"
|
35
|
+
port = config.setting("redis_port") || 6379
|
36
|
+
"redis://#{host}:#{port}"
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
data/lib/twitch/bot/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
RSpec.describe Twitch::Bot::Memory::Redis do
|
4
4
|
describe "#store" do
|
5
|
-
it "
|
5
|
+
it "works with default connection details" do
|
6
6
|
config = Twitch::Bot::Config.new(
|
7
7
|
settings: {
|
8
8
|
bot_user: "testuser",
|
@@ -19,4 +19,43 @@ RSpec.describe Twitch::Bot::Memory::Redis do
|
|
19
19
|
expect(mem.retrieve("foo")).to eq "bar"
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
it "works with ENV connection details" do
|
24
|
+
ENV["REDIS_URL"] = "redis://localhost:6379"
|
25
|
+
config = Twitch::Bot::Config.new(
|
26
|
+
settings: {
|
27
|
+
bot_user: "testuser",
|
28
|
+
},
|
29
|
+
)
|
30
|
+
client = Twitch::Bot::Client.new(
|
31
|
+
config: config,
|
32
|
+
channel: "testchannel",
|
33
|
+
)
|
34
|
+
mem = described_class.new(client: client)
|
35
|
+
|
36
|
+
mem.store("foo", "bar")
|
37
|
+
|
38
|
+
expect(mem.retrieve("foo")).to eq "bar"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "works with config connection details" do
|
42
|
+
config = Twitch::Bot::Config.new(
|
43
|
+
settings: {
|
44
|
+
bot_user: "testuser",
|
45
|
+
redis: {
|
46
|
+
host: "localhost",
|
47
|
+
port: 6379,
|
48
|
+
},
|
49
|
+
},
|
50
|
+
)
|
51
|
+
client = Twitch::Bot::Client.new(
|
52
|
+
config: config,
|
53
|
+
channel: "testchannel",
|
54
|
+
)
|
55
|
+
mem = described_class.new(client: client)
|
56
|
+
|
57
|
+
mem.store("foo", "bar")
|
58
|
+
|
59
|
+
expect(mem.retrieve("foo")).to eq "bar"
|
60
|
+
end
|
22
61
|
end
|