appmap 0.54.0 → 0.54.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -1
- data/CHANGELOG.md +8 -0
- data/Rakefile +13 -4
- data/appmap.gemspec +1 -0
- data/lib/appmap/handler/net_http.rb +1 -1
- data/lib/appmap/handler/rails/template.rb +2 -1
- data/lib/appmap/hook.rb +0 -1
- data/lib/appmap/hook/method.rb +36 -28
- data/lib/appmap/trace.rb +2 -0
- data/lib/appmap/util.rb +17 -1
- data/lib/appmap/version.rb +1 -1
- data/spec/fixtures/hook/kwargs.rb +11 -0
- data/spec/hook_spec.rb +9 -0
- data/spec/record_net_http_spec.rb +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b56559bdbc9f98b310e94efce7e6eaa45bedbf4e7fffaa2c8a09167b5985d64
|
4
|
+
data.tar.gz: 72762bf8b3e9352d13841ce33bf61c4ebc77fc5db445c76333f8c910b0e37e0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79a3f92811ad61cd4e7f52c3d72b4e2277772a0e25789cccc50b63f069c43f78d2492ed37d43b073a98b0debcfc60d5d21af776d1bd6d445783c18f7ffefde81
|
7
|
+
data.tar.gz: 73a14b0bde0abba5463fd2068bd88290a1f97a673174b5732a892a867ae77af7a13e8e0374a2a07655c76b49c647005d4624501568f40f932bac868ec019e1e6
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [0.54.1](https://github.com/applandinc/appmap-ruby/compare/v0.54.0...v0.54.1) (2021-06-25)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Add missing imports and remove deprecation warnings ([f1cb087](https://github.com/applandinc/appmap-ruby/commit/f1cb087f80cad88093227ebf8b4a4cd574853667))
|
7
|
+
* Workaround Ruby bug in 2.7.3 with kwrest ([26e34ca](https://github.com/applandinc/appmap-ruby/commit/26e34ca421fdae6602b27fee5653c8fe26b3793b))
|
8
|
+
|
1
9
|
# [0.54.0](https://github.com/applandinc/appmap-ruby/compare/v0.53.0...v0.54.0) (2021-06-24)
|
2
10
|
|
3
11
|
|
data/Rakefile
CHANGED
@@ -6,8 +6,7 @@ require 'rake/testtask'
|
|
6
6
|
require 'rdoc/task'
|
7
7
|
|
8
8
|
require 'open3'
|
9
|
-
|
10
|
-
require "rake/extensiontask"
|
9
|
+
require 'rake/extensiontask'
|
11
10
|
|
12
11
|
desc 'build the native extension'
|
13
12
|
Rake::ExtensionTask.new("appmap") do |ext|
|
@@ -26,7 +25,7 @@ namespace 'gem' do
|
|
26
25
|
# ~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/gem_helper.rb:39:in `install'
|
27
26
|
def build_gem
|
28
27
|
# Ensure that NPM packages are installed before building.
|
29
|
-
sh('yarn install --prod'
|
28
|
+
sh('yarn install --prod')
|
30
29
|
|
31
30
|
default_build_gem
|
32
31
|
end
|
@@ -34,7 +33,17 @@ namespace 'gem' do
|
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
|
-
RUBY_VERSIONS=%w[2.5 2.6 2.7]
|
36
|
+
RUBY_VERSIONS=%w[2.5 2.6 2.7].select do |version|
|
37
|
+
travis_ruby_version = ENV['TRAVIS_RUBY_VERSION']
|
38
|
+
next true unless travis_ruby_version
|
39
|
+
|
40
|
+
if travis_ruby_version.index(version) == 0
|
41
|
+
warn "Testing Ruby version #{version}, since it matches TRAVIS_RUBY_VERSION=#{travis_ruby_version}"
|
42
|
+
next true
|
43
|
+
end
|
44
|
+
|
45
|
+
false
|
46
|
+
end
|
38
47
|
FIXTURE_APPS=%w[rack_users_app rails6_users_app rails5_users_app]
|
39
48
|
|
40
49
|
def run_cmd(*cmd)
|
data/appmap.gemspec
CHANGED
data/lib/appmap/hook.rb
CHANGED
data/lib/appmap/hook/method.rb
CHANGED
@@ -18,6 +18,8 @@ module AppMap
|
|
18
18
|
TIME_NOW = Time.method(:now)
|
19
19
|
private_constant :TIME_NOW
|
20
20
|
|
21
|
+
ARRAY_OF_EMPTY_HASH = [{}.freeze].freeze
|
22
|
+
|
21
23
|
def initialize(hook_package, hook_class, hook_method)
|
22
24
|
@hook_package = hook_package
|
23
25
|
@hook_class = hook_class
|
@@ -45,42 +47,48 @@ module AppMap
|
|
45
47
|
after_hook = self.method(:after_hook)
|
46
48
|
with_disabled_hook = self.method(:with_disabled_hook)
|
47
49
|
|
48
|
-
hook_method_def =
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
hook_method_def = Proc.new do |*args, &block|
|
51
|
+
instance_method = hook_method.bind(self).to_proc
|
52
|
+
call_instance_method = -> {
|
53
|
+
# https://github.com/applandinc/appmap-ruby/issues/153
|
54
|
+
if Util.ruby_minor_version >= 2.7 && args == ARRAY_OF_EMPTY_HASH && hook_method.arity == 1
|
55
|
+
instance_method.call({}, &block)
|
56
|
+
else
|
57
|
+
instance_method.call(*args, &block)
|
58
|
+
end
|
59
|
+
}
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
61
|
+
# We may not have gotten the class for the method during
|
62
|
+
# initialization (e.g. for a singleton method on an embedded
|
63
|
+
# struct), so make sure we have it now.
|
64
|
+
defined_class, = Hook.qualify_method_name(hook_method) unless defined_class
|
58
65
|
|
59
|
-
|
60
|
-
|
61
|
-
|
66
|
+
reentrant = Thread.current[HOOK_DISABLE_KEY]
|
67
|
+
disabled_by_shallow_flag = \
|
68
|
+
-> { hook_package&.shallow? && AppMap.tracing.last_package_for_current_thread == hook_package }
|
62
69
|
|
63
|
-
|
70
|
+
enabled = true if AppMap.tracing.enabled? && !reentrant && !disabled_by_shallow_flag.call
|
64
71
|
|
65
|
-
|
72
|
+
return call_instance_method.call unless enabled
|
66
73
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
74
|
+
call_event, start_time = with_disabled_hook.call do
|
75
|
+
before_hook.call(self, defined_class, args)
|
76
|
+
end
|
77
|
+
return_value = nil
|
78
|
+
exception = nil
|
79
|
+
begin
|
80
|
+
return_value = call_instance_method.call
|
81
|
+
rescue
|
82
|
+
exception = $ERROR_INFO
|
83
|
+
raise
|
84
|
+
ensure
|
85
|
+
with_disabled_hook.call do
|
86
|
+
after_hook.call(self, call_event, start_time, return_value, exception) if call_event
|
81
87
|
end
|
82
88
|
end
|
83
89
|
end
|
90
|
+
hook_method_def = hook_method_def.ruby2_keywords if hook_method_def.respond_to?(:ruby2_keywords)
|
91
|
+
|
84
92
|
hook_class.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
|
85
93
|
end
|
86
94
|
|
data/lib/appmap/trace.rb
CHANGED
data/lib/appmap/util.rb
CHANGED
@@ -124,7 +124,7 @@ module AppMap
|
|
124
124
|
path = path.split('(.')[0]
|
125
125
|
tokens = path.split('/')
|
126
126
|
tokens.map do |token|
|
127
|
-
token.gsub
|
127
|
+
token.gsub(/^:(.*)/, '{\1}')
|
128
128
|
end.join('/')
|
129
129
|
end
|
130
130
|
|
@@ -154,6 +154,18 @@ module AppMap
|
|
154
154
|
word.split(/[\-_]/).map(&:capitalize).join
|
155
155
|
end
|
156
156
|
|
157
|
+
# https://api.rubyonrails.org/v6.1.3.2/classes/ActiveSupport/Inflector.html#method-i-underscore
|
158
|
+
def underscore(camel_cased_word)
|
159
|
+
return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)
|
160
|
+
word = camel_cased_word.to_s.gsub("::", "/")
|
161
|
+
# word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" }
|
162
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
163
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
164
|
+
word.tr!("-", "_")
|
165
|
+
word.downcase!
|
166
|
+
word
|
167
|
+
end
|
168
|
+
|
157
169
|
def deep_dup(hash)
|
158
170
|
# This is a simple way to avoid the need for deep_dup from activesupport.
|
159
171
|
Marshal.load(Marshal.dump(hash))
|
@@ -178,6 +190,10 @@ module AppMap
|
|
178
190
|
warn msg
|
179
191
|
end
|
180
192
|
end
|
193
|
+
|
194
|
+
def ruby_minor_version
|
195
|
+
@ruby_minor_version ||= RUBY_VERSION.split('.')[0..1].join('.').to_f
|
196
|
+
end
|
181
197
|
end
|
182
198
|
end
|
183
199
|
end
|
data/lib/appmap/version.rb
CHANGED
data/spec/hook_spec.rb
CHANGED
@@ -985,4 +985,13 @@ describe 'AppMap class Hooking', docker: false do
|
|
985
985
|
expect(InstanceMethod.new.method(:say_echo).arity).to be(1)
|
986
986
|
end
|
987
987
|
end
|
988
|
+
|
989
|
+
describe 'kwargs handling' do
|
990
|
+
# https://github.com/applandinc/appmap-ruby/issues/153
|
991
|
+
it 'empty hash for **kwrest can be proxied as a regular function argument', github_issue: 153 do
|
992
|
+
invoke_test_file 'spec/fixtures/hook/kwargs.rb' do
|
993
|
+
expect(Kwargs.has_kwrest_calls_no_kwargs(nil, {})).to eq({})
|
994
|
+
end
|
995
|
+
end
|
996
|
+
end
|
988
997
|
end
|
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.54.
|
4
|
+
version: 0.54.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -276,6 +276,20 @@ dependencies:
|
|
276
276
|
- - ">="
|
277
277
|
- !ruby/object:Gem::Version
|
278
278
|
version: '0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: webrick
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
279
293
|
description:
|
280
294
|
email:
|
281
295
|
- kgilpin@gmail.com
|
@@ -364,6 +378,7 @@ files:
|
|
364
378
|
- spec/fixtures/hook/exception_method.rb
|
365
379
|
- spec/fixtures/hook/exclude.rb
|
366
380
|
- spec/fixtures/hook/instance_method.rb
|
381
|
+
- spec/fixtures/hook/kwargs.rb
|
367
382
|
- spec/fixtures/hook/labels.rb
|
368
383
|
- spec/fixtures/hook/method_named_call.rb
|
369
384
|
- spec/fixtures/hook/revoke_api_key.appmap.json
|