rimless 1.7.5 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/CHANGELOG.md +10 -0
- data/lib/rimless/compatibility/karafka_1_4.rb +56 -0
- data/lib/rimless/initializers/compatibility.rb +17 -0
- data/lib/rimless/karafka/base64_interchanger.rb +5 -4
- data/lib/rimless/version.rb +1 -1
- data/lib/rimless.rb +6 -0
- data/rimless.gemspec +10 -10
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65a81e9d34d669a1e6acd791e2c10a189869fc40d2910b478fa37fac6c84accb
|
4
|
+
data.tar.gz: 69a88291a2aef544f0d646e58951f7fc9dc143848b9cc05041cfd19a8e19d47a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 427e0d60a2aae434d3742ab73ae676917077c16216282d6de286c3f32cc5a4c2df02034ff743b8acb1470f2d347d710d0bac322c264f64ddbdda5ad1526a7667
|
7
|
+
data.tar.gz: 7f1bd3ff9c139586dd4b4c14efdd80177860e3d4e7d2dc93e58a29ed2fed67985218031fb3264b103efe2bac209fb3f02a2c9a1495f23d81e66384112d0209bb
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
4
4
|
|
5
|
+
### 1.7.7
|
6
|
+
|
7
|
+
* Corrected the Sidekiq interchanger decoding, which is caused by an upstream
|
8
|
+
update of the karafka-sidekiq-backend gem (#43)
|
9
|
+
|
10
|
+
### 1.7.6
|
11
|
+
|
12
|
+
* Added a monkey-patch for the constellation Karafka 1.4 and Thor 1.3,
|
13
|
+
on Ruby >=2.7 (#42)
|
14
|
+
|
5
15
|
### 1.7.5
|
6
16
|
|
7
17
|
* Just a retag of 1.7.1
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'karafka/cli/base'
|
4
|
+
|
5
|
+
module Karafka
|
6
|
+
class Cli
|
7
|
+
# See: https://github.com/hausgold/rimless/issues/36
|
8
|
+
#
|
9
|
+
# Karafka 1.4 is not compatible with Thor 1.3. Unfortunately they did not
|
10
|
+
# backported the fix on Karafka 2.0 back to 1.4, so we have to do it here
|
11
|
+
# with a monkey-patch.
|
12
|
+
class Base
|
13
|
+
class << self
|
14
|
+
alias original_bind_to bind_to
|
15
|
+
|
16
|
+
# This method will bind a given Cli command into Karafka Cli.
|
17
|
+
# This method is a wrapper to way Thor defines its commands.
|
18
|
+
#
|
19
|
+
# @param cli_class [Karafka::Cli] the class to bind to
|
20
|
+
#
|
21
|
+
# rubocop:disable Metrics/MethodLength because of the
|
22
|
+
# monkey-patching logic
|
23
|
+
def bind_to(cli_class)
|
24
|
+
@aliases ||= []
|
25
|
+
@options ||= []
|
26
|
+
|
27
|
+
# We're late to the party here, as the +karafka/cli/console+ and
|
28
|
+
# +karafka/cli/server+ files were already required and therefore they
|
29
|
+
# already wrote to the +@options+ array. So we will sanitize/split
|
30
|
+
# the options here to allow correct usage of the original Karafka 1.4
|
31
|
+
# +.bind_to+ method.
|
32
|
+
@options.select! do |set|
|
33
|
+
# We look for option sets without name (aliases),
|
34
|
+
# a regular set looks like this: +[:daemon, {:default=>false, ..}]+
|
35
|
+
next true unless set.first.is_a? Hash
|
36
|
+
|
37
|
+
# An alias looks like this: +[{:aliases=>"s"}]+
|
38
|
+
@aliases << set.first[:aliases].to_s
|
39
|
+
|
40
|
+
# Strip this set from the options
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
44
|
+
# Run the original Karafka 1.4 +.bind_to+ method
|
45
|
+
original_bind_to(cli_class)
|
46
|
+
|
47
|
+
# Configure the command aliases
|
48
|
+
@aliases.each do |cmd_alias|
|
49
|
+
cli_class.map cmd_alias => name.to_s
|
50
|
+
end
|
51
|
+
end
|
52
|
+
# rubocop:enable Metrics/MethodLength
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Check the actual (currently loaded) gem version against the expected
|
4
|
+
# (given) version. It returns +true+ when the expected version matches the
|
5
|
+
# actual one. The version check is patch-level independent.
|
6
|
+
#
|
7
|
+
# @param expected [String] the expected gem version (eg. +'~> 5.1'+)
|
8
|
+
# @return [Boolean] whenever the version is loaded or not
|
9
|
+
def rimless_gem_version?(gem_name, expected)
|
10
|
+
actual = Gem.loaded_specs[gem_name].version
|
11
|
+
Gem::Dependency.new('', expected.to_s).match?('', actual)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Load some polyfills for ActiveSupport lower than 6.0
|
15
|
+
require 'rimless/compatibility/karafka_1_4' \
|
16
|
+
if rimless_gem_version?('karafka', '~> 1.4') \
|
17
|
+
&& rimless_gem_version?('thor', '>= 1.3')
|
@@ -11,7 +11,8 @@ module Rimless
|
|
11
11
|
# Encode a binary Apache Kafka message(s) so they can be passed to the
|
12
12
|
# Sidekiq +Rimless::ConsumerJob+.
|
13
13
|
#
|
14
|
-
# @param params_batch [
|
14
|
+
# @param params_batch [Karafka::Params::ParamsBatch] the karafka params
|
15
|
+
# batch object
|
15
16
|
# @return [String] the marshaled+base64 encoded data
|
16
17
|
def encode(params_batch)
|
17
18
|
Base64.encode64(Marshal.dump(super))
|
@@ -21,9 +22,9 @@ module Rimless
|
|
21
22
|
# the Sidekiq +Rimless::ConsumerJob+.
|
22
23
|
#
|
23
24
|
# @param params_string [String] the marshaled+base64 encoded data
|
24
|
-
# @return [
|
25
|
-
def decode(
|
26
|
-
Marshal.load(Base64.decode64(
|
25
|
+
# @return [Array<Hash>] the unmarshaled+base64 decoded data
|
26
|
+
def decode(params_batch)
|
27
|
+
super(Marshal.load(Base64.decode64(params_batch))).map(&:stringify_keys)
|
27
28
|
end
|
28
29
|
end
|
29
30
|
# rubocop:enable Security/MarshalLoad
|
data/lib/rimless/version.rb
CHANGED
data/lib/rimless.rb
CHANGED
@@ -19,6 +19,9 @@ require 'erb'
|
|
19
19
|
|
20
20
|
# The top level namespace for the rimless gem.
|
21
21
|
module Rimless
|
22
|
+
# Configure the relative gem code base location
|
23
|
+
root_path = Pathname.new("#{__dir__}/rimless")
|
24
|
+
|
22
25
|
# Top level elements
|
23
26
|
autoload :Configuration, 'rimless/configuration'
|
24
27
|
autoload :ConfigurationHandling, 'rimless/configuration_handling'
|
@@ -47,4 +50,7 @@ module Rimless
|
|
47
50
|
include Rimless::KafkaHelpers
|
48
51
|
include Rimless::Dependencies
|
49
52
|
include Rimless::Consumer
|
53
|
+
|
54
|
+
# Load all initializers of the gem
|
55
|
+
Dir[root_path.join('initializers/**/*.rb')].sort.each { |path| require path }
|
50
56
|
end
|
data/rimless.gemspec
CHANGED
@@ -35,14 +35,14 @@ Gem::Specification.new do |spec|
|
|
35
35
|
|
36
36
|
spec.required_ruby_version = '>= 2.7'
|
37
37
|
|
38
|
-
spec.
|
39
|
-
spec.
|
40
|
-
spec.
|
41
|
-
spec.
|
42
|
-
spec.
|
43
|
-
spec.
|
44
|
-
spec.
|
45
|
-
spec.
|
46
|
-
spec.
|
47
|
-
spec.
|
38
|
+
spec.add_dependency 'activesupport', '>= 5.2'
|
39
|
+
spec.add_dependency 'avro_turf', '~> 0.11.0'
|
40
|
+
spec.add_dependency 'karafka', '~> 1.4', '< 1.4.15'
|
41
|
+
spec.add_dependency 'karafka-sidekiq-backend', '~> 1.4'
|
42
|
+
spec.add_dependency 'karafka-testing', '~> 1.4'
|
43
|
+
spec.add_dependency 'retries', '>= 0.0.5'
|
44
|
+
spec.add_dependency 'sinatra', '~> 2.2'
|
45
|
+
spec.add_dependency 'sparsify', '~> 1.1'
|
46
|
+
spec.add_dependency 'waterdrop', '~> 1.4'
|
47
|
+
spec.add_dependency 'webmock', '~> 3.18'
|
48
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rimless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hermann Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -221,11 +221,13 @@ files:
|
|
221
221
|
- lib/rimless/avro_helpers.rb
|
222
222
|
- lib/rimless/avro_utils.rb
|
223
223
|
- lib/rimless/base_consumer.rb
|
224
|
+
- lib/rimless/compatibility/karafka_1_4.rb
|
224
225
|
- lib/rimless/configuration.rb
|
225
226
|
- lib/rimless/configuration_handling.rb
|
226
227
|
- lib/rimless/consumer.rb
|
227
228
|
- lib/rimless/consumer_job.rb
|
228
229
|
- lib/rimless/dependencies.rb
|
230
|
+
- lib/rimless/initializers/compatibility.rb
|
229
231
|
- lib/rimless/kafka_helpers.rb
|
230
232
|
- lib/rimless/karafka/avro_deserializer.rb
|
231
233
|
- lib/rimless/karafka/base64_interchanger.rb
|