appmap 0.80.0 → 0.81.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: eb003b96b494282db035877377124bc3736d78320a64e479b7caa0b8df49063a
4
- data.tar.gz: 3aab36a97c90485e1c7f77bed373c4c572b46a5c8c93ac4aa012db3becf201f4
3
+ metadata.gz: 86f2c44b83fd3ecc97b23cbffb41f1c735eb41b9ed6e134518ecfc3093e5585a
4
+ data.tar.gz: 3e5d84855cbcfdc93d3dee64719f63650f7f46932e60e81b93f24050c43b9965
5
5
  SHA512:
6
- metadata.gz: 8637610caacf145c5badb4de3eb399858a231d3de9a794f86e8fcb3d14801d3b5309453da7e9b799d47ddb9c4eed55bbd97bf2f77eabe7e605e95089b560c5bf
7
- data.tar.gz: bba8d4f2f8ffa5b0e5d8b113657324561dfa71e7b7128273631d62d426c8e12339e305d9fb0fe0d05244685a1ddc1b4be4bfbe5a4b44607a2df96e5d60749557
6
+ metadata.gz: 63aa95863c061a8c8185efb02cb10a410b0399a9bde445be8911bed7a0d4a7b10c36c9143d3f77647004610bedc072dca1b14f953c82bfd86ee863883a5dbae6
7
+ data.tar.gz: 1ca89bb45ed6bb7c6f917d297d2b15d341a9349e1694b38be94251bad090170b84a5c5390fcc9760bdd160fa6c9f660942cf7203d8064dc90f83e10a0dcfa3f9
data/.travis.yml CHANGED
@@ -4,9 +4,8 @@ cache:
4
4
  - bundle
5
5
  - yarn
6
6
 
7
- # NB: if you update the ruby versions here, you also need to update
8
- # them in the Rakefile.
9
7
  rbenv:
8
+ - 2.5
10
9
  - 2.6
11
10
  - 2.7
12
11
  - 3.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # [0.81.0](https://github.com/applandinc/appmap-ruby/compare/v0.80.2...v0.81.0) (2022-04-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add Ruby 2.5 to the version whitelist ([945f7da](https://github.com/applandinc/appmap-ruby/commit/945f7daaee9685a55f14e8714677661fa5cb4e82))
7
+
8
+ ## [0.80.2](https://github.com/applandinc/appmap-ruby/compare/v0.80.1...v0.80.2) (2022-04-26)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Ensure that request env key is a string ([721baef](https://github.com/applandinc/appmap-ruby/commit/721baefbb3ba083bf6c5a1b46e6ddffa51feebec))
14
+ * Fix method_display_name ([b05c7fe](https://github.com/applandinc/appmap-ruby/commit/b05c7fe027a981214b224852dc54c5e467e1f116))
15
+
16
+ ## [0.80.1](https://github.com/applandinc/appmap-ruby/compare/v0.80.0...v0.80.1) (2022-04-08)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * Don't call #size on complex objects ([3f19d1e](https://github.com/applandinc/appmap-ruby/commit/3f19d1e67288379570dfa14d8758a0624d2c6c34))
22
+
1
23
  # [0.80.0](https://github.com/applandinc/appmap-ruby/compare/v0.79.0...v0.80.0) (2022-04-08)
2
24
 
3
25
 
@@ -78,7 +78,7 @@ module AppMap
78
78
  end
79
79
 
80
80
  collapse_package = lambda do |package|
81
- return unless package.type == 'package'
81
+ next unless package.type == 'package'
82
82
 
83
83
  while package.children.length == 1 && package.children.all? { |child| child.type == 'package' }
84
84
  child = package.children[0]
data/lib/appmap/event.rb CHANGED
@@ -60,6 +60,13 @@ module AppMap
60
60
  final ? value_string : encode_display_string(value_string)
61
61
  end
62
62
 
63
+ def add_size(param, value)
64
+ # Don't risk calling #size on things like data-access objects, which can and will issue queries for this information.
65
+ if value.is_a?(Array) || value.is_a?(Hash)
66
+ param[:size] = value.size
67
+ end
68
+ end
69
+
63
70
  def add_schema(param, value)
64
71
  begin
65
72
  if value.respond_to?(:keys)
@@ -224,7 +231,7 @@ module AppMap
224
231
  value: display_string(value),
225
232
  kind: param_type
226
233
  }.tap do |param|
227
- param[:size] = value.size if value.respond_to?(:size) && value.is_a?(Enumerable)
234
+ add_size param, value
228
235
  end
229
236
  end
230
237
  event.receiver = {
@@ -289,7 +296,7 @@ module AppMap
289
296
  value: display_string(return_value),
290
297
  object_id: return_value.__id__
291
298
  }.tap do |param|
292
- param[:size] = return_value.size if return_value.respond_to?(:size) && return_value.is_a?(Enumerable)
299
+ add_size param, return_value
293
300
  add_schema param, return_value if parameter_schema && !exception
294
301
  end
295
302
  end
@@ -147,7 +147,7 @@ module AppMap
147
147
  else
148
148
  path_obj.inspect
149
149
  end
150
- path = path[Dir.pwd.length + 1..] if path.index(Dir.pwd) == 0
150
+ path = path[Dir.pwd.length + 1..-1] if path.index(Dir.pwd) == 0
151
151
  path
152
152
  end
153
153
  end
@@ -18,6 +18,8 @@ module AppMap
18
18
  method
19
19
  end
20
20
 
21
+ RUBY_MAJOR_VERSION, RUBY_MINOR_VERSION, _ = RUBY_VERSION.split('.').map(&:to_i)
22
+
21
23
  # Single hooked method.
22
24
  # Call #activate to override the original.
23
25
  class Method
@@ -51,18 +53,31 @@ module AppMap
51
53
  if hook_class == Kernel
52
54
  hook_class.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
53
55
  else
54
- hook_class.ancestors.find { |cls| cls.method_defined?(hook_method.name, false) }.tap do |cls|
55
- if cls
56
- cls.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
57
- else
58
- warn "#{hook_method.name} not found on #{hook_class}"
59
- end
56
+ cls = defining_class(hook_class)
57
+ if cls
58
+ cls.define_method_with_arity(hook_method.name, hook_method.arity, hook_method_def)
60
59
  end
61
60
  end
62
61
  end
63
62
 
64
63
  protected
65
64
 
65
+ def defining_class(hook_class)
66
+ cls = \
67
+ if RUBY_MAJOR_VERSION == 2 && RUBY_MINOR_VERSION <= 5
68
+ hook_class
69
+ .ancestors
70
+ .select { |cls| cls.method_defined?(hook_method.name) }
71
+ .find { |cls| cls.instance_method(hook_method.name).owner == cls }
72
+ else
73
+ hook_class.ancestors.find { |cls| cls.method_defined?(hook_method.name, false) }
74
+ end
75
+
76
+ return cls if cls
77
+
78
+ warn "#{hook_method.name} not found on #{hook_class}"
79
+ end
80
+
66
81
  def gettime
67
82
  Process.clock_gettime Process::CLOCK_MONOTONIC
68
83
  end
@@ -78,7 +93,7 @@ module AppMap
78
93
  def method_display_name
79
94
  return @method_display_name if @method_display_name
80
95
 
81
- return @method_display_name = [defined_class, method_symbol, hook_method.name].join if defined_class
96
+ return @method_display_name = [defined_class, '#', hook_method.name].join if defined_class
82
97
 
83
98
  "#{hook_method.name} (class resolution deferred)"
84
99
  end
data/lib/appmap/rspec.rb CHANGED
@@ -78,7 +78,7 @@ module AppMap
78
78
  super
79
79
 
80
80
  webdriver_port = lambda do
81
- return unless defined?(page) && page&.driver
81
+ next unless defined?(page) && page&.driver
82
82
 
83
83
  # This is the ugliest thing ever but I don't want to lose it.
84
84
  # All the WebDriver calls are getting app-mapped and it's really unclear
@@ -15,8 +15,8 @@ module AppMap
15
15
 
16
16
  def perform
17
17
  to_markdown = lambda do |obj|
18
- return obj.each(&to_markdown) if obj.is_a?(Array)
19
- return unless obj.is_a?(Hash)
18
+ next obj.each(&to_markdown) if obj.is_a?(Array)
19
+ next unless obj.is_a?(Hash)
20
20
 
21
21
  description = obj['description']
22
22
  obj['description'] = converter.(description) if description
@@ -10,8 +10,8 @@ module AppMap
10
10
  def perform
11
11
  clean_only = nil
12
12
  clean = lambda do |obj, properties = %w[description example]|
13
- return obj.each(&clean_only.(properties)) if obj.is_a?(Array)
14
- return unless obj.is_a?(Hash)
13
+ next obj.each(&clean_only.(properties)) if obj.is_a?(Array)
14
+ next unless obj.is_a?(Hash)
15
15
 
16
16
  properties.each { |property| obj.delete property }
17
17
 
data/lib/appmap/util.rb CHANGED
@@ -122,7 +122,7 @@ module AppMap
122
122
  # Apparently, it's following the CGI spec in doing so.
123
123
  # https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.18
124
124
  matching_headers = env
125
- .select { |k,v| k.start_with? 'HTTP_' }
125
+ .select { |k,v| k.to_s.start_with? 'HTTP_' }
126
126
  .merge(
127
127
  'CONTENT_TYPE' => env['CONTENT_TYPE'],
128
128
  'CONTENT_LENGTH' => env['CONTENT_LENGTH'],
@@ -3,11 +3,11 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.80.0'
6
+ VERSION = '0.81.0'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
 
10
- SUPPORTED_RUBY_VERSIONS = %w[2.6 2.7 3.0 3.1].freeze
10
+ SUPPORTED_RUBY_VERSIONS = %w[2.5 2.6 2.7 3.0 3.1].freeze
11
11
 
12
12
  DEFAULT_APPMAP_DIR = 'tmp/appmap'.freeze
13
13
  DEFAULT_CONFIG_FILE_PATH = 'appmap.yml'.freeze
@@ -38,7 +38,7 @@ describe 'AppMap::Handler::Eval' do
38
38
  # a la Ruby 2.6.3 ruby-token.rb
39
39
  # token_c = eval("class #{token_n} < #{super_token}; end; #{token_n}")
40
40
  it 'can define a new class' do
41
- num = (Random.random_number * 10_000).to_i
41
+ num = (Random.new.random_number * 10_000).to_i
42
42
  class_name = "Cls_#{num}"
43
43
  m = ClassMaker
44
44
  cls = nil
@@ -18,7 +18,7 @@ class TestRailsApp
18
18
  attr_reader :fixture_dir
19
19
 
20
20
  def run_cmd(cmd, env = {})
21
- run_process method(:system), cmd, env, exception: true
21
+ run_process method(:system), cmd, env
22
22
  end
23
23
 
24
24
  def spawn_cmd(cmd, env = {})
@@ -33,7 +33,7 @@ class TestRailsApp
33
33
 
34
34
  def database_name
35
35
  # This is used locally too, so make the name nice and unique.
36
- @database_name ||= "appland-rails-test-#{Random.bytes(8).unpack1('h*')}"
36
+ @database_name ||= "appland-rails-test-#{Random.new.bytes(8).unpack1('h*')}"
37
37
  end
38
38
 
39
39
  def bundle
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.80.0
4
+ version: 0.81.0
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-04-08 00:00:00.000000000 Z
11
+ date: 2022-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport