msgr 1.1.0.1.b301 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +8 -0
  3. data/.github/workflows/build.yml +52 -0
  4. data/.github/workflows/lint.yml +20 -0
  5. data/.rubocop.yml +9 -48
  6. data/.travis.yml +21 -35
  7. data/Appraisals +18 -0
  8. data/CHANGELOG.md +24 -11
  9. data/Gemfile +8 -15
  10. data/README.md +8 -20
  11. data/Rakefile +5 -5
  12. data/bin/msgr +1 -0
  13. data/gemfiles/rails_5.2.gemfile +14 -0
  14. data/gemfiles/rails_6.0.gemfile +14 -0
  15. data/gemfiles/rails_6.1.gemfile +14 -0
  16. data/gemfiles/rails_master.gemfile +14 -0
  17. data/lib/msgr.rb +1 -0
  18. data/lib/msgr/binding.rb +13 -8
  19. data/lib/msgr/channel.rb +5 -3
  20. data/lib/msgr/cli.rb +18 -11
  21. data/lib/msgr/client.rb +17 -20
  22. data/lib/msgr/connection.rb +13 -1
  23. data/lib/msgr/consumer.rb +2 -3
  24. data/lib/msgr/dispatcher.rb +7 -9
  25. data/lib/msgr/logging.rb +2 -0
  26. data/lib/msgr/message.rb +1 -2
  27. data/lib/msgr/railtie.rb +14 -69
  28. data/lib/msgr/route.rb +1 -4
  29. data/lib/msgr/routes.rb +2 -0
  30. data/lib/msgr/tasks/msgr/drain.rake +11 -0
  31. data/lib/msgr/test_pool.rb +1 -3
  32. data/lib/msgr/version.rb +1 -1
  33. data/msgr.gemspec +2 -6
  34. data/scripts/simple_test.rb +2 -3
  35. data/spec/fixtures/{msgr-routes-test-1.rb → msgr_routes_test_1.rb} +0 -0
  36. data/spec/integration/dummy/Rakefile +1 -1
  37. data/spec/{msgr/support/.keep → integration/dummy/app/assets/config/manifest.js} +0 -0
  38. data/spec/integration/dummy/bin/bundle +1 -1
  39. data/spec/integration/dummy/bin/rails +1 -1
  40. data/spec/integration/dummy/config/application.rb +1 -1
  41. data/spec/integration/dummy/config/boot.rb +2 -2
  42. data/spec/integration/dummy/config/environment.rb +1 -1
  43. data/spec/integration/dummy/config/rabbitmq.yml +1 -1
  44. data/spec/integration/msgr/dispatcher_spec.rb +28 -12
  45. data/spec/integration/msgr/railtie_spec.rb +10 -120
  46. data/spec/integration/spec_helper.rb +2 -3
  47. data/spec/integration/{msgr_spec.rb → test_controller_spec.rb} +1 -1
  48. data/spec/unit/msgr/client_spec.rb +88 -0
  49. data/spec/{msgr → unit}/msgr/connection_spec.rb +1 -1
  50. data/spec/{msgr → unit}/msgr/consumer_spec.rb +0 -0
  51. data/spec/unit/msgr/dispatcher_spec.rb +45 -0
  52. data/spec/{msgr → unit}/msgr/route_spec.rb +15 -14
  53. data/spec/{msgr → unit}/msgr/routes_spec.rb +32 -35
  54. data/spec/{msgr → unit}/msgr_spec.rb +25 -16
  55. data/spec/{msgr → unit}/spec_helper.rb +1 -1
  56. data/spec/unit/support/.keep +0 -0
  57. metadata +39 -36
  58. data/gemfiles/Gemfile.rails-4-2 +0 -7
  59. data/gemfiles/Gemfile.rails-5-0 +0 -7
  60. data/gemfiles/Gemfile.rails-5-1 +0 -7
  61. data/gemfiles/Gemfile.rails-5-2 +0 -7
  62. data/gemfiles/Gemfile.rails-master +0 -14
  63. data/spec/msgr/msgr/client_spec.rb +0 -60
  64. data/spec/msgr/msgr/dispatcher_spec.rb +0 -44
  65. data/spec/support/setup.rb +0 -29
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  require 'msgr'
14
14
 
15
- Dir[File.expand_path('../support/**/*.rb', __FILE__)].each {|f| require f }
15
+ Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each {|f| require f }
16
16
 
17
17
  RSpec.configure do |config|
18
18
  config.order = 'random'
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.1.b301
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-06 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -60,26 +60,29 @@ dependencies:
60
60
  version: '0'
61
61
  description: 'Msgr: Rails-like Messaging Framework'
62
62
  email:
63
- - jg@altimos.de
63
+ - jgraichen@altimos.de
64
64
  executables:
65
65
  - msgr
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
+ - ".editorconfig"
70
+ - ".github/workflows/build.yml"
71
+ - ".github/workflows/lint.yml"
69
72
  - ".gitignore"
70
73
  - ".rubocop.yml"
71
74
  - ".travis.yml"
75
+ - Appraisals
72
76
  - CHANGELOG.md
73
77
  - Gemfile
74
78
  - LICENSE.txt
75
79
  - README.md
76
80
  - Rakefile
77
81
  - bin/msgr
78
- - gemfiles/Gemfile.rails-4-2
79
- - gemfiles/Gemfile.rails-5-0
80
- - gemfiles/Gemfile.rails-5-1
81
- - gemfiles/Gemfile.rails-5-2
82
- - gemfiles/Gemfile.rails-master
82
+ - gemfiles/rails_5.2.gemfile
83
+ - gemfiles/rails_6.0.gemfile
84
+ - gemfiles/rails_6.1.gemfile
85
+ - gemfiles/rails_master.gemfile
83
86
  - lib/msgr.rb
84
87
  - lib/msgr/binding.rb
85
88
  - lib/msgr/channel.rb
@@ -94,12 +97,14 @@ files:
94
97
  - lib/msgr/railtie.rb
95
98
  - lib/msgr/route.rb
96
99
  - lib/msgr/routes.rb
100
+ - lib/msgr/tasks/msgr/drain.rake
97
101
  - lib/msgr/test_pool.rb
98
102
  - lib/msgr/version.rb
99
103
  - msgr.gemspec
100
104
  - scripts/simple_test.rb
101
- - spec/fixtures/msgr-routes-test-1.rb
105
+ - spec/fixtures/msgr_routes_test_1.rb
102
106
  - spec/integration/dummy/Rakefile
107
+ - spec/integration/dummy/app/assets/config/manifest.js
103
108
  - spec/integration/dummy/app/consumers/application_consumer.rb
104
109
  - spec/integration/dummy/app/consumers/test_consumer.rb
105
110
  - spec/integration/dummy/app/controllers/application_controller.rb
@@ -125,18 +130,17 @@ files:
125
130
  - spec/integration/dummy/public/favicon.ico
126
131
  - spec/integration/msgr/dispatcher_spec.rb
127
132
  - spec/integration/msgr/railtie_spec.rb
128
- - spec/integration/msgr_spec.rb
129
133
  - spec/integration/spec_helper.rb
130
- - spec/msgr/msgr/client_spec.rb
131
- - spec/msgr/msgr/connection_spec.rb
132
- - spec/msgr/msgr/consumer_spec.rb
133
- - spec/msgr/msgr/dispatcher_spec.rb
134
- - spec/msgr/msgr/route_spec.rb
135
- - spec/msgr/msgr/routes_spec.rb
136
- - spec/msgr/msgr_spec.rb
137
- - spec/msgr/spec_helper.rb
138
- - spec/msgr/support/.keep
139
- - spec/support/setup.rb
134
+ - spec/integration/test_controller_spec.rb
135
+ - spec/unit/msgr/client_spec.rb
136
+ - spec/unit/msgr/connection_spec.rb
137
+ - spec/unit/msgr/consumer_spec.rb
138
+ - spec/unit/msgr/dispatcher_spec.rb
139
+ - spec/unit/msgr/route_spec.rb
140
+ - spec/unit/msgr/routes_spec.rb
141
+ - spec/unit/msgr_spec.rb
142
+ - spec/unit/spec_helper.rb
143
+ - spec/unit/support/.keep
140
144
  homepage: https://github.com/jgraichen/msgr
141
145
  licenses:
142
146
  - MIT
@@ -152,18 +156,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
156
  version: '0'
153
157
  required_rubygems_version: !ruby/object:Gem::Requirement
154
158
  requirements:
155
- - - ">"
159
+ - - ">="
156
160
  - !ruby/object:Gem::Version
157
- version: 1.3.1
161
+ version: '0'
158
162
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.7.7
163
+ rubygems_version: 3.0.8
161
164
  signing_key:
162
165
  specification_version: 4
163
166
  summary: 'Msgr: Rails-like Messaging Framework'
164
167
  test_files:
165
- - spec/fixtures/msgr-routes-test-1.rb
168
+ - spec/fixtures/msgr_routes_test_1.rb
166
169
  - spec/integration/dummy/Rakefile
170
+ - spec/integration/dummy/app/assets/config/manifest.js
167
171
  - spec/integration/dummy/app/consumers/application_consumer.rb
168
172
  - spec/integration/dummy/app/consumers/test_consumer.rb
169
173
  - spec/integration/dummy/app/controllers/application_controller.rb
@@ -189,15 +193,14 @@ test_files:
189
193
  - spec/integration/dummy/public/favicon.ico
190
194
  - spec/integration/msgr/dispatcher_spec.rb
191
195
  - spec/integration/msgr/railtie_spec.rb
192
- - spec/integration/msgr_spec.rb
193
196
  - spec/integration/spec_helper.rb
194
- - spec/msgr/msgr/client_spec.rb
195
- - spec/msgr/msgr/connection_spec.rb
196
- - spec/msgr/msgr/consumer_spec.rb
197
- - spec/msgr/msgr/dispatcher_spec.rb
198
- - spec/msgr/msgr/route_spec.rb
199
- - spec/msgr/msgr/routes_spec.rb
200
- - spec/msgr/msgr_spec.rb
201
- - spec/msgr/spec_helper.rb
202
- - spec/msgr/support/.keep
203
- - spec/support/setup.rb
197
+ - spec/integration/test_controller_spec.rb
198
+ - spec/unit/msgr/client_spec.rb
199
+ - spec/unit/msgr/connection_spec.rb
200
+ - spec/unit/msgr/consumer_spec.rb
201
+ - spec/unit/msgr/dispatcher_spec.rb
202
+ - spec/unit/msgr/route_spec.rb
203
+ - spec/unit/msgr/routes_spec.rb
204
+ - spec/unit/msgr_spec.rb
205
+ - spec/unit/spec_helper.rb
206
+ - spec/unit/support/.keep
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Load root Gemfile
4
- eval_gemfile '../Gemfile'
5
-
6
- gem 'activesupport', '~> 4.2.0'
7
- gem 'bunny', ENV['BUNNY_VERSION'] if ENV['BUNNY_VERSION']
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Load root Gemfile
4
- eval_gemfile '../Gemfile'
5
-
6
- gem 'activesupport', '~> 5.0.0'
7
- gem 'bunny', ENV['BUNNY_VERSION'] if ENV['BUNNY_VERSION']
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Load root Gemfile
4
- eval_gemfile '../Gemfile'
5
-
6
- gem 'activesupport', '~> 5.1.0'
7
- gem 'bunny', ENV['BUNNY_VERSION'] if ENV['BUNNY_VERSION']
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Load root Gemfile
4
- eval_gemfile '../Gemfile'
5
-
6
- gem 'activesupport', '~> 5.2.0'
7
- gem 'bunny', ENV['BUNNY_VERSION'] if ENV['BUNNY_VERSION']
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- NO_RAILS_GEM = true
4
-
5
- # Load root Gemfile
6
- eval_gemfile '../Gemfile'
7
-
8
- gem 'activesupport', git: 'https://github.com/rails/rails'
9
- gem 'bunny', ENV['BUNNY_VERSION'] if ENV['BUNNY_VERSION']
10
-
11
- group :rails do
12
- gem 'rails', '>= 5.2', git: 'https://github.com/rails/rails', require: 'rails'
13
- gem 'sqlite3', '~> 1.4'
14
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Msgr::Client do
6
- subject { described_class.new config }
7
- let(:config) { {} }
8
-
9
- describe '#uri' do
10
- subject { super().uri.to_s }
11
-
12
- context 'with default config' do
13
- it 'uses the default config' do
14
- is_expected.to eq 'amqp://127.0.0.1'
15
- end
16
- end
17
-
18
- context 'with overwritten URI' do
19
- context 'without vhost' do
20
- let(:config) { {uri: 'amqp://rabbit'} }
21
-
22
- it 'does not specify a vhost' do
23
- is_expected.to eq 'amqp://rabbit'
24
- end
25
- end
26
-
27
- context 'with empty vhost' do
28
- let(:config) { {uri: 'amqp://rabbit/'} }
29
-
30
- it 'does not specify a vhost' do
31
- is_expected.to eq 'amqp://rabbit'
32
- end
33
- end
34
-
35
- context 'with explicit vhost' do
36
- let(:config) { {uri: 'amqp://rabbit/some_vhost'} }
37
-
38
- # This behavior is due to legacy parsing in Msgr's config.
39
- # We interpret the entire path (incl. the leading slash)
40
- # as vhost. As per AMQP rules, this means the leading slash
41
- # is part of the vhost, which means it has to be URL encoded.
42
- # This will likely change with the next major release.
43
- it 'uses the entire path as vhost' do
44
- is_expected.to eq 'amqp://rabbit/%2Fsome_vhost'
45
- end
46
- end
47
- end
48
-
49
- context 'with URI and vhost' do
50
- let(:config) { {uri: 'amqp://rabbit/some_vhost', vhost: 'real_vhost'} }
51
-
52
- # This is currently the only way to specify a vhost without
53
- # leading slash (as a vhost in the :uri config would have
54
- # an extra URL encoded leading slash).
55
- it 'uses the explicit vhost' do
56
- is_expected.to eq 'amqp://rabbit/real_vhost'
57
- end
58
- end
59
- end
60
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- class MsgrAutoAckConsumer < Msgr::Consumer
6
- self.auto_ack = true
7
-
8
- def index
9
- end
10
- end
11
-
12
- class MsgrManualAckConsumer < Msgr::Consumer
13
- self.auto_ack = false
14
-
15
- def index
16
- end
17
- end
18
-
19
- describe Msgr::Dispatcher do
20
- let(:config) { {} }
21
- let(:args) { [config] }
22
- let(:dispatcher) { Msgr::Dispatcher.new(*args) }
23
- subject { dispatcher }
24
-
25
- describe 'dispatch' do
26
- it 'should ack messages automatically if auto_ack is enabled' do
27
- route_db = double('Route', :consumer => 'MsgrAutoAckConsumer', :action => :index)
28
- msg_db = double('Message', :route => route_db, :acked? => false)
29
- expect(msg_db).to receive(:ack)
30
- expect(msg_db).not_to receive(:nack)
31
-
32
- dispatcher.dispatch(msg_db)
33
- end
34
-
35
- it 'should not ack messages if auto_ack is disabled' do
36
- route_db = double('Route', :consumer => 'MsgrManualAckConsumer', :action => :index)
37
- msg_db = double('Message', :route => route_db, :acked? => false)
38
- expect(msg_db).not_to receive(:ack)
39
- expect(msg_db).not_to receive(:nack)
40
-
41
- dispatcher.dispatch(msg_db)
42
- end
43
- end
44
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler'
4
-
5
- # Somewhere between
6
- # `ruby -w -W2 -S rspec ...`
7
- # and the rspec executable `bundle/setup` is required or
8
- # `Bundler.setup` without groups called. This will let Bundler
9
- # load ALL gems from ALL groups. This results in leaking
10
- # gems only for rails integration tests into msgr testing
11
- # environment.
12
- #
13
- # This file will be required by ruby on the commandline before
14
- # everything else can kick in. The code snippet below will
15
- # patch bundler to just ignore `setup` calls without
16
- # specified groups. All test helper will explicit call
17
- # `Bundler.setup` with required test groups.
18
-
19
- module Bundler
20
- class << self
21
- alias old_setup setup
22
- def setup(*groups)
23
- old_setup(*groups) unless groups.empty?
24
- end
25
- end
26
- end
27
-
28
- # Only load default group
29
- Bundler.setup :default