message_bus_client_worker 2.0.0 → 2.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aff7876bcf7903db00d276c85cd74fb9237cb2f6b6356c62cc3176171a6984a
4
- data.tar.gz: e1f1d03a6853119e8b9782a76c7751e9216c4a774e46d539f3a8a3f8cf9a8c2d
3
+ metadata.gz: c4ef20ee860c68da5470850b190d1b9cb5362361d3dbfd27b0bd5f12fbc5390b
4
+ data.tar.gz: 5d481f4e6e10a217494271d47c3a65c02fc91401f13103c98cb169a75ff0b289
5
5
  SHA512:
6
- metadata.gz: 43a051412caa26330819721b3a34c920f20834a9226d2841c070c4d9b3341a5ebeac0ac476aa470ee43c651258cf3e247e9b34d325f9cfec44bf4cd032e1f9c9
7
- data.tar.gz: 2f55de0fcdda400f7afceede25fbb6d672685efeefce98e46562b337b92f9ef69bd5e2ec1b21622720572e66eed0baba89322219e3e4f3f18a0883af991b4e80
6
+ metadata.gz: 849f256761e8c427f7d5e16d7b80928764f41d54e85e6c5711d3bd5e02052b3fb19240b50daa90e854bbba400b83026dcba7d5c39d67f157ad5076c437ad3658
7
+ data.tar.gz: 550137b3cc5fd47f6b19fea9ba784069363e368a0a6f35f68dfd6a48763d7cb94d7f234d7b5ee865df35e4bd085198db12cba0c5384240aa5a25cb2a5757a15e
@@ -0,0 +1,32 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: 2.7.0
27
+ - name: Start dbs
28
+ run: docker-compose up --detach sidekiq chat
29
+ - name: Copy config
30
+ run: cp spec/config.yml{.sample,}
31
+ - name: Run tests
32
+ run: docker-compose run gem bundle exec rspec spec
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.1.0] - 2021-10-01
8
+ ### Added
9
+ - `MessageBusClientWorker.subscribe(host, config)` which recommended over setting subscriptions via `configure`
10
+
7
11
  ## [2.0.0] - 2020-03-12
8
12
  ### Changed
9
13
  - Update logging in Sidekiq; requires Sidekiq 6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- message_bus_client_worker (2.0.0)
4
+ message_bus_client_worker (2.1.0)
5
5
  activesupport
6
6
  addressable
7
7
  excon
@@ -12,33 +12,34 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (6.0.2.1)
15
+ activesupport (6.1.4.1)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 0.7, < 2)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
20
- zeitwerk (~> 2.2)
21
- addressable (2.7.0)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ addressable (2.8.0)
22
22
  public_suffix (>= 2.0.2, < 5.0)
23
23
  byebug (10.0.2)
24
24
  coderay (1.1.2)
25
- concurrent-ruby (1.1.6)
25
+ concurrent-ruby (1.1.9)
26
26
  connection_pool (2.2.2)
27
27
  diff-lcs (1.3)
28
- excon (0.72.0)
28
+ excon (0.85.0)
29
29
  gem_config (0.3.2)
30
- i18n (1.8.2)
30
+ i18n (1.8.10)
31
31
  concurrent-ruby (~> 1.0)
32
- light-service (0.12.0)
32
+ light-service (0.17.0)
33
+ activesupport (>= 4.0.0)
33
34
  method_source (0.9.0)
34
- minitest (5.14.0)
35
+ minitest (5.14.4)
35
36
  pry (0.11.3)
36
37
  coderay (~> 1.1.0)
37
38
  method_source (~> 0.9.0)
38
39
  pry-byebug (3.6.0)
39
40
  byebug (~> 10.0)
40
41
  pry (~> 0.10)
41
- public_suffix (4.0.3)
42
+ public_suffix (4.0.6)
42
43
  rack (2.2.2)
43
44
  rack-protection (2.0.8.1)
44
45
  rack
@@ -65,17 +66,15 @@ GEM
65
66
  rack (~> 2.0)
66
67
  rack-protection (>= 2.0.0)
67
68
  redis (>= 4.1.0)
68
- thread_safe (0.3.6)
69
- tzinfo (1.2.6)
70
- thread_safe (~> 0.1)
69
+ tzinfo (2.0.4)
70
+ concurrent-ruby (~> 1.0)
71
71
  wait (0.5.3)
72
- zeitwerk (2.3.0)
72
+ zeitwerk (2.4.2)
73
73
 
74
74
  PLATFORMS
75
75
  ruby
76
76
 
77
77
  DEPENDENCIES
78
- bundler (~> 1.16)
79
78
  message_bus_client_worker!
80
79
  pry-byebug
81
80
  rake (~> 10.0)
@@ -84,4 +83,4 @@ DEPENDENCIES
84
83
  wait
85
84
 
86
85
  BUNDLED WITH
87
- 1.17.3
86
+ 2.2.28
@@ -1,3 +1,3 @@
1
1
  module MessageBusClientWorker
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -26,8 +26,18 @@ module MessageBusClientWorker
26
26
  include GemConfig::Base
27
27
 
28
28
  with_configuration do
29
- has :subscriptions, classes: Hash
29
+ has :subscriptions, classes: [Hash, NilClass]
30
30
  has :client_id, classes: [Proc, String], default: -> {SecureRandom.uuid}
31
31
  end
32
32
 
33
+ def self.subscribe(host, options)
34
+ self.configuration.subscriptions ||= {}
35
+
36
+ if self.configuration.subscriptions.keys.include?(host)
37
+ warn "[#{self.name}] #{host} already configured, overwriting (called from #{caller.first})"
38
+ end
39
+
40
+ self.configuration.subscriptions[host] = options
41
+ end
42
+
33
43
  end
@@ -37,7 +37,6 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency "light-service"
38
38
  spec.add_dependency "activesupport"
39
39
 
40
- spec.add_development_dependency "bundler", "~> 1.16"
41
40
  spec.add_development_dependency "rake", "~> 10.0"
42
41
  spec.add_development_dependency "rspec", "~> 3.0"
43
42
  spec.add_development_dependency "rspec-sidekiq"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_bus_client_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-12 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: bundler
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.16'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.16'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rake
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -164,17 +150,17 @@ dependencies:
164
150
  - - ">="
165
151
  - !ruby/object:Gem::Version
166
152
  version: '0'
167
- description:
153
+ description:
168
154
  email:
169
155
  - ramon.tayag@gmail.com
170
156
  executables: []
171
157
  extensions: []
172
158
  extra_rdoc_files: []
173
159
  files:
160
+ - ".github/workflows/ruby.yml"
174
161
  - ".gitignore"
175
162
  - ".rspec"
176
163
  - ".ruby-version"
177
- - ".travis.yml"
178
164
  - CHANGELOG.md
179
165
  - CODE_OF_CONDUCT.md
180
166
  - Dockerfile
@@ -205,7 +191,7 @@ licenses:
205
191
  - MIT
206
192
  metadata:
207
193
  allowed_push_host: https://rubygems.org
208
- post_install_message:
194
+ post_install_message:
209
195
  rdoc_options: []
210
196
  require_paths:
211
197
  - lib
@@ -220,8 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
206
  - !ruby/object:Gem::Version
221
207
  version: '0'
222
208
  requirements: []
223
- rubygems_version: 3.0.8
224
- signing_key:
209
+ rubygems_version: 3.1.6
210
+ signing_key:
225
211
  specification_version: 4
226
212
  summary: Subscribe to MessageBus using Sidekiq workers
227
213
  test_files: []
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.6.3
5
- before_script:
6
- - cp spec/config.yml{.sample,}
7
- - docker-compose up -d sidekiq chat
8
- script: docker-compose run gem bundle exec rspec spec