gruf 2.6.0 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +1 -1
  4. data/gruf.gemspec +2 -1
  5. data/lib/gruf.rb +2 -0
  6. data/lib/gruf/cli/executor.rb +3 -1
  7. data/lib/gruf/client.rb +6 -4
  8. data/lib/gruf/client/error.rb +2 -0
  9. data/lib/gruf/client/error_factory.rb +3 -1
  10. data/lib/gruf/configuration.rb +2 -0
  11. data/lib/gruf/controllers/base.rb +2 -0
  12. data/lib/gruf/controllers/request.rb +2 -0
  13. data/lib/gruf/controllers/service_binder.rb +2 -0
  14. data/lib/gruf/error.rb +4 -2
  15. data/lib/gruf/errors/debug_info.rb +4 -2
  16. data/lib/gruf/errors/field.rb +2 -0
  17. data/lib/gruf/errors/helpers.rb +2 -0
  18. data/lib/gruf/instrumentable_grpc_server.rb +3 -1
  19. data/lib/gruf/integrations/rails/railtie.rb +2 -0
  20. data/lib/gruf/interceptors/active_record/connection_reset.rb +2 -0
  21. data/lib/gruf/interceptors/authentication/basic.rb +2 -0
  22. data/lib/gruf/interceptors/base.rb +2 -0
  23. data/lib/gruf/interceptors/client_interceptor.rb +2 -0
  24. data/lib/gruf/interceptors/context.rb +2 -0
  25. data/lib/gruf/interceptors/instrumentation/output_metadata_timer.rb +2 -0
  26. data/lib/gruf/interceptors/instrumentation/request_logging/formatters/base.rb +2 -0
  27. data/lib/gruf/interceptors/instrumentation/request_logging/formatters/logstash.rb +2 -0
  28. data/lib/gruf/interceptors/instrumentation/request_logging/formatters/plain.rb +2 -0
  29. data/lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb +2 -0
  30. data/lib/gruf/interceptors/instrumentation/statsd.rb +2 -0
  31. data/lib/gruf/interceptors/registry.rb +2 -0
  32. data/lib/gruf/interceptors/server_interceptor.rb +2 -0
  33. data/lib/gruf/interceptors/timer.rb +2 -0
  34. data/lib/gruf/loggable.rb +2 -0
  35. data/lib/gruf/logging.rb +2 -0
  36. data/lib/gruf/outbound/request_context.rb +2 -0
  37. data/lib/gruf/response.rb +2 -0
  38. data/lib/gruf/serializers/errors/base.rb +2 -0
  39. data/lib/gruf/serializers/errors/json.rb +2 -0
  40. data/lib/gruf/server.rb +2 -0
  41. data/lib/gruf/synchronized_client.rb +2 -0
  42. data/lib/gruf/timer.rb +2 -0
  43. data/lib/gruf/version.rb +3 -1
  44. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28c2864213d853958ed8a971e0c713940fff7ffff739a968cfbd179c60e07d4a
4
- data.tar.gz: 510a33981e2dffb15c9057615c9c818cf5338ee4bd7b99bd44aba095e6f8b9ae
3
+ metadata.gz: f7280830d85a916cbc0f80677e072402b4336c59396927b6ea110943b59e5732
4
+ data.tar.gz: 9e2de4546c670e19f7007fc713d70485e2f45d0936c508b13512f9896efeac83
5
5
  SHA512:
6
- metadata.gz: 8471cda11573a443765c8b19a25fd03a4a1f90af0dc827074587bfdc252483d0b1c600ead5725a7e5407c4571eef8de293f169d5ef3de8545f14b5fb456a5629
7
- data.tar.gz: a207cda25695c69ce3e4c2e824d85c4ba46a868dab93e27b8b671f068b42ace300f6bf565c8a955c8b5f287dbfacb66289387752d3ac9ff201e68745d3568f2b
6
+ metadata.gz: b87c53908df9b5f577ff374f404f520168865092117678f4ce32b4b3264e226272965e27a243a32548bcbd32bf496fe5139801c19af549d9d641f071cda544b7
7
+ data.tar.gz: b9b719dc54a055313ab7ee76d95438305989aa961c4c78332555423580371842bc51ed621eae782a2d45df3cab3c9f231d6f4e512afedfda033ed7150a65fa26
@@ -2,6 +2,10 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 2.6.1
6
+
7
+ - Add frozen_string_literal: true to files, update rubocop to 0.68
8
+
5
9
  ### 2.6.0
6
10
 
7
11
  - Drop Ruby 2.2 support
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # gruf - gRPC Ruby Framework
2
2
 
3
- [![Build Status](https://travis-ci.org/bigcommerce/gruf.svg?branch=master)](https://travis-ci.org/bigcommerce/gruf) [![Gem Version](https://badge.fury.io/rb/gruf.svg)](https://badge.fury.io/rb/gruf) [![Documentation](https://inch-ci.org/github/bigcommerce/gruf.svg?branch=master)](https://inch-ci.org/github/bigcommerce/gruf?branch=master)
3
+ [![CircleCI](https://circleci.com/gh/bigcommerce/gruf/tree/master.svg?style=svg)](https://circleci.com/gh/bigcommerce/gruf/tree/master) [![Gem Version](https://badge.fury.io/rb/gruf.svg)](https://badge.fury.io/rb/gruf) [![Documentation](https://inch-ci.org/github/bigcommerce/gruf.svg?branch=master)](https://inch-ci.org/github/bigcommerce/gruf?branch=master)
4
4
 
5
5
  gruf is a Ruby framework that wraps the [gRPC Ruby library](https://github.com/grpc/grpc/tree/master/src/ruby) to
6
6
  provide a more streamlined integration into Ruby and Ruby on Rails applications.
@@ -1,4 +1,5 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
3
4
  #
4
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -38,7 +40,7 @@ module Gruf
38
40
  server.start!
39
41
  rescue StandardError => e
40
42
  msg = "FATAL ERROR: #{e.message} #{e.backtrace.join("\n")}"
41
- logger = Gruf.logger || Logger.new(STDERR)
43
+ logger = Gruf.logger || ::Logger.new(STDERR)
42
44
  logger.fatal msg
43
45
  end
44
46
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -56,8 +58,8 @@ module Gruf
56
58
  @base_klass = service
57
59
  @service_klass = "#{base_klass}::Service".constantize
58
60
  @opts = options || {}
59
- @opts[:password] = options.fetch(:password, '').to_s
60
- @opts[:hostname] = options.fetch(:hostname, Gruf.default_client_host)
61
+ @opts[:password] = @opts.fetch(:password, '').to_s
62
+ @opts[:hostname] = @opts.fetch(:hostname, Gruf.default_client_host)
61
63
  @error_factory = Gruf::Client::ErrorFactory.new
62
64
  client_options[:timeout] = client_options[:timeout].to_i if client_options.key?(:timeout)
63
65
  client = "#{service}::Stub".constantize.new(@opts[:hostname], build_ssl_credentials, client_options)
@@ -152,7 +154,7 @@ module Gruf
152
154
  #
153
155
  def request_object(request_method, params = {})
154
156
  desc = rpc_desc(request_method)
155
- desc && desc.input ? desc.input.new(params) : nil
157
+ desc&.input ? desc.input.new(params) : nil
156
158
  end
157
159
 
158
160
  ##
@@ -162,7 +164,7 @@ module Gruf
162
164
  #
163
165
  def call_signature(request_method)
164
166
  desc = rpc_desc(request_method)
165
- desc && desc.name ? desc.name.to_s.underscore.to_sym : nil
167
+ desc&.name ? desc.name.to_s.underscore.to_sym : nil
166
168
  end
167
169
 
168
170
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -86,7 +88,7 @@ module Gruf
86
88
  return @default_class unless error_class.ancestors.include?(Gruf::Client::Errors::Base)
87
89
 
88
90
  error_class
89
- rescue NameError => _
91
+ rescue NameError => _e
90
92
  @default_class
91
93
  end
92
94
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -54,8 +56,8 @@ module Gruf
54
56
  # not to overflow this limit, or the response message will never
55
57
  # be sent. Instead, resource_exhausted will be thrown.
56
58
  MAX_METADATA_SIZE = 7.5 * 1_024
57
- METADATA_SIZE_EXCEEDED_CODE = 'metadata_size_exceeded'.freeze
58
- METADATA_SIZE_EXCEEDED_MSG = 'Metadata too long, risks exceeding http2 trailing metadata limit.'.freeze
59
+ METADATA_SIZE_EXCEEDED_CODE = 'metadata_size_exceeded'
60
+ METADATA_SIZE_EXCEEDED_MSG = 'Metadata too long, risks exceeding http2 trailing metadata limit.'
59
61
 
60
62
  # @return [Symbol] The given internal gRPC code for the error
61
63
  attr_accessor :code
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -34,8 +36,8 @@ module Gruf
34
36
 
35
37
  # Limit the size of the stack trace to reduce risk of overflowing metadata
36
38
  stack_trace_limit = Gruf.backtrace_limit.to_i
37
- stack_trace_limit = 10 if stack_trace_limit < 0
38
- @stack_trace = @stack_trace[0..stack_trace_limit] if stack_trace_limit > 0
39
+ stack_trace_limit = 10 if stack_trace_limit.negative?
40
+ @stack_trace = @stack_trace[0..stack_trace_limit] if stack_trace_limit.positive?
39
41
  end
40
42
 
41
43
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gruf
2
4
  ##
3
5
  # A subclass of GRPC::RpcServer that can be used for enhanced monitoring
@@ -36,7 +38,7 @@ module Gruf
36
38
  # Notify the event listener of something interesting
37
39
  #
38
40
  def notify(event)
39
- return unless @event_listener_proc && @event_listener_proc.respond_to?(:call)
41
+ return if @event_listener_proc.nil? || !@event_listener_proc.respond_to?(:call)
40
42
 
41
43
  @event_listener_proc.call(event)
42
44
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Gruf
2
4
  module Integrations
3
5
  module Rails
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved
2
4
  #
3
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@@ -14,5 +16,5 @@
14
16
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
17
  #
16
18
  module Gruf
17
- VERSION = '2.6.0'.freeze
19
+ VERSION = '2.6.1'
18
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.6.0
4
+ version: 2.6.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: 2019-04-05 00:00:00.000000000 Z
11
+ date: 2019-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -193,7 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.0.2
196
+ rubyforge_project:
197
+ rubygems_version: 2.7.7
197
198
  signing_key:
198
199
  specification_version: 4
199
200
  summary: gRPC Ruby Framework