google-cloud-debugger 0.41.0 → 0.42.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ef52c562367610942ef8fc6630527548ed33f1a5f840a7c3a622ddc02965a78
4
- data.tar.gz: 3b20cefe0d2a0e4bdf1250b54bfc17dc679bdfaa4973713e6f810c4d518ca549
3
+ metadata.gz: 6641a7f5f24131e179ea351efa4aa2e43950f3baa38f86c63b1bf61c50d759fc
4
+ data.tar.gz: e383ad2653c833c28698717bc767b3cb00041214022881c2665e2e0833dbfa4c
5
5
  SHA512:
6
- metadata.gz: f3386fc63be2e43d2c750729632e85793e1a833f7c91a7d79c6b6730dfc64bcef10444b1241ecf3bd32a7040704afd96fd20d4b085adfee8b61ef48cc6ef5668
7
- data.tar.gz: 0776fd6bb821bbd45d7603e322cb15671fc084f04a7330d6fb7fbf014232cb3d112c1d1f717c9b3d89752bc7d67f102dcc9b7534cefd3dda798c17185c9b2352
6
+ metadata.gz: 8db05c08b17b71ac1bac193acaaa6a00b14b5e17dc2ebdbae52a9d4b1a6a942142d211bf55c0b5e4870f631e417b279ae84e70d950e533cfb8f21b337682cbd9
7
+ data.tar.gz: 0d255e9ed3e4539f98df8b1d9753951bd0f5a5002135afa5ac0177966ad9ade22fe73124146c8070efc2f026bdb66bfe9d1d70caf7ff363f4bd9e1b46b0a906b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 0.42.0 / 2021-03-31
4
+
5
+ #### Features
6
+
7
+ * Drop support for Ruby 2.4 and note that Ruby 3.0 is also unsupported
8
+
3
9
  ### 0.41.0 / 2020-09-16
4
10
 
5
11
  #### Features
data/CONTRIBUTING.md CHANGED
@@ -24,9 +24,9 @@ be able to accept your pull requests.
24
24
  In order to use the google-cloud-debugger console and run the project's tests,
25
25
  there is a small amount of setup:
26
26
 
27
- 1. Install Ruby. google-cloud-debugger requires Ruby 2.4+. You may choose to
28
- manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
- [rbenv](https://github.com/rbenv/rbenv), or
27
+ 1. Install Ruby. google-cloud-debugger requires Ruby 2.5+. It is not currently
28
+ supported on Ruby 3. You may choose to manage your Ruby and gem installations
29
+ with [RVM](https://rvm.io/), [rbenv](https://github.com/rbenv/rbenv), or
30
30
  [chruby](https://github.com/postmodern/chruby).
31
31
 
32
32
  2. Install [Bundler](http://bundler.io/).
@@ -45,7 +45,7 @@ there is a small amount of setup:
45
45
 
46
46
  ```sh
47
47
  $ cd google-cloud-debugger/
48
- $ bundle exec rake bundleupdate
48
+ $ bundle install
49
49
  ```
50
50
 
51
51
  ## Console
data/LOGGING.md CHANGED
@@ -3,7 +3,7 @@
3
3
  To enable logging for this library, set the logger for the underlying
4
4
  [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
5
5
  that you set may be a Ruby stdlib
6
- [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as
6
+ [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
7
7
  shown below, or a
8
8
  [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
9
9
  that will write logs to [Stackdriver
@@ -120,7 +120,10 @@ module Google
120
120
  # @param [String] app_root Absolute path to the root directory of
121
121
  # the debuggee application. Default to Rack root.
122
122
  #
123
- def initialize service, logger: nil, service_name:, service_version:,
123
+ def initialize service,
124
+ service_name:,
125
+ service_version:,
126
+ logger: nil,
124
127
  app_root: nil
125
128
  super()
126
129
 
@@ -265,7 +265,7 @@ module Google
265
265
  def valid?
266
266
  Validator.validate self unless complete?
267
267
 
268
- status && status.is_error ? false : true
268
+ status&.is_error ? false : true
269
269
  end
270
270
 
271
271
  ##
@@ -849,20 +849,18 @@ module Google
849
849
  # do evaluation in a new thread, where function calls can be
850
850
  # traced.
851
851
  thr = Thread.new do
852
- begin
853
- Thread.current.thread_variable_set EVALUATOR_REFERENCE, self
854
- binding.eval wrap_expression(expression)
855
- rescue StandardError, EvaluationError => e
856
- # Treat all StandardError as mutation and set @mutation_cause
857
- unless e.instance_variable_get :@mutation_cause
858
- e.instance_variable_set(
859
- :@mutation_cause,
860
- Google::Cloud::Debugger::EvaluationError::UNKNOWN_CAUSE
861
- )
862
- end
863
-
864
- e
852
+ Thread.current.thread_variable_set EVALUATOR_REFERENCE, self
853
+ binding.eval wrap_expression(expression)
854
+ rescue StandardError, EvaluationError => e
855
+ # Treat all StandardError as mutation and set @mutation_cause
856
+ unless e.instance_variable_get :@mutation_cause
857
+ e.instance_variable_set(
858
+ :@mutation_cause,
859
+ Google::Cloud::Debugger::EvaluationError::UNKNOWN_CAUSE
860
+ )
865
861
  end
862
+
863
+ e
866
864
  end
867
865
 
868
866
  thr.join @time_limit
@@ -942,7 +940,7 @@ module Google
942
940
  ##
943
941
  # @private Wraps expression with tracing code
944
942
  def wrap_expression expression
945
- """
943
+ <<~CODE
946
944
  begin
947
945
  ::Google::Cloud::Debugger::Breakpoint::Evaluator.send(
948
946
  :enable_method_trace_for_thread)
@@ -951,11 +949,9 @@ module Google
951
949
  ::Google::Cloud::Debugger::Breakpoint::Evaluator.send(
952
950
  :disable_method_trace_for_thread)
953
951
  end
954
- """
952
+ CODE
955
953
  end
956
954
 
957
- # rubocop:disable Layout/RescueEnsureAlignment
958
-
959
955
  ##
960
956
  # @private Evaluation tracing callback function. This is called
961
957
  # everytime a Ruby function is called during evaluation of
@@ -994,8 +990,6 @@ module Google
994
990
  )
995
991
  end
996
992
 
997
- # rubocop:enable Layout/RescueEnsureAlignment
998
-
999
993
  ##
1000
994
  # @private Evaluation tracing callback function. This is called
1001
995
  # everytime a C function is called during evaluation of
@@ -1011,12 +1005,12 @@ module Google
1011
1005
  #
1012
1006
  def trace_c_func_callback receiver, defined_class, mid
1013
1007
  return if @allow_mutating_methods
1014
- if receiver.is_a?(Class) || receiver.is_a?(Module)
1015
- invalid_op =
1008
+ invalid_op =
1009
+ if receiver.is_a?(Class) || receiver.is_a?(Module)
1016
1010
  !validate_c_class_method(defined_class, receiver, mid)
1017
- else
1018
- invalid_op = !validate_c_instance_method(defined_class, mid)
1019
- end
1011
+ else
1012
+ !validate_c_instance_method(defined_class, mid)
1013
+ end
1020
1014
 
1021
1015
  return unless invalid_op
1022
1016
 
@@ -37,7 +37,8 @@ module Google
37
37
 
38
38
  ##
39
39
  # @private Create an empty SourceLocation object.
40
- def initialize; end
40
+ def initialize
41
+ end
41
42
 
42
43
  ##
43
44
  # @private New Google::Cloud::Debugger::Breakpoint::SourceLocation
@@ -53,8 +54,7 @@ module Google
53
54
  ##
54
55
  # @private Determines if the SourceLocation has any data.
55
56
  def empty?
56
- path.nil? &&
57
- line.nil?
57
+ path.nil? && line.nil?
58
58
  end
59
59
 
60
60
  ##
@@ -244,7 +244,7 @@ module Google
244
244
 
245
245
  # If source is a non-empty Array or Hash, or source has instance
246
246
  # variables, evaluate source as a compound variable.
247
- if compound_var?(source) && depth > 0
247
+ if compound_var?(source) && depth.positive?
248
248
  from_compound_var source, name: name, depth: depth,
249
249
  var_table: var_table, limit: limit
250
250
  else
@@ -358,9 +358,7 @@ module Google
358
358
 
359
359
  limit = deduct_limit limit, member_var.total_size
360
360
 
361
- buffer_full = (limit && limit < 0) ||
362
- i >= MAX_MEMBERS ||
363
- member_var.buffer_full_variable?
361
+ buffer_full = limit&.negative? || i >= MAX_MEMBERS || member_var.buffer_full_variable?
364
362
 
365
363
  if buffer_full
366
364
  var.members << Variable.new.tap do |last_var|
@@ -384,8 +382,7 @@ module Google
384
382
  new.tap do |var|
385
383
  var.name = name if name
386
384
 
387
- if var_table && var_table.first &&
388
- var_table.first.buffer_full_variable?
385
+ if var_table&.first&.buffer_full_variable?
389
386
  var.var_table = var_table
390
387
  var.var_table_index = 0
391
388
  else
@@ -68,7 +68,7 @@ module Google
68
68
  # object_id, return the array index if found.
69
69
  def rb_var_index rb_var
70
70
  variables.each_with_index do |var, i|
71
- return i if var.source_var.object_id == rb_var.object_id
71
+ return i if var.source_var.equal? rb_var
72
72
  end
73
73
 
74
74
  nil
@@ -154,7 +154,7 @@ module Google
154
154
  @debugger.agent.tracer.disable_traces_for_thread
155
155
 
156
156
  # Reset quotas after each request finishes.
157
- @debugger.agent.quota_manager.reset if @debugger.agent.quota_manager
157
+ @debugger.agent.quota_manager&.reset
158
158
  end
159
159
 
160
160
  private
@@ -151,13 +151,13 @@ module Google
151
151
  Debugger::Credentials.new credentials
152
152
  end
153
153
  rescue StandardError => e
154
- STDOUT.puts "Note: Google::Cloud::Debugger is disabled because " \
154
+ $stdout.puts "Note: Google::Cloud::Debugger is disabled because " \
155
155
  "it failed to authorize with the service. (#{e.message})"
156
156
  return false
157
157
  end
158
158
 
159
159
  if project_id.to_s.empty?
160
- STDOUT.puts "Note: Google::Cloud::Debugger is disabled because " \
160
+ $stdout.puts "Note: Google::Cloud::Debugger is disabled because " \
161
161
  "the project ID could not be determined."
162
162
  return false
163
163
  end
@@ -25,7 +25,10 @@ module Google
25
25
  # @private Represents the gRPC Debugger service, including all the API
26
26
  # methods.
27
27
  class Service
28
- attr_accessor :project, :credentials, :timeout, :host
28
+ attr_accessor :project
29
+ attr_accessor :credentials
30
+ attr_accessor :timeout
31
+ attr_accessor :host
29
32
 
30
33
  ##
31
34
  # Creates a new Service instance.
@@ -33,11 +33,11 @@ module Google
33
33
 
34
34
  ##
35
35
  # Max size of payload a Snappoint collects
36
- MAX_PAYLOAD_SIZE = 32768 # 32KB
36
+ MAX_PAYLOAD_SIZE = 32_768 # 32KB
37
37
 
38
38
  ##
39
39
  # @private Max size an evaluated expression variable is allowed to be
40
- MAX_EXPRESSION_LIMIT = 32768 # 32KB
40
+ MAX_EXPRESSION_LIMIT = 32_768 # 32KB
41
41
 
42
42
  ##
43
43
  # @private Max size a normal evaluated variable is allowed to be
@@ -56,8 +56,7 @@ module Google
56
56
  # variable at index 0. This variable will be shared by other variable
57
57
  # evaluations if this Snappoint exceeds size limit.
58
58
  def init_var_table
59
- return if @variable_table[0] &&
60
- @variable_table[0].buffer_full_variable?
59
+ return if @variable_table[0]&.buffer_full_variable?
61
60
 
62
61
  buffer_full_var = Variable.buffer_full_variable
63
62
  @variable_table.variables.unshift buffer_full_var
@@ -179,11 +178,9 @@ module Google
179
178
  end
180
179
  end
181
180
 
182
- result = variable_table.variables.inject result do |sum, var|
181
+ variable_table.variables.inject result do |sum, var|
183
182
  sum + var.payload_size
184
183
  end
185
-
186
- result
187
184
  end
188
185
 
189
186
  ##
@@ -132,7 +132,7 @@ module Google
132
132
  # @return [boolean] `true` when started, `false` otherwise.
133
133
  #
134
134
  def started?
135
- @thread_pool.running? if @thread_pool
135
+ @thread_pool&.running?
136
136
  end
137
137
 
138
138
  ##
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Debugger
19
- VERSION = "0.41.0".freeze
19
+ VERSION = "0.42.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heng Xiong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-16 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: binding_of_caller
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.24.0
103
+ version: 1.25.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.24.0
110
+ version: 1.25.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: minitest
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -337,16 +337,16 @@ require_paths:
337
337
  - lib
338
338
  required_ruby_version: !ruby/object:Gem::Requirement
339
339
  requirements:
340
- - - ">="
340
+ - - "~>"
341
341
  - !ruby/object:Gem::Version
342
- version: '2.4'
342
+ version: '2.5'
343
343
  required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  requirements:
345
345
  - - ">="
346
346
  - !ruby/object:Gem::Version
347
347
  version: '0'
348
348
  requirements: []
349
- rubygems_version: 3.1.4
349
+ rubygems_version: 3.2.13
350
350
  signing_key:
351
351
  specification_version: 4
352
352
  summary: API Client and instrumentation library for Stackdriver Debugger