twitch-bot 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.dist +1 -0
- data/.github/workflows/main.yml +1 -2
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/twitch/bot/memory/redis.rb +6 -4
- data/lib/twitch/bot/version.rb +1 -1
- data/spec/spec_helper.rb +4 -0
- data/spec/twitch/bot/memory/redis_spec.rb +19 -36
- data/twitch-bot.gemspec +1 -2
- metadata +9 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e4f03406f61c87e0daa72edc415d45fe13acfe5b33514c75a2028c119d52212
|
4
|
+
data.tar.gz: 2e5336cff0e7304f91725d05ec7ff5e813ad54a0127554d0f3349d72d435d5d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e634d550cbd5b2dfb8f80216f11284c015aa9e6e78cb9a08557af848b92f1505f8ac66c70270ce5329aa6eccc2bc3b2f8fba39b690032f5b7e7c8d0941a5fe1f
|
7
|
+
data.tar.gz: cc44b72bb4656a743321e5da2596da419e8eb078e759bea9742cfffa5a2047156caae7588a4cc3a3fcb7e302999a92b00c07a7531a9105d22137bc5a44268d04
|
data/.env.dist
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
REDIS_URL=redis://localhost:6379
|
data/.github/workflows/main.yml
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog Twitch::Bot
|
2
2
|
|
3
|
+
## v4.0.1
|
4
|
+
|
5
|
+
* [FIXED] Fixed test crash due to incomplete DotEnv initialization.
|
6
|
+
|
3
7
|
## v4.0.0
|
4
8
|
|
5
9
|
* [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.)
|
@@ -25,15 +25,17 @@ module Twitch
|
|
25
25
|
attr_reader :client, :redis
|
26
26
|
|
27
27
|
def connect_db
|
28
|
-
url = ENV["REDIS_URL"]
|
28
|
+
url = redis_config_url || ENV["REDIS_URL"]
|
29
29
|
::Redis.new(url: url)
|
30
30
|
end
|
31
31
|
|
32
32
|
def redis_config_url
|
33
33
|
config = client.config
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
if config.setting("redis_host")
|
35
|
+
host = config.setting("redis_host") || "localhost"
|
36
|
+
port = config.setting("redis_port") || 6379
|
37
|
+
"redis://#{host}:#{port}"
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
data/lib/twitch/bot/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
RSpec.describe Twitch::Bot::Memory::Redis do
|
4
4
|
describe "#store" do
|
5
|
-
it "works with
|
5
|
+
it "works with ENV connection details" do
|
6
6
|
config = Twitch::Bot::Config.new(
|
7
7
|
settings: {
|
8
8
|
bot_user: "testuser",
|
@@ -18,44 +18,27 @@ RSpec.describe Twitch::Bot::Memory::Redis do
|
|
18
18
|
|
19
19
|
expect(mem.retrieve("foo")).to eq "bar"
|
20
20
|
end
|
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
21
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
22
|
+
it "works with config connection details" do
|
23
|
+
url = URI.parse(ENV["REDIS_URL"])
|
24
|
+
config = Twitch::Bot::Config.new(
|
25
|
+
settings: {
|
26
|
+
bot_user: "testuser",
|
27
|
+
redis: {
|
28
|
+
host: url.host,
|
29
|
+
port: url.port,
|
30
|
+
},
|
48
31
|
},
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
mem = described_class.new(client: client)
|
32
|
+
)
|
33
|
+
client = Twitch::Bot::Client.new(
|
34
|
+
config: config,
|
35
|
+
channel: "testchannel",
|
36
|
+
)
|
37
|
+
mem = described_class.new(client: client)
|
56
38
|
|
57
|
-
|
39
|
+
mem.store("foo", "bar")
|
58
40
|
|
59
|
-
|
41
|
+
expect(mem.retrieve("foo")).to eq "bar"
|
42
|
+
end
|
60
43
|
end
|
61
44
|
end
|
data/twitch-bot.gemspec
CHANGED
@@ -25,9 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency "redis", "~> 4.1"
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
+
spec.add_development_dependency "dotenv"
|
28
29
|
spec.add_development_dependency "freistil-rubocop"
|
29
|
-
spec.add_development_dependency "guard", "~> 2.16"
|
30
|
-
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
31
30
|
spec.add_development_dependency "pry-byebug", "~> 3.0"
|
32
31
|
spec.add_development_dependency "rake", "~> 13.0"
|
33
32
|
spec.add_development_dependency "reek"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitch-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jochen Lillich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: dotenv
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,33 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.16'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.16'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: guard-rspec
|
56
|
+
name: freistil-rubocop
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: pry-byebug
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -188,6 +174,7 @@ extensions: []
|
|
188
174
|
extra_rdoc_files: []
|
189
175
|
files:
|
190
176
|
- ".editorconfig"
|
177
|
+
- ".env.dist"
|
191
178
|
- ".github/workflows/main.yml"
|
192
179
|
- ".gitignore"
|
193
180
|
- ".rspec"
|