gruf 2.20.1 → 2.21.1

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: 321dd6bdff2f6c704c6129569d694f921e29a894eea19a4fff05f46f8900ef5b
4
- data.tar.gz: 3a756651b5b4fce7212a0101edc86f9e83e3c95e559dc91587989ac1276bc368
3
+ metadata.gz: 0bd7ab055cde1666c63a704faa4daf2b0f9fcc1c75bb7c356a48b430f370760a
4
+ data.tar.gz: 0d8a0f0568a8d0c69d46b4712ea58145067389f429e4824bc76e16552572a7c8
5
5
  SHA512:
6
- metadata.gz: 454f4579f37b896b34a89d33902eb9c14ec33e94ea408fcffc918922d23e0f56c0bcc287bac5533322a9fd3897e21a64d51eadc9982c3a781b91f97067157e0e
7
- data.tar.gz: 3892aa18eecaa9aee049961cee2d3ba6695b3c695cc6f66e7eee03fae17de869043922e147d829e8f8b0d94058b99ce48abab2ed6ce00c0d5bba995ce7388a59
6
+ metadata.gz: bdc8a4fd0cdba2adbd0b68a98df59cd14ac0739d1d7c3fb75db8f14e88a6cd5cde7401394a44d8f00de8cf777bbced1afdb6856eaab25cea400632029bdbdc17
7
+ data.tar.gz: afe884659c424ec25b67cdf65470e7aa104b83357df403632101d0cc1d79f1fc97bb748d7db8b730a3dfbb6b77f87b33199c31f991c1e04aa84c3998556b1646
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 2.21.1
6
+
7
+ * [#230] Add fix for load order issues with reloader in some non-Rails environments
8
+
9
+ ### 2.21.0
10
+
11
+ * [#221] Add support for Ruby 3.4
12
+
5
13
  ### 2.20.1
6
14
 
7
15
  * [#208] Fix rails `clear_active_connections!` deprecation warning
data/README.md CHANGED
@@ -17,7 +17,7 @@ up fast and efficiently at scale. Some of its features include:
17
17
  still preserving gRPC BadStatus codes
18
18
  * Server and client execution timings in responses
19
19
 
20
- gruf currently has active support for gRPC 1.10.x+. gruf is compatible and tested with Ruby 3.0-3.3.
20
+ gruf currently has active support for gRPC 1.10.x+. gruf is compatible and tested with Ruby 3.0-3.4.
21
21
  gruf is also not [Rails](https://github.com/rails/rails)-specific, and can be used in any Ruby framework
22
22
  (such as [Grape](https://github.com/ruby-grape/grape) or [dry-rb](https://dry-rb.org/), for instance).
23
23
 
data/gruf.gemspec CHANGED
@@ -32,7 +32,11 @@ Gem::Specification.new do |spec|
32
32
  spec.executables << 'gruf'
33
33
  spec.require_paths = ['lib']
34
34
 
35
- spec.required_ruby_version = '>= 3.0', '< 3.4'
35
+ # The range of supported Ruby major versions is intentionally capped to ensure that the latest Ruby major version is
36
+ # supported by grpc gem before bumping the maximum Ruby major version that this gem officially supports.
37
+ # grpc gem has a history of lagging behind the latest Ruby version support post-new-year every year.
38
+ # See: https://github.com/bigcommerce/gruf/pull/221#issuecomment-2573428792
39
+ spec.required_ruby_version = '>= 3.0', '< 3.5'
36
40
 
37
41
  spec.metadata = {
38
42
  'bug_tracker_uri' => 'https://github.com/bigcommerce/gruf/issues',
@@ -51,18 +51,18 @@ module Gruf
51
51
  #
52
52
  # @return [::Gruf::Controllers::Autoloader]
53
53
  #
54
- # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
54
+ # rubocop:disable ThreadSafety/ClassInstanceVariable
55
55
  def controllers(controllers_path: nil)
56
56
  controllers_mutex do
57
57
  @controllers ||= ::Gruf::Controllers::Autoloader.new(path: controllers_path || ::Gruf.controllers_path)
58
58
  end
59
59
  end
60
- # rubocop:enable ThreadSafety/InstanceVariableInClassMethod
60
+ # rubocop:enable ThreadSafety/ClassInstanceVariable
61
61
 
62
62
  ##
63
63
  # Handle mutations to the controllers autoloader in a thread-safe manner
64
64
  #
65
- # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
65
+ # rubocop:disable ThreadSafety/ClassInstanceVariable
66
66
  def controllers_mutex(&block)
67
67
  @controllers_mutex ||= begin
68
68
  require 'monitor'
@@ -70,7 +70,7 @@ module Gruf
70
70
  end
71
71
  @controllers_mutex.synchronize(&block)
72
72
  end
73
- # rubocop:enable ThreadSafety/InstanceVariableInClassMethod
73
+ # rubocop:enable ThreadSafety/ClassInstanceVariable
74
74
  end
75
75
  end
76
76
  end
data/lib/gruf/client.rb CHANGED
@@ -156,20 +156,24 @@ module Gruf
156
156
  # @param [Symbol] request_method The method name being called on the remote service
157
157
  # @param [Hash] params (Optional) A hash of parameters that will populate the request object
158
158
  # @return [Class] The request object that corresponds to the method being called
159
+ # @return [NilClass] if the descriptor is not found or the input is not defined
159
160
  #
160
161
  def request_object(request_method, params = {})
161
162
  desc = rpc_desc(request_method)
162
- desc&.input ? desc.input.new(params) : nil
163
+ desc&.input&.new(params)
163
164
  end
164
165
 
165
166
  ##
166
167
  # Properly find the appropriate call signature for the GRPC::GenericService given the request method name
167
168
  #
168
169
  # @return [Symbol]
170
+ # @return [NilClass] If the descriptor is not found
169
171
  #
170
172
  def call_signature(request_method)
171
173
  desc = rpc_desc(request_method)
172
- desc&.name ? desc.name.to_s.underscore.to_sym : nil
174
+ return nil unless desc
175
+
176
+ desc.name.to_s.underscore.to_sym
173
177
  end
174
178
 
175
179
  ##
@@ -189,8 +189,8 @@ module Gruf
189
189
  self.use_default_interceptors = ::ENV.fetch('GRUF_USE_DEFAULT_INTERCEPTORS', 1).to_i.positive?
190
190
 
191
191
  if use_default_interceptors
192
- if defined?(::Rails)
193
- interceptors.use(::Gruf::Interceptors::Rails::Reloader, reloader: Rails.application.reloader)
192
+ if defined?(::Rails) && ::Rails.respond_to?(:application) && ::Rails.application.respond_to?(:reloader)
193
+ interceptors.use(::Gruf::Interceptors::Rails::Reloader, reloader: ::Rails.application.reloader)
194
194
  end
195
195
  interceptors.use(::Gruf::Interceptors::ActiveRecord::ConnectionReset)
196
196
  interceptors.use(::Gruf::Interceptors::Instrumentation::OutputMetadataTimer)
@@ -66,9 +66,9 @@ module Gruf
66
66
  service_class = service.name.constantize
67
67
  ::Gruf.logger.debug "[gruf] Binding #{service_class} to #{name}"
68
68
  ::Gruf.services << service_class
69
- # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
69
+ # rubocop:disable ThreadSafety/ClassInstanceVariable
70
70
  @bound_service = service_class
71
- # rubocop:enable ThreadSafety/InstanceVariableInClassMethod
71
+ # rubocop:enable ThreadSafety/ClassInstanceVariable
72
72
  ServiceBinder.bind!(service: service_class, controller: self)
73
73
  end
74
74
 
@@ -90,7 +90,7 @@ module Gruf
90
90
  raise HookNotFoundError if pos.nil?
91
91
 
92
92
  @registry.insert(
93
- (pos + 1),
93
+ pos + 1,
94
94
  klass: hook_class,
95
95
  options: options
96
96
  )
@@ -90,7 +90,7 @@ module Gruf
90
90
  raise InterceptorNotFoundError if pos.nil?
91
91
 
92
92
  @registry.insert(
93
- (pos + 1),
93
+ pos + 1,
94
94
  klass: interceptor_class,
95
95
  options: options
96
96
  )
data/lib/gruf/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
17
  #
18
18
  module Gruf
19
- VERSION = '2.20.1'
19
+ VERSION = '2.21.1'
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.20.1
4
+ version: 2.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-22 00:00:00.000000000 Z
11
+ date: 2025-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -190,14 +190,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
190
  version: '3.0'
191
191
  - - "<"
192
192
  - !ruby/object:Gem::Version
193
- version: '3.4'
193
+ version: '3.5'
194
194
  required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  requirements:
196
196
  - - ">="
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.5.9
200
+ rubygems_version: 3.5.22
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: gRPC Ruby Framework