karafka-core 2.0.9 → 2.0.10

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: e72c7e94ff3ed4be1b9e895f05f5642b72421f7cc8a0f62de4b41c193398e69d
4
- data.tar.gz: 820738037d6ee277e8ce6a2c3786cfe7e26559836f3c71e46933feeeaff10081
3
+ metadata.gz: fe29c2f11c04331a98b17f3828b1c3f06b98a262f52acccbdc16d7425db75c8a
4
+ data.tar.gz: c82f5aa772769ac4fb36729f17739d6ddc1adb01c2985739e91ebdc6590bbaa0
5
5
  SHA512:
6
- metadata.gz: 17f4711778e4c0aa51355048100ae651eea92a8ca89b6ddaa7e8e312de14ee3770affb76fc88d7eb7780e73bf67bc6958de83bac9b62551743f5c254c35e15cb
7
- data.tar.gz: e68bf7877cd31eaca51fb4ef7f5759e36a52216d41bd7aab05b7195906a1b00c29514c8624ab82534d3ae57d57c87dafc09913953b2462dce606b833228ec015
6
+ metadata.gz: 19b4410f4e65330729f8a11bf1af00b9820519f302eb93371ad48d9fe89a8b4e157f310e94d8cfa88fc0891902c52109e8bfd04200d6240e98246e925f1ad199
7
+ data.tar.gz: 8b0a2c93a04982e1fc593c793937af46812a3fb1e56dbda5ebb27b8c412685e73dbf03d55993ab68b6546002894281a40cff0830800e76f240c256dee982424b
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Karafka core changelog
2
2
 
3
+ ## 2.0.10 (2023-02-01)
4
+ - Move `RspecLocator` to core.
5
+
3
6
  ## 2.0.9 (2023-01-11)
4
7
  - Use `karafka-rdkafka` instead of `rdkafka`. This change is needed to ensure that all consecutive releases are stable and compatible.
5
8
  - Relax Ruby requirement to `2.6`. It does not mean we officially support it but it may work. Go to [Versions Lifecycle and EOL](https://karafka.io/docs/Versions-Lifecycle-and-EOL/) for more details.
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-core (2.0.9)
4
+ karafka-core (2.0.10)
5
5
  concurrent-ruby (>= 1.1)
6
6
  karafka-rdkafka (>= 0.12)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.0.4)
11
+ activesupport (7.0.4.2)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 1.6, < 2)
14
14
  minitest (>= 5.1)
15
15
  tzinfo (~> 2.0)
16
16
  byebug (11.1.3)
17
- concurrent-ruby (1.1.10)
17
+ concurrent-ruby (1.2.0)
18
18
  diff-lcs (1.5.0)
19
19
  docile (1.4.0)
20
20
  factory_bot (6.2.1)
@@ -35,10 +35,10 @@ GEM
35
35
  rspec-mocks (~> 3.12.0)
36
36
  rspec-core (3.12.0)
37
37
  rspec-support (~> 3.12.0)
38
- rspec-expectations (3.12.1)
38
+ rspec-expectations (3.12.2)
39
39
  diff-lcs (>= 1.2.0, < 2.0)
40
40
  rspec-support (~> 3.12.0)
41
- rspec-mocks (3.12.1)
41
+ rspec-mocks (3.12.3)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
43
  rspec-support (~> 3.12.0)
44
44
  rspec-support (3.12.0)
@@ -48,7 +48,7 @@ GEM
48
48
  simplecov_json_formatter (~> 0.1)
49
49
  simplecov-html (0.12.3)
50
50
  simplecov_json_formatter (0.1.4)
51
- tzinfo (2.0.5)
51
+ tzinfo (2.0.6)
52
52
  concurrent-ruby (~> 1.0)
53
53
 
54
54
  PLATFORMS
@@ -63,4 +63,4 @@ DEPENDENCIES
63
63
  simplecov
64
64
 
65
65
  BUNDLED WITH
66
- 2.4.2
66
+ 2.4.5
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Karafka
6
+ module Core
7
+ module Helpers
8
+ # RSpec extension for the `RSpec.describe` subject class auto-discovery
9
+ # It automatically detects the class name that should be described in the given spec
10
+ # based on the spec file path.
11
+ # @example Just include it, extend with instantiation and use `RSpec#describe_current`
12
+ # instead of `RSpec#describe`
13
+ # RSpec.extend SupportEngine::RSpecLocator.new(__FILE__)
14
+ class RSpecLocator < Module
15
+ # @param spec_helper_file_path [String] path to the spec_helper.rb file
16
+ # @param inflections [Hash<String, String>] optional inflections map
17
+ def initialize(spec_helper_file_path, inflections = {})
18
+ super()
19
+ @inflections = inflections
20
+ @specs_root_dir = ::File.dirname(spec_helper_file_path)
21
+ end
22
+
23
+ # Builds needed API
24
+ # @param rspec [Module] RSpec main module
25
+ def extended(rspec)
26
+ super
27
+
28
+ this = self
29
+
30
+ # Allows "auto subject" definitions for the `#describe` method, as it will figure
31
+ # out the proper class that we want to describe
32
+ # @param block [Proc] block with specs
33
+ rspec.define_singleton_method :describe_current do |&block|
34
+ describe(this.inherited, &block)
35
+ end
36
+ end
37
+
38
+ # @return [Class] class name for the RSpec `#describe` method
39
+ def inherited
40
+ caller(2..2)
41
+ .first
42
+ .split(':')
43
+ .first
44
+ .gsub(@specs_root_dir, '')
45
+ .gsub('_spec.rb', '')
46
+ .split('/')
47
+ .delete_if(&:empty?)
48
+ .itself[1..]
49
+ .join('/')
50
+ .camelize
51
+ .then { |string| transform_inflections(string) }
52
+ .constantize
53
+ end
54
+
55
+ private
56
+
57
+ # @param string [String] string we want to cast
58
+ # @return [String] string after inflections
59
+ def transform_inflections(string)
60
+ string = string.dup
61
+
62
+ @inflections.each { |from, to| string.gsub!(from, to) }
63
+
64
+ string
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -4,6 +4,6 @@ module Karafka
4
4
  module Core
5
5
  # Current Karafka::Core version
6
6
  # We follow the versioning schema of given Karafka version
7
- VERSION = '2.0.9'
7
+ VERSION = '2.0.10'
8
8
  end
9
9
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2023-01-11 00:00:00.000000000 Z
38
+ date: 2023-02-01 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: concurrent-ruby
@@ -101,6 +101,7 @@ files:
101
101
  - lib/karafka/core/contractable/contract.rb
102
102
  - lib/karafka/core/contractable/result.rb
103
103
  - lib/karafka/core/contractable/rule.rb
104
+ - lib/karafka/core/helpers/rspec_locator.rb
104
105
  - lib/karafka/core/helpers/time.rb
105
106
  - lib/karafka/core/instrumentation.rb
106
107
  - lib/karafka/core/instrumentation/callbacks_manager.rb
metadata.gz.sig CHANGED
Binary file