rimless 1.7.5 → 1.7.6

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: f3c529e0b02be14c5f7314056e997817c8f9457cde8e84dfe68da219df922801
4
- data.tar.gz: 7be0885ca438c95a653330aaa5e06f874f7abd572d5f36738c293f6da680b8a7
3
+ metadata.gz: 1e635ab06b06126938fd981a6f5843fdd9fe9209dd60f3217979803c3908bd93
4
+ data.tar.gz: 80e465ae3d3d5c876e1b8aee66889a652680cebfb262fc9b69b2f8329d3c410b
5
5
  SHA512:
6
- metadata.gz: df1aa2ab9018d994d829cc9257831266c4a8dd548fc92d9d294a3bd805e3e773704156d7f4bb751038a369b9d189dfa196216807a774e24e7b8b0bc123fc7a8b
7
- data.tar.gz: d42b81a6e97bd3a4f2a47733c3d9814b5ee506a64b21dbd4d59a1694e706a19de1a4b97412034d0f309f1cb80b6ecd47e41f9f5bc740311ab5d3f09a3e8f3fbc
6
+ metadata.gz: 7aaf13e560d01488a7c1f58279149489b57250762e77ada485dc55abad6af0d02cf84a7ad2945b1fd306602f04dad15cf28c0c79f814e1a5d57d49134925df26
7
+ data.tar.gz: 0f39ca294394e1ce8ba82d53e98c4f2109dd072907715a26d9a399fda1fe471c656b714751323a11ab1e7156e353dcfa53ebc26d1f1568e5408ceae73df122bf
data/.yardopts CHANGED
@@ -4,4 +4,5 @@
4
4
  -
5
5
  README.md
6
6
  doc/examples/**/*.rb
7
+ doc/*.md
7
8
  doc/kafka-playground/examples/**/*.rb
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  * TODO: Replace this bullet point with an actual description of a change.
4
4
 
5
+ ### 1.7.6
6
+
7
+ * Added a monkey-patch for the constellation Karafka 1.4 and Thor 1.3,
8
+ on Ruby >=2.7 (#42)
9
+
5
10
  ### 1.7.5
6
11
 
7
12
  * 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')
@@ -3,7 +3,7 @@
3
3
  # The gem version details.
4
4
  module Rimless
5
5
  # The version of the +rimless+ gem
6
- VERSION = '1.7.5'
6
+ VERSION = '1.7.6'
7
7
 
8
8
  class << self
9
9
  # Returns the version of gem as a string.
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.add_runtime_dependency 'activesupport', '>= 5.2'
39
- spec.add_runtime_dependency 'avro_turf', '~> 0.11.0'
40
- spec.add_runtime_dependency 'karafka', '~> 1.4', '< 1.4.15'
41
- spec.add_runtime_dependency 'karafka-sidekiq-backend', '~> 1.4'
42
- spec.add_runtime_dependency 'karafka-testing', '~> 1.4'
43
- spec.add_runtime_dependency 'retries', '>= 0.0.5'
44
- spec.add_runtime_dependency 'sinatra', '~> 2.2'
45
- spec.add_runtime_dependency 'sparsify', '~> 1.1'
46
- spec.add_runtime_dependency 'waterdrop', '~> 1.4'
47
- spec.add_runtime_dependency 'webmock', '~> 3.18'
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.5
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-08-15 00:00:00.000000000 Z
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