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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97bde27ec4cc411f28c30523554adb7ad7a0d6dc3cf717704f1db493a507b3d8
4
- data.tar.gz: e485c169f546a94351cfad4243cff63e56dd098326cec70ef1a1628e5e4052b8
3
+ metadata.gz: 8e4f03406f61c87e0daa72edc415d45fe13acfe5b33514c75a2028c119d52212
4
+ data.tar.gz: 2e5336cff0e7304f91725d05ec7ff5e813ad54a0127554d0f3349d72d435d5d7
5
5
  SHA512:
6
- metadata.gz: 92caf967720585dc8d0c09ea9a2505bdb1d28b1b856287dc6bdb4d16ab0daac1b243a63c11b93817ece43920d7b70be657383787c0ec3c107fffb9ad4b772643
7
- data.tar.gz: a27bd67581b402f6cfe84dbb4f467ff19b090c4c5969d0c6e9c6fc2864fa965702b8dcb06b4602ea28636bc4065e19bda4e8aa9215f20086daeaf82f1e955f0c
6
+ metadata.gz: e634d550cbd5b2dfb8f80216f11284c015aa9e6e78cb9a08557af848b92f1505f8ac66c70270ce5329aa6eccc2bc3b2f8fba39b690032f5b7e7c8d0941a5fe1f
7
+ data.tar.gz: cc44b72bb4656a743321e5da2596da419e8eb078e759bea9742cfffa5a2047156caae7588a4cc3a3fcb7e302999a92b00c07a7531a9105d22137bc5a44268d04
data/.env.dist ADDED
@@ -0,0 +1 @@
1
+ REDIS_URL=redis://localhost:6379
@@ -26,8 +26,7 @@ jobs:
26
26
  run: |
27
27
  bundle exec rake test
28
28
  env:
29
- REDIS_HOST: redis
30
- REDIS_PORT: 6379
29
+ REDIS_URL: 'redis://redis:6379'
31
30
 
32
31
  release:
33
32
  if: startsWith(github.ref, 'refs/tags/v')
data/.gitignore CHANGED
@@ -16,3 +16,4 @@
16
16
 
17
17
  # rspec failure tracking
18
18
  .rspec_status
19
+ .env
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"] || redis_config_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
- host = config.setting("redis_host") || "localhost"
35
- port = config.setting("redis_port") || 6379
36
- "redis://#{host}:#{port}"
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Twitch
4
4
  module Bot
5
- VERSION = "4.0.0"
5
+ VERSION = "4.0.1"
6
6
  end
7
7
  end
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,10 @@
3
3
  require "bundler/setup"
4
4
  require "rspec/core"
5
5
  require "pry-byebug"
6
+
7
+ require "dotenv"
8
+ Dotenv.load(".env")
9
+
6
10
  require_relative "../lib/twitch/bot"
7
11
 
8
12
  RSpec.configure do |config|
@@ -2,7 +2,7 @@
2
2
 
3
3
  RSpec.describe Twitch::Bot::Memory::Redis do
4
4
  describe "#store" do
5
- it "works with default connection details" do
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
- 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,
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
- client = Twitch::Bot::Client.new(
52
- config: config,
53
- channel: "testchannel",
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
- mem.store("foo", "bar")
39
+ mem.store("foo", "bar")
58
40
 
59
- expect(mem.retrieve("foo")).to eq "bar"
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.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-04-28 00:00:00.000000000 Z
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: freistil-rubocop
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: guard
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: '4.7'
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: '4.7'
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"