rimless 1.7.5 → 1.7.6
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 +5 -0
- data/lib/rimless/compatibility/karafka_1_4.rb +56 -0
- data/lib/rimless/initializers/compatibility.rb +17 -0
- 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: 1e635ab06b06126938fd981a6f5843fdd9fe9209dd60f3217979803c3908bd93
|
4
|
+
data.tar.gz: 80e465ae3d3d5c876e1b8aee66889a652680cebfb262fc9b69b2f8329d3c410b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aaf13e560d01488a7c1f58279149489b57250762e77ada485dc55abad6af0d02cf84a7ad2945b1fd306602f04dad15cf28c0c79f814e1a5d57d49134925df26
|
7
|
+
data.tar.gz: 0f39ca294394e1ce8ba82d53e98c4f2109dd072907715a26d9a399fda1fe471c656b714751323a11ab1e7156e353dcfa53ebc26d1f1568e5408ceae73df122bf
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -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')
|
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.6
|
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
|