appmap 0.83.2 → 0.83.3

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: f4cabea9f63794eb3d3efea45ec01fb05aa1437cccb419d87695b6b1877cd0b8
4
- data.tar.gz: e7ea1f1b85a0ad31de59838c3e8a6c69ba4cff6e61dbbca3cad9478b4fc3ee9b
3
+ metadata.gz: bea854bed738de049b48a7159db72bf00050b12e59e83f24f4353ae86eec352e
4
+ data.tar.gz: 1560fcc80b2583b4d710e1ddfbc446d47d4b70b69b1a29db735afbfea90ecf19
5
5
  SHA512:
6
- metadata.gz: 3d1b69fb940df595bcb7dba1adb9ea813073b2d6a00ffdf7be2be9eafe2e8567a0fe5e2f8d305130c5e483dec9b5812faa3800fe5bdebc39c20f532fd7ed0d3b
7
- data.tar.gz: 4830ed50c519739c855d32eda77db1e6bf873f6cfc67d7a85b6abfcf0a321bd1dcef7f19af5578a58e352af752ad5bd3523ce5779ddc40a19aadb5cbe76b93c3
6
+ metadata.gz: c8ac080bd189b48409710623abb20363775bdd24f01be061b8f61ab199b88b04bdea674d6bd51a85b06d8dca6086ea2172e04b48d3a199971e67287229fb4c81
7
+ data.tar.gz: 8fc2ca5673a67d4f213744aec18eb26cf2951a7992a750659024370127b70072ae891721262a575cbaf3cffae75aa4d052061265c0687d04b4455b012887bc6e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.83.3](https://github.com/applandinc/appmap-ruby/compare/v0.83.2...v0.83.3) (2022-06-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Eval handler now works correctly even when not tracing ([4c9c40a](https://github.com/applandinc/appmap-ruby/commit/4c9c40abd8c930837ce6e040c72893f284ce0899))
7
+
1
8
  ## [0.83.2](https://github.com/applandinc/appmap-ruby/compare/v0.83.1...v0.83.2) (2022-05-11)
2
9
 
3
10
 
@@ -8,9 +8,9 @@ module AppMap
8
8
  # cf. https://eregon.me/blog/2019/11/10/the-delegation-challenge-of-ruby27.html
9
9
  class Method
10
10
  ruby2_keywords def call(receiver, *args, &block)
11
- return do_call(receiver, *args, &block) unless trace?
12
-
13
- call_event = with_disabled_hook { before_hook receiver, *args }
11
+ call_event = trace? && with_disabled_hook { before_hook receiver, *args }
12
+ # note we can't short-circuit directly to do_call because then the call stack
13
+ # depth changes and eval handler doesn't work correctly
14
14
  trace_call call_event, receiver, *args, &block
15
15
  end
16
16
 
@@ -32,7 +32,10 @@ module AppMap
32
32
  hook_method.bind(receiver).call(*args, &block)
33
33
  end
34
34
 
35
+ # rubocop:disable Metrics/MethodLength
35
36
  ruby2_keywords def trace_call(call_event, receiver, *args, &block)
37
+ return do_call(receiver, *args, &block) unless call_event
38
+
36
39
  start_time = gettime
37
40
  begin
38
41
  return_value = do_call(receiver, *args, &block)
@@ -44,6 +47,7 @@ module AppMap
44
47
  if call_event
45
48
  end
46
49
  end
50
+ # rubocop:enable Metrics/MethodLength
47
51
 
48
52
  def hook_method_def
49
53
  this = self
@@ -5,9 +5,9 @@ module AppMap
5
5
  # Delegation methods for Ruby 3.
6
6
  class Method
7
7
  def call(receiver, *args, **kwargs, &block)
8
- return do_call(receiver, *args, **kwargs, &block) unless trace?
9
-
10
- call_event = with_disabled_hook { before_hook receiver, *args, **kwargs }
8
+ call_event = trace? && with_disabled_hook { before_hook receiver, *args, **kwargs }
9
+ # note we can't short-circuit directly to do_call because then the call stack
10
+ # depth changes and eval handler doesn't work correctly
11
11
  trace_call call_event, receiver, *args, **kwargs, &block
12
12
  end
13
13
 
@@ -34,7 +34,10 @@ module AppMap
34
34
  hook_method.bind_call(receiver, *args, **kwargs, &block)
35
35
  end
36
36
 
37
+ # rubocop:disable Metrics/MethodLength
37
38
  def trace_call(call_event, receiver, *args, **kwargs, &block)
39
+ return do_call(receiver, *args, **kwargs, &block) unless call_event
40
+
38
41
  start_time = gettime
39
42
  begin
40
43
  return_value = do_call(receiver, *args, **kwargs, &block)
@@ -46,6 +49,7 @@ module AppMap
46
49
  if call_event
47
50
  end
48
51
  end
52
+ # rubocop:enable Metrics/MethodLength
49
53
 
50
54
  def hook_method_def
51
55
  this = self
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.83.2'
6
+ VERSION = '0.83.3'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.7.0'
9
9
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Style/EvalWithLocation
4
+
5
+ module AppMap
6
+ class SpecClasses
7
+ class WithEval
8
+ eval %(def text; 'text'; end)
9
+ end
10
+ end
11
+ end
12
+
13
+ # rubocop:enable Style/EvalWithLocation
@@ -57,6 +57,11 @@ describe 'AppMap::Handler::Eval' do
57
57
  end
58
58
  expect(new_cls.const_get(class_name)).to eq(cls)
59
59
  end
60
+
61
+ it 'works correctly when loaded even when not tracing' do
62
+ load "#{__dir__}/class_with_eval.rb"
63
+ expect { AppMap::SpecClasses::WithEval.new.text }.to_not raise_error(NameError)
64
+ end
60
65
  end
61
66
 
62
67
  module ClassMaker
@@ -64,3 +69,5 @@ module ClassMaker
64
69
  eval "class #{class_name}; end; #{class_name}"
65
70
  end
66
71
  end
72
+
73
+ # rubocop:enable Security/Eval, Style/EvalWithLocation
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.83.2
4
+ version: 0.83.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-11 00:00:00.000000000 Z
11
+ date: 2022-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -707,6 +707,7 @@ files:
707
707
  - spec/fixtures/rails7_users_app/test/models/instructor_test.rb
708
708
  - spec/fixtures/rails7_users_app/test/system/.keep
709
709
  - spec/fixtures/rails7_users_app/test/test_helper.rb
710
+ - spec/handler/class_with_eval.rb
710
711
  - spec/handler/eval_spec.rb
711
712
  - spec/hook_spec.rb
712
713
  - spec/open_spec.rb