appmap 0.36.0 → 0.39.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 +4 -4
- data/.dockerignore +1 -1
- data/.gitignore +2 -1
- data/.rubocop.yml +15 -1
- data/.travis.yml +2 -23
- data/CHANGELOG.md +20 -0
- data/README.md +30 -13
- data/Rakefile +4 -3
- data/appmap.gemspec +1 -0
- data/lib/appmap.rb +2 -2
- data/lib/appmap/class_map.rb +19 -5
- data/lib/appmap/config.rb +22 -10
- data/lib/appmap/event.rb +16 -1
- data/lib/appmap/hook.rb +11 -3
- data/lib/appmap/hook/method.rb +18 -12
- data/lib/appmap/rails/request_handler.rb +20 -4
- data/lib/appmap/rspec.rb +1 -1
- data/lib/appmap/trace.rb +18 -7
- data/lib/appmap/version.rb +2 -2
- data/spec/abstract_controller_base_spec.rb +132 -67
- data/spec/class_map_spec.rb +36 -0
- data/spec/fixtures/hook/instance_method.rb +4 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.dockerignore +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.gitignore +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.rspec +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.ruby-version +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile.pg +0 -0
- data/spec/fixtures/rails5_users_app/Gemfile +51 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Rakefile +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/api/users_controller.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/application_controller.rb +0 -0
- data/spec/fixtures/{rails4_users_app/app/assets/images → rails5_users_app/app/controllers/concerns}/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/health_controller.rb +0 -0
- data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +13 -0
- data/spec/fixtures/{rails4_users_app/app/models → rails5_users_app/app/models/activerecord}/user.rb +0 -0
- data/spec/fixtures/{rails4_users_app/app/controllers → rails5_users_app/app/models}/concerns/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/models/sequel/user.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/app/views/layouts/application.html.haml +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/app/views/users/index.html.haml +0 -0
- data/spec/fixtures/rails5_users_app/appmap.yml +4 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/appmap +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/byebug +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/gli +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/htmldiff +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ldiff +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/nokogiri +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rackup +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rails +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rake +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rspec +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-parse +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-rewrite +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sequel +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/setup +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sprockets +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/thor +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/update +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config.ru +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/application.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/boot.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/credentials.yml.enc +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/database.yml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environment.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/development.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/production.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/test.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/application_controller_renderer.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/cors.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/inflections.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/mime_types.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/record_button.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/locales/en.yml +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/routes.rb +1 -2
- data/spec/fixtures/{rails_users_app → rails5_users_app}/create_app +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/db/migrate/20190728211408_create_users.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/db/schema.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/docker-compose.yml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/api_users.feature +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/env.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/hooks.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/steps.rb +0 -0
- data/spec/fixtures/{rails4_users_app/app/mailers → rails5_users_app/lib/tasks}/.keep +0 -0
- data/spec/fixtures/{rails4_users_app/app/models → rails5_users_app/log}/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/public/robots.txt +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/controllers/users_controller_api_spec.rb +1 -1
- data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +27 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/models/user_spec.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/rails_helper.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails5_users_app}/spec/spec_helper.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/users_app/.gitignore +0 -0
- data/spec/fixtures/rails6_users_app/.dockerignore +1 -0
- data/spec/fixtures/rails6_users_app/.gitignore +39 -0
- data/spec/fixtures/rails6_users_app/.rspec +1 -0
- data/spec/fixtures/rails6_users_app/.ruby-version +1 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/Dockerfile +3 -4
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/Dockerfile.pg +1 -1
- data/spec/fixtures/{rails_users_app → rails6_users_app}/Gemfile +1 -1
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/Rakefile +1 -1
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/app/controllers/api/users_controller.rb +1 -1
- data/spec/fixtures/rails6_users_app/app/controllers/application_controller.rb +2 -0
- data/spec/fixtures/{rails4_users_app/app/models → rails6_users_app/app/controllers}/concerns/.keep +0 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/app/controllers/health_controller.rb +1 -1
- data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +13 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/app/models/activerecord/user.rb +0 -0
- data/spec/fixtures/{rails4_users_app/lib/assets → rails6_users_app/app/models/concerns}/.keep +0 -0
- data/spec/fixtures/rails6_users_app/app/models/sequel/user.rb +25 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/app/views/layouts/application.html.haml +0 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/app/views/users/index.html.haml +0 -0
- data/spec/fixtures/rails6_users_app/appmap.yml +5 -0
- data/spec/fixtures/rails6_users_app/bin/appmap +29 -0
- data/spec/fixtures/rails6_users_app/bin/byebug +29 -0
- data/spec/fixtures/rails6_users_app/bin/gli +29 -0
- data/spec/fixtures/rails6_users_app/bin/htmldiff +29 -0
- data/spec/fixtures/rails6_users_app/bin/ldiff +29 -0
- data/spec/fixtures/rails6_users_app/bin/nokogiri +29 -0
- data/spec/fixtures/rails6_users_app/bin/rackup +29 -0
- data/spec/fixtures/rails6_users_app/bin/rails +4 -0
- data/spec/fixtures/rails6_users_app/bin/rake +29 -0
- data/spec/fixtures/rails6_users_app/bin/rspec +29 -0
- data/spec/fixtures/rails6_users_app/bin/ruby-parse +29 -0
- data/spec/fixtures/rails6_users_app/bin/ruby-rewrite +29 -0
- data/spec/fixtures/rails6_users_app/bin/sequel +29 -0
- data/spec/fixtures/rails6_users_app/bin/setup +25 -0
- data/spec/fixtures/rails6_users_app/bin/sprockets +29 -0
- data/spec/fixtures/rails6_users_app/bin/thor +29 -0
- data/spec/fixtures/rails6_users_app/bin/update +25 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config.ru +2 -1
- data/spec/fixtures/rails6_users_app/config/application.rb +51 -0
- data/spec/fixtures/rails6_users_app/config/boot.rb +3 -0
- data/spec/fixtures/rails6_users_app/config/credentials.yml.enc +1 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/database.yml +2 -2
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environment.rb +1 -1
- data/spec/fixtures/rails6_users_app/config/environments/development.rb +40 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environments/production.rb +19 -30
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environments/test.rb +5 -11
- data/spec/fixtures/rails6_users_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/fixtures/rails6_users_app/config/initializers/cors.rb +16 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/inflections.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/mime_types.rb +0 -0
- data/spec/fixtures/rails6_users_app/config/initializers/record_button.rb +3 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/initializers/wrap_parameters.rb +1 -6
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/locales/en.yml +10 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/config/routes.rb +1 -1
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/create_app +7 -3
- data/spec/fixtures/rails6_users_app/db/migrate/20190728211408_create_users.rb +9 -0
- data/spec/fixtures/rails6_users_app/db/schema.rb +23 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/docker-compose.yml +3 -1
- data/spec/fixtures/rails6_users_app/features/api_users.feature +13 -0
- data/spec/fixtures/rails6_users_app/features/support/env.rb +4 -0
- data/spec/fixtures/rails6_users_app/features/support/hooks.rb +11 -0
- data/spec/fixtures/rails6_users_app/features/support/steps.rb +18 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/lib/tasks/.keep +0 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/log/.keep +0 -0
- data/spec/fixtures/rails6_users_app/public/robots.txt +1 -0
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +29 -0
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +27 -0
- data/spec/fixtures/rails6_users_app/spec/models/user_spec.rb +39 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app}/spec/rails_helper.rb +3 -32
- data/spec/fixtures/{rails_users_app → rails6_users_app}/spec/spec_helper.rb +0 -0
- data/spec/fixtures/{rails4_users_app → rails6_users_app/users_app}/.gitignore +8 -1
- data/spec/hook_spec.rb +102 -57
- data/spec/rails_spec_helper.rb +5 -5
- data/spec/railtie_spec.rb +31 -32
- data/spec/record_sql_rails_pg_spec.rb +62 -63
- data/spec/remote_recording_spec.rb +90 -89
- data/spec/rspec_feature_metadata_spec.rb +17 -18
- data/test/expectations/openssl_test_key_sign1.json +55 -0
- data/test/expectations/openssl_test_key_sign2.json +58 -0
- data/test/openssl_test.rb +9 -116
- metadata +163 -139
- data/spec/abstract_controller4_base_spec.rb +0 -67
- data/spec/fixtures/rails4_users_app/.rbenv-gemsets +0 -2
- data/spec/fixtures/rails4_users_app/.ruby-version +0 -1
- data/spec/fixtures/rails4_users_app/Gemfile +0 -77
- data/spec/fixtures/rails4_users_app/README.rdoc +0 -28
- data/spec/fixtures/rails4_users_app/app/assets/javascripts/application.js +0 -16
- data/spec/fixtures/rails4_users_app/app/assets/stylesheets/application.css +0 -15
- data/spec/fixtures/rails4_users_app/app/controllers/application_controller.rb +0 -5
- data/spec/fixtures/rails4_users_app/app/controllers/users_controller.rb +0 -5
- data/spec/fixtures/rails4_users_app/app/helpers/application_helper.rb +0 -2
- data/spec/fixtures/rails4_users_app/appmap.yml +0 -3
- data/spec/fixtures/rails4_users_app/bin/rails +0 -9
- data/spec/fixtures/rails4_users_app/bin/setup +0 -29
- data/spec/fixtures/rails4_users_app/bin/spring +0 -17
- data/spec/fixtures/rails4_users_app/config/application.rb +0 -26
- data/spec/fixtures/rails4_users_app/config/boot.rb +0 -3
- data/spec/fixtures/rails4_users_app/config/environments/development.rb +0 -41
- data/spec/fixtures/rails4_users_app/config/initializers/assets.rb +0 -11
- data/spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb +0 -3
- data/spec/fixtures/rails4_users_app/config/initializers/session_store.rb +0 -3
- data/spec/fixtures/rails4_users_app/config/initializers/to_time_preserves_timezone.rb +0 -10
- data/spec/fixtures/rails4_users_app/config/secrets.yml +0 -22
- data/spec/fixtures/rails4_users_app/db/migrate/20191127112304_create_users.rb +0 -10
- data/spec/fixtures/rails4_users_app/db/schema.rb +0 -26
- data/spec/fixtures/rails4_users_app/db/seeds.rb +0 -7
- data/spec/fixtures/rails4_users_app/public/404.html +0 -67
- data/spec/fixtures/rails4_users_app/public/422.html +0 -67
- data/spec/fixtures/rails4_users_app/public/500.html +0 -66
- data/spec/fixtures/rails4_users_app/public/favicon.ico +0 -0
- data/spec/fixtures/rails4_users_app/public/robots.txt +0 -5
- data/spec/fixtures/rails4_users_app/spec/controllers/users_controller_api_spec.rb +0 -49
- data/spec/fixtures/rails4_users_app/test/fixtures/users.yml +0 -9
- data/spec/fixtures/rails_users_app/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/rails_users_app/app/controllers/users_controller.rb +0 -5
- data/spec/fixtures/rails_users_app/app/models/concerns/.keep +0 -0
- data/spec/fixtures/rails_users_app/appmap.yml +0 -3
- data/spec/fixtures/rails_users_app/lib/tasks/.keep +0 -0
- data/spec/fixtures/rails_users_app/log/.keep +0 -0
- data/spec/record_sql_rails4_pg_spec.rb +0 -76
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 384456ad51727b3c819e8307de92b2785da152a46c5fa60d0a4e6ff690dbb596
|
|
4
|
+
data.tar.gz: e0d5a984bc74ee91b0f9428d83cbaac70c387b442cc55666f36b75907080e620
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f0670d632a370241168ad76ad30dd663568556ea3e524c48aafdbf86ae9d0c8e8f76f48a1c34a7a830457cff66c4417bbf19acb7ac952daeaaec65121e7a0d5
|
|
7
|
+
data.tar.gz: 3f1bec26161a40c75487e7f98f039df0c135f7de77ee089d72dde29c1a5d5fd19b43661c6aff3c3de58e945b87d330b96a66738a95a208ec7a4e75db1bd85363
|
data/.dockerignore
CHANGED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
NewCops: enable
|
|
3
|
+
|
|
4
|
+
Layout/CaseIndentation:
|
|
5
|
+
EnforcedStyle: end
|
|
6
|
+
|
|
7
|
+
Layout/FirstArgumentIndentation:
|
|
8
|
+
EnforcedStyle: consistent
|
|
9
|
+
|
|
1
10
|
Layout/SpaceInsideArrayLiteralBrackets:
|
|
2
11
|
Enabled: false
|
|
3
12
|
|
|
@@ -8,12 +17,17 @@ Layout/HeredocIndentation:
|
|
|
8
17
|
Layout/LineLength:
|
|
9
18
|
Max: 120
|
|
10
19
|
|
|
20
|
+
Metrics/BlockLength:
|
|
21
|
+
ExcludedMethods:
|
|
22
|
+
- it
|
|
23
|
+
- context
|
|
24
|
+
|
|
11
25
|
Style/MultilineBlockChain:
|
|
12
26
|
Enabled: false
|
|
13
27
|
|
|
14
28
|
Style/NumericPredicate:
|
|
15
29
|
Enabled: false
|
|
16
|
-
|
|
30
|
+
|
|
17
31
|
Style/AndOr:
|
|
18
32
|
Enabled: false
|
|
19
33
|
|
data/.travis.yml
CHANGED
|
@@ -16,29 +16,8 @@ before_script:
|
|
|
16
16
|
|
|
17
17
|
jobs:
|
|
18
18
|
include:
|
|
19
|
-
- stage:
|
|
19
|
+
- stage: test
|
|
20
20
|
script:
|
|
21
21
|
- mkdir tmp
|
|
22
|
-
- bundle exec rake
|
|
23
|
-
|
|
24
|
-
- stage: base
|
|
25
|
-
script:
|
|
26
|
-
- bundle exec rake build:base:2.5
|
|
27
|
-
- stage: base
|
|
28
|
-
script:
|
|
29
|
-
- bundle exec rake build:base:2.6
|
|
30
|
-
|
|
31
|
-
- stage: fixtures
|
|
32
|
-
script:
|
|
33
|
-
- bundle exec rake build:fixtures:2.5:all
|
|
34
|
-
- stage: fixtures
|
|
35
|
-
script:
|
|
36
|
-
- bundle exec rake build:fixtures:2.6:all
|
|
37
|
-
|
|
38
|
-
- stage: spec
|
|
39
|
-
script:
|
|
40
|
-
- bundle exec rake spec:2.5
|
|
41
|
-
- stage: spec
|
|
42
|
-
script:
|
|
43
|
-
- bundle exec rake spec:2.6
|
|
22
|
+
- bundle exec rake test
|
|
44
23
|
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# v0.39.1
|
|
2
|
+
* Support Ruby 2.7.
|
|
3
|
+
* Remove support for Rails 4.
|
|
4
|
+
* Stop recommending `-t appmap` argument for `rspec`.
|
|
5
|
+
|
|
6
|
+
# v0.39.0
|
|
7
|
+
* Recognize and record `normalized_path_info` in Rails applications, per 1.4 AppMap format version.
|
|
8
|
+
|
|
9
|
+
# v0.38.1
|
|
10
|
+
* Package configuration can be `shallow`, in case which only the initial entry into the package is recorded.
|
|
11
|
+
|
|
12
|
+
# v0.37.2
|
|
13
|
+
* Fix ParameterFilter deprecation warning.
|
|
14
|
+
|
|
15
|
+
# v0.37.1
|
|
16
|
+
* Fix parameter mapping with keyword and rest arguments.
|
|
17
|
+
|
|
18
|
+
# v0.37.0
|
|
19
|
+
* Capture method source and comment.
|
|
20
|
+
|
|
1
21
|
# v0.36.0
|
|
2
22
|
* *appmap.yml* package definition may specify `gem`.
|
|
3
23
|
* Skip loading the railtie if `APPMAP_INITIALIZE` environment variable
|
data/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
- [About](#about)
|
|
2
3
|
- [Installation](#installation)
|
|
3
4
|
- [Configuration](#configuration)
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
- [Using fixture apps](#using-fixture-apps)
|
|
14
15
|
- [`test/fixtures`](#testfixtures)
|
|
15
16
|
- [`spec/fixtures`](#specfixtures)
|
|
16
|
-
|
|
17
|
+
|
|
17
18
|
|
|
18
19
|
# About
|
|
19
20
|
|
|
@@ -27,8 +28,9 @@ granular than a full debug trace. It's designed to be optimal for understanding
|
|
|
27
28
|
There are several ways to record AppMaps of your Ruby program using the `appmap` gem:
|
|
28
29
|
|
|
29
30
|
* Run your RSpec tests with the environment variable `APPMAP=true`. An AppMap will be generated for each spec.
|
|
30
|
-
* Run your application server with AppMap remote recording enabled, and use the
|
|
31
|
-
browser extension to start,
|
|
31
|
+
* Run your application server with AppMap remote recording enabled, and use the [AppLand
|
|
32
|
+
browser extension](https://github.com/applandinc/appland-browser-extension) to start,
|
|
33
|
+
stop, and upload recordings.
|
|
32
34
|
* Run the command `appmap record <program>` to record the entire execution of a program.
|
|
33
35
|
|
|
34
36
|
Once you have recorded some AppMaps (for example, by running RSpec tests), you use the `appland upload` command
|
|
@@ -37,6 +39,13 @@ by the [AppLand CLI](https://github.com/applandinc/appland-cli/releases).
|
|
|
37
39
|
Then, on the [AppLand website](https://app.land), you can
|
|
38
40
|
visualize the design of your code and share links with collaborators.
|
|
39
41
|
|
|
42
|
+
### Supported versions
|
|
43
|
+
|
|
44
|
+
* Ruby 2.5, 2.6, 2.7
|
|
45
|
+
* Rails 5, 6
|
|
46
|
+
|
|
47
|
+
Support for new versions is added frequently, please check back regularly for updates.
|
|
48
|
+
|
|
40
49
|
# Installation
|
|
41
50
|
|
|
42
51
|
Add `gem 'appmap'` to your Gemfile just as you would any other dependency.
|
|
@@ -91,6 +100,9 @@ Each entry in the `packages` list is a YAML object which has the following keys:
|
|
|
91
100
|
* **gem** As an alternative to specifying the path, specify the name of a dependency gem. When using `gem`, don't specify `path`.
|
|
92
101
|
* **exclude** A list of files and directories which will be ignored. By default, all modules, classes and public
|
|
93
102
|
functions are inspected.
|
|
103
|
+
* **shallow** When set to `true`, only the first function call entry into a package will be recorded. Subsequent function calls within
|
|
104
|
+
the same package are not recorded unless code execution leaves the package and re-enters it. Default: `true` when using `gem`,
|
|
105
|
+
`false` when using `path`.
|
|
94
106
|
|
|
95
107
|
# Running
|
|
96
108
|
|
|
@@ -123,7 +135,7 @@ require File.expand_path("../../config/environment", __FILE__)
|
|
|
123
135
|
3) Run the tests with the environment variable `APPMAP=true`:
|
|
124
136
|
|
|
125
137
|
```sh-session
|
|
126
|
-
$ APPMAP=true bundle exec rspec
|
|
138
|
+
$ APPMAP=true bundle exec rspec
|
|
127
139
|
```
|
|
128
140
|
|
|
129
141
|
Each RSpec test will output an AppMap file into the directory `tmp/appmap/rspec`. For example:
|
|
@@ -166,16 +178,22 @@ Note that `test_helper.rb` in a Rails project typically loads the application's
|
|
|
166
178
|
require_relative '../config/environment'
|
|
167
179
|
```
|
|
168
180
|
|
|
169
|
-
and `appmap/
|
|
181
|
+
and `appmap/minitest` must be required before this:
|
|
170
182
|
|
|
171
183
|
```ruby
|
|
172
|
-
require 'appmap/
|
|
184
|
+
require 'appmap/minitest'
|
|
173
185
|
require_relative '../config/environment'
|
|
174
186
|
```
|
|
175
187
|
|
|
176
|
-
2) Run
|
|
188
|
+
2) Run your tests as you normally would with the environment variable `APPMAP=true`. For example:
|
|
177
189
|
|
|
178
|
-
```
|
|
190
|
+
```
|
|
191
|
+
$ APPMAP=true bundle exec rake
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
or
|
|
195
|
+
|
|
196
|
+
```
|
|
179
197
|
$ APPMAP=true bundle exec -Ilib -Itest test/*
|
|
180
198
|
```
|
|
181
199
|
|
|
@@ -250,11 +268,11 @@ end
|
|
|
250
268
|
$ bundle exec rails server
|
|
251
269
|
```
|
|
252
270
|
|
|
253
|
-
4. Open the
|
|
271
|
+
4. Open the AppLand browser extension and push `Start`.
|
|
254
272
|
|
|
255
273
|
5. Use your app. For example, perform a login flow, or run through a manual UI test.
|
|
256
274
|
|
|
257
|
-
6. Open the
|
|
275
|
+
6. Open the AppLand browser extension and push `Stop`. The recording will be transferred to the AppLand website and opened in your browser.
|
|
258
276
|
|
|
259
277
|
## Ruby on Rails
|
|
260
278
|
|
|
@@ -267,6 +285,7 @@ Note that using this method is kind of a blunt instrument. Recording RSpecs and
|
|
|
267
285
|
For instructions on uploading, see the documentation of the [AppLand CLI](https://github.com/applandinc/appland-cli).
|
|
268
286
|
|
|
269
287
|
# Development
|
|
288
|
+
[](https://travis-ci.org/applandinc/appmap-ruby)
|
|
270
289
|
|
|
271
290
|
## Running tests
|
|
272
291
|
|
|
@@ -291,7 +310,7 @@ $ bundle exec rake compile
|
|
|
291
310
|
### `test/fixtures`
|
|
292
311
|
|
|
293
312
|
The fixture apps in `test/fixtures` are plain Ruby projects that exercise the basic functionality of the
|
|
294
|
-
`appmap` gem. To develop in a fixture,
|
|
313
|
+
`appmap` gem. To develop in a fixture, simply enter the fixture directory and `bundle`.
|
|
295
314
|
|
|
296
315
|
### `spec/fixtures`
|
|
297
316
|
|
|
@@ -341,5 +360,3 @@ Finished in 0.07357 seconds (files took 2.1 seconds to load)
|
|
|
341
360
|
4 examples, 0 failures
|
|
342
361
|
```
|
|
343
362
|
|
|
344
|
-
# Build status
|
|
345
|
-
[](https://travis-ci.org/applandinc/appmap-ruby)
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
$: << File.join(__dir__, 'lib')
|
|
1
2
|
require 'appmap/version'
|
|
2
3
|
GEM_VERSION = AppMap::VERSION
|
|
3
4
|
|
|
@@ -17,12 +18,12 @@ namespace 'gem' do
|
|
|
17
18
|
require 'bundler/gem_tasks'
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
RUBY_VERSIONS=%w[2.5 2.6]
|
|
21
|
-
FIXTURE_APPS=%w[rack_users_app
|
|
21
|
+
RUBY_VERSIONS=%w[2.5 2.6 2.7]
|
|
22
|
+
FIXTURE_APPS=%w[rack_users_app rails6_users_app rails5_users_app]
|
|
22
23
|
|
|
23
24
|
def run_cmd(*cmd)
|
|
24
25
|
$stderr.puts "Running: #{cmd}"
|
|
25
|
-
out,s = Open3.capture2e(*cmd)
|
|
26
|
+
out, s = Open3.capture2e(*cmd)
|
|
26
27
|
unless s.success?
|
|
27
28
|
$stderr.puts <<-END
|
|
28
29
|
Command failed:
|
data/appmap.gemspec
CHANGED
data/lib/appmap.rb
CHANGED
|
@@ -83,8 +83,8 @@ module AppMap
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
# Builds a class map from a config and a list of Ruby methods.
|
|
86
|
-
def class_map(methods)
|
|
87
|
-
ClassMap.build_from_methods(methods)
|
|
86
|
+
def class_map(methods, options = {})
|
|
87
|
+
ClassMap.build_from_methods(methods, options)
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
# Returns default metadata detected from the Ruby system and from the
|
data/lib/appmap/class_map.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'method_source'
|
|
4
|
+
|
|
3
5
|
module AppMap
|
|
4
6
|
class ClassMap
|
|
5
7
|
module HasChildren
|
|
@@ -48,7 +50,7 @@ module AppMap
|
|
|
48
50
|
end
|
|
49
51
|
end
|
|
50
52
|
Function = Struct.new(:name) do
|
|
51
|
-
attr_accessor :static, :location, :labels
|
|
53
|
+
attr_accessor :static, :location, :labels, :comment, :source
|
|
52
54
|
|
|
53
55
|
def type
|
|
54
56
|
'function'
|
|
@@ -60,24 +62,26 @@ module AppMap
|
|
|
60
62
|
type: type,
|
|
61
63
|
location: location,
|
|
62
64
|
static: static,
|
|
63
|
-
labels: labels
|
|
65
|
+
labels: labels,
|
|
66
|
+
comment: comment,
|
|
67
|
+
source: source
|
|
64
68
|
}.delete_if { |_, v| v.nil? || v == [] }
|
|
65
69
|
end
|
|
66
70
|
end
|
|
67
71
|
end
|
|
68
72
|
|
|
69
73
|
class << self
|
|
70
|
-
def build_from_methods(methods)
|
|
74
|
+
def build_from_methods(methods, options = {})
|
|
71
75
|
root = Types::Root.new
|
|
72
76
|
methods.each do |method|
|
|
73
|
-
add_function root, method
|
|
77
|
+
add_function root, method, options
|
|
74
78
|
end
|
|
75
79
|
root.children.map(&:to_h)
|
|
76
80
|
end
|
|
77
81
|
|
|
78
82
|
protected
|
|
79
83
|
|
|
80
|
-
def add_function(root, method)
|
|
84
|
+
def add_function(root, method, include_source: true)
|
|
81
85
|
package = method.package
|
|
82
86
|
static = method.static
|
|
83
87
|
|
|
@@ -109,6 +113,16 @@ module AppMap
|
|
|
109
113
|
[ method.defined_class, static ? '.' : '#', method.name ].join
|
|
110
114
|
end
|
|
111
115
|
|
|
116
|
+
if include_source
|
|
117
|
+
begin
|
|
118
|
+
function_info[:source] = method.source
|
|
119
|
+
comment = method.comment || ''
|
|
120
|
+
function_info[:comment] = comment unless comment.empty?
|
|
121
|
+
rescue MethodSource::SourceNotFoundError
|
|
122
|
+
# pass
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
112
126
|
function_info[:labels] = package.labels if package.labels
|
|
113
127
|
object_infos << function_info
|
|
114
128
|
|
data/lib/appmap/config.rb
CHANGED
|
@@ -2,15 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module AppMap
|
|
4
4
|
class Config
|
|
5
|
-
Package = Struct.new(:path, :gem, :package_name, :exclude, :labels) do
|
|
5
|
+
Package = Struct.new(:path, :gem, :package_name, :exclude, :labels, :shallow) do
|
|
6
|
+
# Indicates that only the entry points to a package will be recorded.
|
|
7
|
+
# Once the code has entered a package, subsequent calls within the package will not be
|
|
8
|
+
# recorded unless the code leaves the package and re-enters it.
|
|
9
|
+
def shallow?
|
|
10
|
+
shallow
|
|
11
|
+
end
|
|
12
|
+
|
|
6
13
|
class << self
|
|
7
|
-
def build_from_path(path, package_name: nil, exclude: [], labels: [])
|
|
8
|
-
Package.new(path, nil, package_name, exclude, labels)
|
|
14
|
+
def build_from_path(path, shallow: false, package_name: nil, exclude: [], labels: [])
|
|
15
|
+
Package.new(path, nil, package_name, exclude, labels, shallow)
|
|
9
16
|
end
|
|
10
17
|
|
|
11
|
-
def build_from_gem(gem, package_name: nil, exclude: [], labels: [])
|
|
18
|
+
def build_from_gem(gem, shallow: true, package_name: nil, exclude: [], labels: [])
|
|
12
19
|
gem_paths(gem).map do |gem_path|
|
|
13
|
-
Package.new(gem_path, gem, package_name, exclude, labels)
|
|
20
|
+
Package.new(gem_path, gem, package_name, exclude, labels, shallow)
|
|
14
21
|
end
|
|
15
22
|
end
|
|
16
23
|
|
|
@@ -36,7 +43,8 @@ module AppMap
|
|
|
36
43
|
package_name: package_name,
|
|
37
44
|
gem: gem,
|
|
38
45
|
exclude: exclude.blank? ? nil : exclude,
|
|
39
|
-
labels: labels.blank? ? nil : labels
|
|
46
|
+
labels: labels.blank? ? nil : labels,
|
|
47
|
+
shallow: shallow
|
|
40
48
|
}.compact
|
|
41
49
|
end
|
|
42
50
|
end
|
|
@@ -49,7 +57,8 @@ module AppMap
|
|
|
49
57
|
# Methods that should always be hooked, with their containing
|
|
50
58
|
# package and labels that should be applied to them.
|
|
51
59
|
HOOKED_METHODS = {
|
|
52
|
-
'ActiveSupport::SecurityUtils' => Hook.new(:secure_compare, Package.build_from_path('active_support', package_name: 'active_support', labels: %w[security crypto]))
|
|
60
|
+
'ActiveSupport::SecurityUtils' => Hook.new(:secure_compare, Package.build_from_path('active_support', package_name: 'active_support', labels: %w[security crypto])),
|
|
61
|
+
'ActionView::Renderer' => Hook.new(:render, Package.build_from_path('action_view', package_name: 'action_view', labels: %w[view]))
|
|
53
62
|
}.freeze
|
|
54
63
|
|
|
55
64
|
BUILTIN_METHODS = {
|
|
@@ -66,7 +75,7 @@ module AppMap
|
|
|
66
75
|
'Marshal' => Hook.new(%i[dump load], Package.build_from_path('marshal', labels: %w[serialization marshal])),
|
|
67
76
|
'Psych' => Hook.new(%i[dump dump_stream load load_stream parse parse_stream], Package.build_from_path('yaml', package_name: 'psych', labels: %w[serialization yaml])),
|
|
68
77
|
'JSON::Ext::Parser' => Hook.new(:parse, Package.build_from_path('json', package_name: 'json', labels: %w[serialization json])),
|
|
69
|
-
'JSON::Ext::Generator::State' => Hook.new(:generate, Package.build_from_path('json', package_name: 'json', labels: %w[serialization json]))
|
|
78
|
+
'JSON::Ext::Generator::State' => Hook.new(:generate, Package.build_from_path('json', package_name: 'json', labels: %w[serialization json])),
|
|
70
79
|
}.freeze
|
|
71
80
|
|
|
72
81
|
attr_reader :name, :packages
|
|
@@ -91,9 +100,12 @@ module AppMap
|
|
|
91
100
|
raise 'AppMap package configuration should specify gem or path, not both' if gem && path
|
|
92
101
|
|
|
93
102
|
if gem
|
|
94
|
-
|
|
103
|
+
shallow = package['shallow']
|
|
104
|
+
# shallow is true by default for gems
|
|
105
|
+
shallow = true if shallow.nil?
|
|
106
|
+
Package.build_from_gem(gem, exclude: package['exclude'] || [], shallow: shallow)
|
|
95
107
|
else
|
|
96
|
-
[ Package.build_from_path(path, exclude: package['exclude'] || []) ]
|
|
108
|
+
[ Package.build_from_path(path, exclude: package['exclude'] || [], shallow: package['shallow']) ]
|
|
97
109
|
end
|
|
98
110
|
end.flatten
|
|
99
111
|
Config.new config_data['name'], packages
|
data/lib/appmap/event.rb
CHANGED
|
@@ -89,10 +89,25 @@ module AppMap
|
|
|
89
89
|
else
|
|
90
90
|
mc.path = [ defined_class, static ? '.' : '#', method.name ].join
|
|
91
91
|
end
|
|
92
|
+
|
|
93
|
+
# Check if the method has key parameters. If there are any they'll always be last.
|
|
94
|
+
# If yes, then extract it from arguments.
|
|
95
|
+
has_key = [[:dummy], *method.parameters].last.first.to_s.start_with?('key') && arguments[-1].is_a?(Hash)
|
|
96
|
+
kwargs = has_key && arguments[-1].dup || {}
|
|
97
|
+
|
|
92
98
|
mc.parameters = method.parameters.map.with_index do |method_param, idx|
|
|
93
99
|
param_type, param_name = method_param
|
|
94
100
|
param_name ||= 'arg'
|
|
95
|
-
value =
|
|
101
|
+
value = case param_type
|
|
102
|
+
when :keyrest
|
|
103
|
+
kwargs
|
|
104
|
+
when /^key/
|
|
105
|
+
kwargs.delete param_name
|
|
106
|
+
when :rest
|
|
107
|
+
arguments[idx..(has_key ? -2 : -1)]
|
|
108
|
+
else
|
|
109
|
+
arguments[idx]
|
|
110
|
+
end
|
|
96
111
|
{
|
|
97
112
|
name: param_name,
|
|
98
113
|
class: value.class.name,
|
data/lib/appmap/hook.rb
CHANGED
|
@@ -6,6 +6,9 @@ module AppMap
|
|
|
6
6
|
class Hook
|
|
7
7
|
LOG = (ENV['APPMAP_DEBUG'] == 'true' || ENV['DEBUG'] == 'true')
|
|
8
8
|
|
|
9
|
+
OBJECT_INSTANCE_METHODS = %i[! != !~ <=> == === =~ __id__ __send__ class clone define_singleton_method display dup enum_for eql? equal? extend freeze frozen? hash inspect instance_eval instance_exec instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself kind_of? method methods nil? object_id private_methods protected_methods public_method public_methods public_send remove_instance_variable respond_to? send singleton_class singleton_method singleton_methods taint tainted? tap then to_enum to_s to_h to_a trust untaint untrust untrusted? yield_self].freeze
|
|
10
|
+
OBJECT_STATIC_METHODS = %i[! != !~ < <= <=> == === =~ > >= __id__ __send__ alias_method allocate ancestors attr attr_accessor attr_reader attr_writer autoload autoload? class class_eval class_exec class_variable_defined? class_variable_get class_variable_set class_variables clone const_defined? const_get const_missing const_set constants define_method define_singleton_method deprecate_constant display dup enum_for eql? equal? extend freeze frozen? hash include include? included_modules inspect instance_eval instance_exec instance_method instance_methods instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself kind_of? method method_defined? methods module_eval module_exec name new nil? object_id prepend private_class_method private_constant private_instance_methods private_method_defined? private_methods protected_instance_methods protected_method_defined? protected_methods public_class_method public_constant public_instance_method public_instance_methods public_method public_method_defined? public_methods public_send remove_class_variable remove_instance_variable remove_method respond_to? send singleton_class singleton_class? singleton_method singleton_methods superclass taint tainted? tap then to_enum to_s trust undef_method untaint untrust untrusted? yield_self].freeze
|
|
11
|
+
|
|
9
12
|
@unbound_method_arity = ::UnboundMethod.instance_method(:arity)
|
|
10
13
|
@method_arity = ::Method.instance_method(:arity)
|
|
11
14
|
|
|
@@ -42,12 +45,17 @@ module AppMap
|
|
|
42
45
|
tp = TracePoint.new(:end) do |trace_point|
|
|
43
46
|
cls = trace_point.self
|
|
44
47
|
|
|
45
|
-
instance_methods = cls.public_instance_methods(false)
|
|
46
|
-
class_methods = cls.singleton_class.public_instance_methods(false) - instance_methods
|
|
48
|
+
instance_methods = cls.public_instance_methods(false) - OBJECT_INSTANCE_METHODS
|
|
49
|
+
class_methods = cls.singleton_class.public_instance_methods(false) - instance_methods - OBJECT_STATIC_METHODS
|
|
47
50
|
|
|
48
51
|
hook = lambda do |hook_cls|
|
|
49
52
|
lambda do |method_id|
|
|
50
|
-
method =
|
|
53
|
+
method = begin
|
|
54
|
+
hook_cls.public_instance_method(method_id)
|
|
55
|
+
rescue NameError
|
|
56
|
+
warn "AppMap: Method #{hook_cls} #{method.name} is not accessible" if LOG
|
|
57
|
+
return
|
|
58
|
+
end
|
|
51
59
|
|
|
52
60
|
warn "AppMap: Examining #{hook_cls} #{method.name}" if LOG
|
|
53
61
|
|