appmap 0.99.0 → 0.99.2

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: 463cf482f8d6b1a33721886b5d049ae0ce11c469759562a4ea0b8c6c149abb23
4
- data.tar.gz: 727ecbc15e19e486f69ed668d9e077a3045c10b24c0892b66801346d11a02a4d
3
+ metadata.gz: c0d8aa81209b5f8d33fc480c3ff3b7f6cd61027dc51fad74c9ad4f19ba6c7faf
4
+ data.tar.gz: 5d8ac162d8cf5eacfc045ff81a16c2b473df79ae0619ddaface5b4bab8d422cb
5
5
  SHA512:
6
- metadata.gz: cec680149e2742d4ed403a73d7283c454e0e561a95207ab426b9996c4056fa93626d0544de0923f575252038869a7e7e6b6f351eaaab4f1b7576ef20467bb527
7
- data.tar.gz: 573b7ba81cae478ea658c27937563410bd83143bb0c13b9aeea3402422460ac55debff2adeffc83cb77c4be1372f6e49f1c640d8ff193c18199597a0bff25f58
6
+ metadata.gz: 34c7b6b0fd6e45c33158776e3c3f1a8725031913ad49856f24aa5af50cbc41efd2e047face5c3c1f02a9c20670af08be43492e5bd665a17323578c735b07900b
7
+ data.tar.gz: 0ea3f5be3436ea8eec1d8e14cd959b67e6e4547d03de6401c6e21250b3ba91b521b57f665298e1e4ec3be9616a1fbcf0a2f11b8ff09a5c53cd0d60c2d4a358f6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [0.99.2](https://github.com/getappmap/appmap-ruby/compare/v0.99.1...v0.99.2) (2023-05-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Ensure that signature hash key consists of strings ([acb5db9](https://github.com/getappmap/appmap-ruby/commit/acb5db9ecb0a6cdf40de83bf506f45f5283f641b))
7
+
8
+ ## [0.99.1](https://github.com/getappmap/appmap-ruby/compare/v0.99.0...v0.99.1) (2023-04-24)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * backtrace_locations may be nil ([7f3890a](https://github.com/getappmap/appmap-ruby/commit/7f3890a00d5f4425fac273c72e5576cf7752eeaf)), closes [#324](https://github.com/getappmap/appmap-ruby/issues/324)
14
+
1
15
  # [0.99.0](https://github.com/getappmap/appmap-ruby/compare/v0.98.1...v0.99.0) (2023-04-13)
2
16
 
3
17
 
data/lib/appmap/config.rb CHANGED
@@ -499,6 +499,11 @@ module AppMap
499
499
  end
500
500
 
501
501
  def never_hook?(cls, method)
502
+ unless method
503
+ HookLog.log "method is nil" if HookLog.enabled?
504
+ return true
505
+ end
506
+
502
507
  _, separator, = ::AppMap::Hook.qualify_method_name(method)
503
508
  if exclude.member?(cls.name) || exclude.member?([ cls.name, separator, method.name ].join)
504
509
  HookLog.log "Hooking of #{method} disabled by configuration" if HookLog.enabled?
@@ -4,11 +4,23 @@ require 'appmap/util'
4
4
 
5
5
  module AppMap
6
6
  class Hook
7
+ class << self
8
+ def method_hash_key(cls, method)
9
+ [ cls, method.name ].hash
10
+ rescue TypeError => e
11
+ warn "Error building hash key for #{cls}, #{method}: #{e}"
12
+ end
13
+ end
14
+
15
+
7
16
  SIGNATURES = {}
8
17
  LOOKUP_SIGNATURE = lambda do |id|
9
18
  method = super(id)
10
19
 
11
- signature = SIGNATURES[[ method.owner, method.name ]]
20
+ hash_key = Hook.method_hash_key(method.owner, method)
21
+ return method unless hash_key
22
+
23
+ signature = SIGNATURES[hash_key]
12
24
  if signature
13
25
  method.singleton_class.module_eval do
14
26
  define_method(:parameters) do
@@ -48,7 +60,8 @@ module AppMap
48
60
  end
49
61
 
50
62
  hook_method_parameters = hook_method.parameters.dup.freeze
51
- SIGNATURES[[ hook_class, hook_method.name ]] = hook_method_parameters
63
+ hash_key = Hook.method_hash_key(hook_class, hook_method)
64
+ SIGNATURES[hash_key] = hook_method_parameters if hash_key
52
65
 
53
66
  # irb(main):001:0> Kernel.public_instance_method(:system)
54
67
  # (irb):1:in `public_instance_method': method `system' for module `Kernel' is private (NameError)
@@ -38,14 +38,7 @@ module AppMap
38
38
  if failed
39
39
  failure_exception = failures.first || exception
40
40
  warn "Failure exception: #{failure_exception}" if AppMap::Minitest::LOG
41
-
42
- first_location = failure_exception.backtrace_locations.find { |location| !Pathname.new(Util.normalize_path(location.absolute_path)).absolute? }
43
- failure_location = [ Util.normalize_path(first_location.path), first_location.lineno ].join(':') if first_location
44
-
45
- test_failure = {
46
- message: failure_exception.message,
47
- location: failure_location,
48
- }
41
+ test_failure = Util.extract_test_failure(failure_exception)
49
42
  end
50
43
 
51
44
  events = []
data/lib/appmap/rspec.rb CHANGED
@@ -104,14 +104,7 @@ module AppMap
104
104
  if failed
105
105
  failure_exception = failure || exception
106
106
  warn "Failure exception: #{failure_exception}" if AppMap::RSpec::LOG
107
-
108
- first_location = failure_exception.backtrace_locations.find { |location| !Pathname.new(Util.normalize_path(location.absolute_path)).absolute? }
109
- failure_location = [ Util.normalize_path(first_location.path), first_location.lineno ].join(':') if first_location
110
-
111
- test_failure = {
112
- message: failure_exception.message.strip,
113
- location: failure_location,
114
- }
107
+ test_failure = Util.extract_test_failure(failure_exception)
115
108
  end
116
109
 
117
110
  events = []
data/lib/appmap/util.rb CHANGED
@@ -157,6 +157,15 @@ module AppMap
157
157
  }
158
158
  end
159
159
 
160
+ def extract_test_failure(exception)
161
+ return unless exception
162
+
163
+ { message: exception.message }.tap do |test_failure|
164
+ first_location = exception.backtrace_locations&.find { |location| !Pathname.new(normalize_path(location.absolute_path)).absolute? }
165
+ test_failure[:location] = [ normalize_path(first_location.path), first_location.lineno ].join(':') if first_location
166
+ end
167
+ end
168
+
160
169
  # Convert a Rails-style path from /org/:org_id(.:format)
161
170
  # to Swagger-style paths like /org/{org_id}
162
171
  def swaggerize_path(path)
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.99.0'
6
+ VERSION = '0.99.2'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.12.0'
9
9
 
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.99.0
4
+ version: 0.99.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-13 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source