appmap 0.75.0 → 0.77.1

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: 322b607426359e9dcebd46ea4a565550c75413e785275b736530149e19f493c4
4
- data.tar.gz: 34b81b8f50e4312b0d1b3e54ad58bb86666812eafaba19338aca73ed12f12c37
3
+ metadata.gz: b186892e87c9138a6bd540c82dd899e5d9b4671748ba7219c7d685175509d625
4
+ data.tar.gz: 0f917bd67d06fab65b568b55c68405206fdf942cd72854a6cff845e021970d80
5
5
  SHA512:
6
- metadata.gz: ac8aa369f84bd56aa5b2fddba6211eb528beb9c79d710738e9b7feb20198922a35a98e7b57bb615979ad186d7920b358f3ef06f9ced9d4b9289c5627cc660512
7
- data.tar.gz: 9e1c7ab9a501fd4043b31843291f62f71257d3d946a46d8b4c08e3330546a6680cdb53ac512b23ce81ac525e1d35178cc491b5a72113e23a93649c8f87948dab
6
+ metadata.gz: afb2787068a4b7dca1c7b5226f82864c1ce8e5d32c88db7caf554f7c9d6cfbcd1d817e37f1ac691a573d36da4da53ea057c4c3d39c0e985e0969cfed9c63f7ae
7
+ data.tar.gz: 3b7f117ebe7f4b732cc81bd412bea46dd51b356db78a228561b3b9cf5c581b05d91e081b6cd699ad31d33e82fbd3d31548ccb91478c0fe7648357c947d6ef18a
data/.travis.yml CHANGED
@@ -1,10 +1,13 @@
1
1
  language: ruby
2
2
  dist: bionic
3
3
 
4
+ # NB: if you update the ruby versions here, you also need to update
5
+ # them in the Rakefile.
4
6
  rbenv:
5
7
  - 2.6
6
8
  - 2.7
7
9
  - 3.0
10
+ - 3.1
8
11
 
9
12
  addons:
10
13
  apt:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [0.77.1](https://github.com/applandinc/appmap-ruby/compare/v0.77.0...v0.77.1) (2022-03-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add 3.1 as a supported version ([453f6df](https://github.com/applandinc/appmap-ruby/commit/453f6dfc5de29303fc9cbcf60ce0c3499528711c))
7
+
8
+ # [0.77.0](https://github.com/applandinc/appmap-ruby/compare/v0.76.0...v0.77.0) (2022-03-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * Add label job.perform ([fb5e220](https://github.com/applandinc/appmap-ruby/commit/fb5e220a1f4fd724d8d0178fd4282fed73ff9371))
14
+ * Add labels for devise ([734ec61](https://github.com/applandinc/appmap-ruby/commit/734ec617aa81d756acf3cb392b5eaabcf9521934))
15
+
16
+ # [0.76.0](https://github.com/applandinc/appmap-ruby/compare/v0.75.0...v0.76.0) (2022-03-19)
17
+
18
+
19
+ ### Features
20
+
21
+ * Autoload hook handlers ([4cc0e70](https://github.com/applandinc/appmap-ruby/commit/4cc0e7003a8c37d3b6c8c8bbc68cffac0335b878))
22
+
1
23
  # [0.75.0](https://github.com/applandinc/appmap-ruby/compare/v0.74.0...v0.75.0) (2022-03-17)
2
24
 
3
25
 
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ Rake::ExtensionTask.new("appmap") do |ext|
13
13
  ext.lib_dir = "lib/appmap"
14
14
  end
15
15
 
16
- RUBY_VERSIONS=%w[2.6 2.7 3.0].select do |version|
16
+ RUBY_VERSIONS=%w[2.6 2.7 3.0 3.1].select do |version|
17
17
  travis_ruby_version = ENV['TRAVIS_RUBY_VERSION']
18
18
  next true unless travis_ruby_version
19
19
 
data/appmap.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'reverse_markdown'
33
33
 
34
34
  spec.add_development_dependency 'bundler', '>= 1.16'
35
- spec.add_development_dependency 'minitest', '= 5.14.4'
35
+ spec.add_development_dependency 'minitest', '~> 5.14'
36
36
  spec.add_development_dependency 'pry-byebug'
37
37
  spec.add_development_dependency 'rake', '>= 12.3.3'
38
38
  spec.add_development_dependency 'rdoc'
data/lib/appmap/config.rb CHANGED
@@ -4,8 +4,7 @@ require 'pathname'
4
4
  require 'set'
5
5
  require 'yaml'
6
6
  require 'appmap/util'
7
- require 'appmap/handler/net_http'
8
- require 'appmap/handler/rails/template'
7
+ require 'appmap/handler'
9
8
  require 'appmap/service/guesser'
10
9
  require 'appmap/swagger/configuration'
11
10
  require 'appmap/depends/configuration'
@@ -206,8 +205,8 @@ module AppMap
206
205
  }.compact
207
206
 
208
207
  handler_class = hook_decl['handler_class']
209
- options[:handler_class] = Util.class_from_string(handler_class) if handler_class
210
-
208
+ options[:handler_class] = Handler.find(handler_class) if handler_class
209
+
211
210
  package_hooks(methods, **options)
212
211
  end
213
212
 
@@ -1,2 +1,6 @@
1
1
  - method: ActiveJob::Enqueuing#enqueue
2
2
  label: job.create
3
+ - methods:
4
+ - ActiveJob::Execution#perform
5
+ - ActiveJob::Execution#perform_now
6
+ label: job.perform
@@ -0,0 +1,8 @@
1
+ - method: Devise::TokenGenerator#generate
2
+ label: secret
3
+ - method: Devise.friendly_token
4
+ label: secret
5
+ - method: Devise.secure_compare
6
+ label: security.secure_compare
7
+ - method: Devise::Strategies::DatabaseAuthenticatable#authenticate!
8
+ label: security.authentication
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/inflector/methods'
4
+
5
+ module AppMap
6
+ # Specific hook handler classes and general related utilities.
7
+ module Handler
8
+ # Try to find handler module with a given name.
9
+ #
10
+ # If the module is not loaded, tries to require the appropriate file
11
+ # using the usual conventions, eg. `Acme::Handler::AppMap` will try
12
+ # to require `acme/handler/app_map`, then `acme/handler` and
13
+ # finally `acme`. Raises NameError if the module could not be loaded
14
+ # this way.
15
+ def self.find(name)
16
+ begin
17
+ return Object.const_get name
18
+ rescue NameError
19
+ try_load ActiveSupport::Inflector.underscore name
20
+ end
21
+ Object.const_get name
22
+ end
23
+
24
+ def self.try_load(fname)
25
+ fname = fname.sub %r{^app_map/}, 'appmap/'
26
+ fname = fname.split '/'
27
+ until fname.empty?
28
+ begin
29
+ require fname.join '/'
30
+ return
31
+ rescue LoadError
32
+ # pass
33
+ end
34
+ fname.pop
35
+ end
36
+ end
37
+ end
38
+ end
data/lib/appmap/hook.rb CHANGED
@@ -108,8 +108,11 @@ module AppMap
108
108
 
109
109
  warn "AppMap: Initiating hook for builtin #{class_name} #{method_name}" if LOG
110
110
 
111
- base_cls = Util.class_from_string(class_name, must: false)
112
- next unless base_cls
111
+ begin
112
+ base_cls = Object.const_get class_name
113
+ rescue NameError
114
+ next
115
+ end
113
116
 
114
117
  hook_method = lambda do |entry|
115
118
  cls, method = entry
data/lib/appmap/util.rb CHANGED
@@ -21,14 +21,6 @@ module AppMap
21
21
  WHITE = "\e[37m"
22
22
 
23
23
  class << self
24
- def class_from_string(fq_class, must: true)
25
- fq_class.split('::').inject(Object) do |mod, class_name|
26
- mod.const_get(class_name)
27
- end
28
- rescue NameError
29
- raise if must
30
- end
31
-
32
24
  def parse_function_name(name)
33
25
  package_tokens = name.split('/')
34
26
 
@@ -3,11 +3,11 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.75.0'
6
+ VERSION = '0.77.1'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
 
10
- SUPPORTED_RUBY_VERSIONS = %w[2.6 2.7 3.0].freeze
10
+ SUPPORTED_RUBY_VERSIONS = %w[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
data/spec/hook_spec.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require 'rails_spec_helper'
@@ -1105,7 +1106,7 @@ describe 'AppMap class Hooking', docker: false do
1105
1106
  begin
1106
1107
  tz = ENV['TZ']
1107
1108
  ENV['TZ'] = 'UTC'
1108
- Timecop.freeze(Time.utc('2020-01-01')) do
1109
+ Timecop.freeze(Time.utc(2020, 01, 01)) do
1109
1110
  expect(Time).to receive(:now).at_least(3).times.and_call_original
1110
1111
  expect(InstanceMethod.new.say_the_time).to be
1111
1112
  end
@@ -0,0 +1,52 @@
1
+ [
2
+ {
3
+ "id": 1,
4
+ "event": "call",
5
+ "defined_class": "Example",
6
+ "method_id": "sign",
7
+ "path": "lib/openssl_key_sign.rb",
8
+ "lineno": 10,
9
+ "static": true,
10
+ "parameters": [
11
+
12
+ ],
13
+ "receiver": {
14
+ "class": "Module"
15
+ }
16
+ },
17
+ {
18
+ "id": 2,
19
+ "event": "call",
20
+ "defined_class": "OpenSSL::PKey::PKey",
21
+ "method_id": "sign",
22
+ "path": "OpenSSL::PKey::PKey#sign",
23
+ "static": false,
24
+ "parameters": [
25
+ {
26
+ "name": "arg",
27
+ "class": "Array",
28
+ "value": "[e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, the document]",
29
+ "kind": "rest"
30
+ }
31
+ ],
32
+ "receiver": {
33
+ "class": "OpenSSL::PKey::RSA"
34
+ }
35
+ },
36
+ {
37
+ "id": 3,
38
+ "event": "return",
39
+ "parent_id": 2,
40
+ "return_value": {
41
+ "class": "String"
42
+ }
43
+ },
44
+ {
45
+ "id": 4,
46
+ "event": "return",
47
+ "parent_id": 1,
48
+ "return_value": {
49
+ "class": "String"
50
+ }
51
+ }
52
+ ]
data/test/openssl_test.rb CHANGED
@@ -38,8 +38,14 @@ class OpenSSLTest < Minitest::Test
38
38
  event
39
39
  end
40
40
 
41
+ # Signature of OpenSSL::PKey::PKey.sign changed in 3.1
42
+ expected = if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1')
43
+ expectation('openssl_test_key_sign2-3.1.json').strip
44
+ else
45
+ expectation('openssl_test_key_sign2.json').strip
46
+ end
41
47
  diff = Diffy::Diff.new(
42
- expectation('openssl_test_key_sign2.json').strip,
48
+ expected,
43
49
  JSON.pretty_generate(sanitized_events).strip
44
50
  )
45
51
  assert_equal '', diff.to_s
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.75.0
4
+ version: 0.77.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: 2022-03-17 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 5.14.4
89
+ version: '5.14'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 5.14.4
96
+ version: '5.14'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry-byebug
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -369,11 +369,13 @@ files:
369
369
  - lib/appmap/gem_hooks/activerecord.yml
370
370
  - lib/appmap/gem_hooks/activesupport.yml
371
371
  - lib/appmap/gem_hooks/cancancan.yml
372
+ - lib/appmap/gem_hooks/devise.yml
372
373
  - lib/appmap/gem_hooks/rails.yml
373
374
  - lib/appmap/gem_hooks/railties.yml
374
375
  - lib/appmap/gem_hooks/resque.yml
375
376
  - lib/appmap/gem_hooks/sidekiq.yml
376
377
  - lib/appmap/gem_hooks/sprockets.yml
378
+ - lib/appmap/handler.rb
377
379
  - lib/appmap/handler/function.rb
378
380
  - lib/appmap/handler/net_http.rb
379
381
  - lib/appmap/handler/rails/request_handler.rb
@@ -631,6 +633,7 @@ files:
631
633
  - test/bundle_vendor_test.rb
632
634
  - test/cucumber_test.rb
633
635
  - test/expectations/openssl_test_key_sign1.json
636
+ - test/expectations/openssl_test_key_sign2-3.1.json
634
637
  - test/expectations/openssl_test_key_sign2.json
635
638
  - test/fixtures/bundle_vendor_app/Gemfile
636
639
  - test/fixtures/bundle_vendor_app/appmap.yml