bps-kafka 0.1.3 → 0.2.3

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: b5d05abc6c4a93507504408f2896d0b58bfd0e0a31b8cc1158880cd10c0f9f4d
4
- data.tar.gz: dedbc0320b57dab92bdc9496dce28e8bbf0f00d49783fb63b6970adf49ca411e
3
+ metadata.gz: a0011da50b81535c09e800cb6ca91d37cd00a68cf127cf981cd20921bbc9a479
4
+ data.tar.gz: db8273a953132cd62213ec57a72f83d3ed145d8d940cd69e636ababe293f61a4
5
5
  SHA512:
6
- metadata.gz: 5aefa008139667df54d170f7f7ddbce4084136885dae21565f2734a71ce4016d3d633964076b9c8b4bcf44a24c0bcc0ad260fb5925eb334599018c7d4a3817b5
7
- data.tar.gz: 1bc340118cd5b21d996f78f0705f8acd60f8d13a75c1e0576a60bc99f923015d0834a26932efa19a2b05a0f6f631be33395c62f89091ad6515ef0100ad9886e8
6
+ metadata.gz: 850365053b425e5b41b609b228ef6b2e48ebd702c21867c827c8c714bbbb03b6e72ff6460de07f4166b62c3429572a9de4645d2e4ca4eba810435ef2f665dd38
7
+ data.tar.gz: 0dae8ab5423f51dd5b1cb29eb00492a68c033167c92122e8ebff1fa45b0ac307bc36d749b8af908e390d3bc852c79eae8be7143576e1e44254a12ac2a22130be
data/bps-kafka.gemspec CHANGED
@@ -19,4 +19,5 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_dependency 'bps', s.version
21
21
  s.add_dependency 'ruby-kafka', '>= 1.1.0.beta1'
22
+ s.metadata['rubygems_mfa_required'] = 'true'
22
23
  end
@@ -93,6 +93,8 @@ module BPS
93
93
  end
94
94
 
95
95
  def close
96
+ super
97
+
96
98
  @producer.shutdown
97
99
  @client.close
98
100
  end
@@ -102,7 +104,7 @@ module BPS
102
104
  def parse_url(url)
103
105
  port = url.port&.to_s || '9092'
104
106
  CGI.unescape(url.host).split(',').map do |addr|
105
- addr << ':' << port unless addr.match(/:\d+$/)
107
+ addr << ':' << port unless /:\d+$/.match?(addr)
106
108
  addr
107
109
  end
108
110
  end
@@ -2,33 +2,34 @@ require 'spec_helper'
2
2
  require 'bps/kafka'
3
3
 
4
4
  RSpec.describe 'Kafka', kafka: true do
5
- context 'resolve addrs' do
6
- let(:client) { double('Kafka', producer: nil) }
5
+ context 'with addr resolving' do
6
+ let(:client) { instance_double(::Kafka::Client, producer: nil) }
7
+
7
8
  before { allow(::Kafka).to receive(:new).and_return(client) }
8
9
 
9
- it 'should resolve simple URLs' do
10
+ it 'resolves simple URLs' do
10
11
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
11
- expect(::Kafka).to receive(:new).with(['test.host:9092'], {}).and_return(client)
12
+ allow(::Kafka).to receive(:new).with(['test.host:9092'], {}).and_return(client)
12
13
  else
13
- expect(::Kafka).to receive(:new).with(['test.host:9092']).and_return(client)
14
+ allow(::Kafka).to receive(:new).with(['test.host:9092']).and_return(client)
14
15
  end
15
16
  BPS::Publisher.resolve(URI.parse('kafka+sync://test.host:9092'))
16
17
  end
17
18
 
18
- it 'should resolve URLs with multiple hosts' do
19
+ it 'resolves URLs with multiple hosts' do
19
20
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
20
- expect(::Kafka).to receive(:new).with(['foo.host:9092', 'bar.host:9092'], {}).and_return(client)
21
+ allow(::Kafka).to receive(:new).with(['foo.host:9092', 'bar.host:9092'], {}).and_return(client)
21
22
  else
22
- expect(::Kafka).to receive(:new).with(['foo.host:9092', 'bar.host:9092']).and_return(client)
23
+ allow(::Kafka).to receive(:new).with(['foo.host:9092', 'bar.host:9092']).and_return(client)
23
24
  end
24
25
  BPS::Publisher.resolve(URI.parse('kafka+sync://foo.host,bar.host:9092'))
25
26
  end
26
27
 
27
- it 'should resolve URLs with multiple hosts/ports' do
28
+ it 'resolves URLs with multiple hosts/ports' do
28
29
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
29
- expect(::Kafka).to receive(:new).with(['foo.host:9093', 'bar.host:9092'], {}).and_return(client)
30
+ allow(::Kafka).to receive(:new).with(['foo.host:9093', 'bar.host:9092'], {}).and_return(client)
30
31
  else
31
- expect(::Kafka).to receive(:new).with(['foo.host:9093', 'bar.host:9092']).and_return(client)
32
+ allow(::Kafka).to receive(:new).with(['foo.host:9093', 'bar.host:9092']).and_return(client)
32
33
  end
33
34
  BPS::Publisher.resolve(URI.parse('kafka+sync://foo.host%3A9093,bar.host'))
34
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bps-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Black Square Media
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-24 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bps
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.3
19
+ version: 0.2.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.3
26
+ version: 0.2.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-kafka
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,8 @@ files:
53
53
  homepage: https://github.com/bsm/bps
54
54
  licenses:
55
55
  - Apache-2.0
56
- metadata: {}
56
+ metadata:
57
+ rubygems_mfa_required: 'true'
57
58
  post_install_message:
58
59
  rdoc_options: []
59
60
  require_paths:
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  - !ruby/object:Gem::Version
70
71
  version: '0'
71
72
  requirements: []
72
- rubygems_version: 3.1.2
73
+ rubygems_version: 3.3.3
73
74
  signing_key:
74
75
  specification_version: 4
75
76
  summary: Kafka adapter for bps