appmap 0.37.0 → 0.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +1 -1
  3. data/.rubocop.yml +12 -1
  4. data/.travis.yml +2 -23
  5. data/CHANGELOG.md +24 -0
  6. data/CONTRIBUTING.md +22 -0
  7. data/README.md +79 -50
  8. data/Rakefile +3 -3
  9. data/lib/appmap/class_map.rb +25 -8
  10. data/lib/appmap/config.rb +22 -10
  11. data/lib/appmap/event.rb +16 -1
  12. data/lib/appmap/hook.rb +11 -3
  13. data/lib/appmap/hook/method.rb +18 -12
  14. data/lib/appmap/rails/request_handler.rb +25 -4
  15. data/lib/appmap/railtie.rb +1 -5
  16. data/lib/appmap/trace.rb +18 -7
  17. data/lib/appmap/version.rb +2 -2
  18. data/spec/abstract_controller_base_spec.rb +132 -67
  19. data/spec/fixtures/hook/instance_method.rb +4 -0
  20. data/spec/fixtures/hook/labels.rb +6 -0
  21. data/spec/fixtures/{rails_users_app → rails5_users_app}/.dockerignore +0 -0
  22. data/spec/fixtures/{rails_users_app → rails5_users_app}/.gitignore +0 -0
  23. data/spec/fixtures/{rails_users_app → rails5_users_app}/.rspec +0 -0
  24. data/spec/fixtures/{rails_users_app → rails5_users_app}/.ruby-version +0 -0
  25. data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile +0 -0
  26. data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile.pg +0 -0
  27. data/spec/fixtures/rails5_users_app/Gemfile +50 -0
  28. data/spec/fixtures/{rails_users_app → rails5_users_app}/Rakefile +0 -0
  29. data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/api/users_controller.rb +0 -0
  30. data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/application_controller.rb +0 -0
  31. data/spec/fixtures/{rails4_users_app/app/assets/images → rails5_users_app/app/controllers/concerns}/.keep +0 -0
  32. data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/health_controller.rb +0 -0
  33. data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +13 -0
  34. data/spec/fixtures/{rails4_users_app/app/models → rails5_users_app/app/models/activerecord}/user.rb +0 -0
  35. data/spec/fixtures/{rails4_users_app/app/controllers → rails5_users_app/app/models}/concerns/.keep +0 -0
  36. data/spec/fixtures/{rails_users_app → rails5_users_app}/app/models/sequel/user.rb +0 -0
  37. data/spec/fixtures/{rails4_users_app → rails5_users_app}/app/views/layouts/application.html.haml +0 -0
  38. data/spec/fixtures/{rails4_users_app → rails5_users_app}/app/views/users/index.html.haml +0 -0
  39. data/spec/fixtures/rails5_users_app/appmap.yml +4 -0
  40. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/appmap +0 -0
  41. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/byebug +0 -0
  42. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/gli +0 -0
  43. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/htmldiff +0 -0
  44. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ldiff +0 -0
  45. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/nokogiri +0 -0
  46. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rackup +0 -0
  47. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rails +0 -0
  48. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rake +0 -0
  49. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rspec +0 -0
  50. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-parse +0 -0
  51. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-rewrite +0 -0
  52. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sequel +0 -0
  53. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/setup +0 -0
  54. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sprockets +0 -0
  55. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/thor +0 -0
  56. data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/update +0 -0
  57. data/spec/fixtures/{rails_users_app → rails5_users_app}/config.ru +0 -0
  58. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/application.rb +2 -0
  59. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/boot.rb +0 -0
  60. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/credentials.yml.enc +0 -0
  61. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/database.yml +0 -0
  62. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environment.rb +0 -0
  63. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/development.rb +0 -0
  64. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/production.rb +0 -0
  65. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/test.rb +0 -0
  66. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/application_controller_renderer.rb +0 -0
  67. data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/backtrace_silencers.rb +0 -0
  68. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/cors.rb +0 -0
  69. data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
  70. data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/inflections.rb +0 -0
  71. data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/initializers/mime_types.rb +0 -0
  72. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/record_button.rb +0 -0
  73. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/wrap_parameters.rb +0 -0
  74. data/spec/fixtures/{rails_users_app → rails5_users_app}/config/locales/en.yml +0 -0
  75. data/spec/fixtures/{rails4_users_app → rails5_users_app}/config/routes.rb +1 -2
  76. data/spec/fixtures/{rails_users_app → rails5_users_app}/create_app +0 -0
  77. data/spec/fixtures/{rails_users_app → rails5_users_app}/db/migrate/20190728211408_create_users.rb +0 -0
  78. data/spec/fixtures/{rails_users_app → rails5_users_app}/db/schema.rb +0 -0
  79. data/spec/fixtures/{rails_users_app → rails5_users_app}/docker-compose.yml +0 -0
  80. data/spec/fixtures/{rails_users_app → rails5_users_app}/features/api_users.feature +0 -0
  81. data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/env.rb +0 -0
  82. data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/hooks.rb +0 -0
  83. data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/steps.rb +0 -0
  84. data/spec/fixtures/{rails4_users_app/app/mailers → rails5_users_app/lib/tasks}/.keep +0 -0
  85. data/spec/fixtures/{rails4_users_app/app/models → rails5_users_app/log}/.keep +0 -0
  86. data/spec/fixtures/{rails_users_app → rails5_users_app}/public/robots.txt +0 -0
  87. data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/controllers/users_controller_api_spec.rb +1 -1
  88. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +27 -0
  89. data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/models/user_spec.rb +0 -0
  90. data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/rails_helper.rb +0 -0
  91. data/spec/fixtures/{rails4_users_app → rails5_users_app}/spec/spec_helper.rb +0 -0
  92. data/spec/fixtures/{rails_users_app → rails5_users_app}/users_app/.gitignore +0 -0
  93. data/spec/fixtures/rails6_users_app/.dockerignore +1 -0
  94. data/spec/fixtures/rails6_users_app/.gitignore +39 -0
  95. data/spec/fixtures/rails6_users_app/.rspec +1 -0
  96. data/spec/fixtures/rails6_users_app/.ruby-version +1 -0
  97. data/spec/fixtures/{rails4_users_app → rails6_users_app}/Dockerfile +3 -4
  98. data/spec/fixtures/{rails4_users_app → rails6_users_app}/Dockerfile.pg +1 -1
  99. data/spec/fixtures/{rails_users_app → rails6_users_app}/Gemfile +3 -4
  100. data/spec/fixtures/{rails4_users_app → rails6_users_app}/Rakefile +1 -1
  101. data/spec/fixtures/{rails4_users_app → rails6_users_app}/app/controllers/api/users_controller.rb +1 -1
  102. data/spec/fixtures/rails6_users_app/app/controllers/application_controller.rb +2 -0
  103. data/spec/fixtures/{rails4_users_app/app/models → rails6_users_app/app/controllers}/concerns/.keep +0 -0
  104. data/spec/fixtures/{rails4_users_app → rails6_users_app}/app/controllers/health_controller.rb +1 -1
  105. data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +13 -0
  106. data/spec/fixtures/{rails_users_app → rails6_users_app}/app/models/activerecord/user.rb +0 -0
  107. data/spec/fixtures/{rails4_users_app/lib/assets → rails6_users_app/app/models/concerns}/.keep +0 -0
  108. data/spec/fixtures/rails6_users_app/app/models/sequel/user.rb +25 -0
  109. data/spec/fixtures/{rails_users_app → rails6_users_app}/app/views/layouts/application.html.haml +0 -0
  110. data/spec/fixtures/{rails_users_app → rails6_users_app}/app/views/users/index.html.haml +0 -0
  111. data/spec/fixtures/rails6_users_app/appmap.yml +5 -0
  112. data/spec/fixtures/rails6_users_app/bin/appmap +29 -0
  113. data/spec/fixtures/rails6_users_app/bin/byebug +29 -0
  114. data/spec/fixtures/rails6_users_app/bin/gli +29 -0
  115. data/spec/fixtures/rails6_users_app/bin/htmldiff +29 -0
  116. data/spec/fixtures/rails6_users_app/bin/ldiff +29 -0
  117. data/spec/fixtures/rails6_users_app/bin/nokogiri +29 -0
  118. data/spec/fixtures/rails6_users_app/bin/rackup +29 -0
  119. data/spec/fixtures/rails6_users_app/bin/rails +4 -0
  120. data/spec/fixtures/rails6_users_app/bin/rake +29 -0
  121. data/spec/fixtures/rails6_users_app/bin/rspec +29 -0
  122. data/spec/fixtures/rails6_users_app/bin/ruby-parse +29 -0
  123. data/spec/fixtures/rails6_users_app/bin/ruby-rewrite +29 -0
  124. data/spec/fixtures/rails6_users_app/bin/sequel +29 -0
  125. data/spec/fixtures/rails6_users_app/bin/setup +25 -0
  126. data/spec/fixtures/rails6_users_app/bin/sprockets +29 -0
  127. data/spec/fixtures/rails6_users_app/bin/thor +29 -0
  128. data/spec/fixtures/rails6_users_app/bin/update +25 -0
  129. data/spec/fixtures/{rails4_users_app → rails6_users_app}/config.ru +2 -1
  130. data/spec/fixtures/rails6_users_app/config/application.rb +53 -0
  131. data/spec/fixtures/rails6_users_app/config/boot.rb +3 -0
  132. data/spec/fixtures/rails6_users_app/config/credentials.yml.enc +1 -0
  133. data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/database.yml +2 -2
  134. data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environment.rb +1 -1
  135. data/spec/fixtures/rails6_users_app/config/environments/development.rb +40 -0
  136. data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environments/production.rb +19 -30
  137. data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/environments/test.rb +5 -11
  138. data/spec/fixtures/rails6_users_app/config/initializers/application_controller_renderer.rb +8 -0
  139. data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/backtrace_silencers.rb +0 -0
  140. data/spec/fixtures/rails6_users_app/config/initializers/cors.rb +16 -0
  141. data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
  142. data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/inflections.rb +0 -0
  143. data/spec/fixtures/{rails_users_app → rails6_users_app}/config/initializers/mime_types.rb +0 -0
  144. data/spec/fixtures/rails6_users_app/config/initializers/record_button.rb +3 -0
  145. data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/initializers/wrap_parameters.rb +1 -6
  146. data/spec/fixtures/{rails4_users_app → rails6_users_app}/config/locales/en.yml +10 -0
  147. data/spec/fixtures/{rails_users_app → rails6_users_app}/config/routes.rb +1 -1
  148. data/spec/fixtures/{rails4_users_app → rails6_users_app}/create_app +7 -3
  149. data/spec/fixtures/rails6_users_app/db/migrate/20190728211408_create_users.rb +9 -0
  150. data/spec/fixtures/rails6_users_app/db/schema.rb +23 -0
  151. data/spec/fixtures/{rails4_users_app → rails6_users_app}/docker-compose.yml +3 -1
  152. data/spec/fixtures/rails6_users_app/features/api_users.feature +13 -0
  153. data/spec/fixtures/rails6_users_app/features/support/env.rb +4 -0
  154. data/spec/fixtures/rails6_users_app/features/support/hooks.rb +11 -0
  155. data/spec/fixtures/rails6_users_app/features/support/steps.rb +18 -0
  156. data/spec/fixtures/{rails4_users_app → rails6_users_app}/lib/tasks/.keep +0 -0
  157. data/spec/fixtures/{rails4_users_app → rails6_users_app}/log/.keep +0 -0
  158. data/spec/fixtures/rails6_users_app/public/robots.txt +1 -0
  159. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +29 -0
  160. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +27 -0
  161. data/spec/fixtures/rails6_users_app/spec/models/user_spec.rb +39 -0
  162. data/spec/fixtures/{rails4_users_app → rails6_users_app}/spec/rails_helper.rb +3 -32
  163. data/spec/fixtures/{rails_users_app → rails6_users_app}/spec/spec_helper.rb +0 -0
  164. data/spec/fixtures/{rails4_users_app → rails6_users_app/users_app}/.gitignore +8 -1
  165. data/spec/hook_spec.rb +111 -57
  166. data/spec/rails_spec_helper.rb +5 -5
  167. data/spec/railtie_spec.rb +31 -32
  168. data/spec/record_sql_rails_pg_spec.rb +62 -63
  169. data/spec/remote_recording_spec.rb +90 -89
  170. data/spec/rspec_feature_metadata_spec.rb +17 -18
  171. data/spec/spec_helper.rb +1 -0
  172. metadata +148 -139
  173. data/spec/abstract_controller4_base_spec.rb +0 -67
  174. data/spec/fixtures/rails4_users_app/.rbenv-gemsets +0 -2
  175. data/spec/fixtures/rails4_users_app/.ruby-version +0 -1
  176. data/spec/fixtures/rails4_users_app/Gemfile +0 -77
  177. data/spec/fixtures/rails4_users_app/README.rdoc +0 -28
  178. data/spec/fixtures/rails4_users_app/app/assets/javascripts/application.js +0 -16
  179. data/spec/fixtures/rails4_users_app/app/assets/stylesheets/application.css +0 -15
  180. data/spec/fixtures/rails4_users_app/app/controllers/application_controller.rb +0 -5
  181. data/spec/fixtures/rails4_users_app/app/controllers/users_controller.rb +0 -5
  182. data/spec/fixtures/rails4_users_app/app/helpers/application_helper.rb +0 -2
  183. data/spec/fixtures/rails4_users_app/appmap.yml +0 -3
  184. data/spec/fixtures/rails4_users_app/bin/rails +0 -9
  185. data/spec/fixtures/rails4_users_app/bin/setup +0 -29
  186. data/spec/fixtures/rails4_users_app/bin/spring +0 -17
  187. data/spec/fixtures/rails4_users_app/config/application.rb +0 -26
  188. data/spec/fixtures/rails4_users_app/config/boot.rb +0 -3
  189. data/spec/fixtures/rails4_users_app/config/environments/development.rb +0 -41
  190. data/spec/fixtures/rails4_users_app/config/initializers/assets.rb +0 -11
  191. data/spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb +0 -3
  192. data/spec/fixtures/rails4_users_app/config/initializers/session_store.rb +0 -3
  193. data/spec/fixtures/rails4_users_app/config/initializers/to_time_preserves_timezone.rb +0 -10
  194. data/spec/fixtures/rails4_users_app/config/secrets.yml +0 -22
  195. data/spec/fixtures/rails4_users_app/db/migrate/20191127112304_create_users.rb +0 -10
  196. data/spec/fixtures/rails4_users_app/db/schema.rb +0 -26
  197. data/spec/fixtures/rails4_users_app/db/seeds.rb +0 -7
  198. data/spec/fixtures/rails4_users_app/public/404.html +0 -67
  199. data/spec/fixtures/rails4_users_app/public/422.html +0 -67
  200. data/spec/fixtures/rails4_users_app/public/500.html +0 -66
  201. data/spec/fixtures/rails4_users_app/public/favicon.ico +0 -0
  202. data/spec/fixtures/rails4_users_app/public/robots.txt +0 -5
  203. data/spec/fixtures/rails4_users_app/spec/controllers/users_controller_api_spec.rb +0 -49
  204. data/spec/fixtures/rails4_users_app/test/fixtures/users.yml +0 -9
  205. data/spec/fixtures/rails_users_app/app/controllers/concerns/.keep +0 -0
  206. data/spec/fixtures/rails_users_app/app/controllers/users_controller.rb +0 -5
  207. data/spec/fixtures/rails_users_app/app/models/concerns/.keep +0 -0
  208. data/spec/fixtures/rails_users_app/appmap.yml +0 -3
  209. data/spec/fixtures/rails_users_app/lib/tasks/.keep +0 -0
  210. data/spec/fixtures/rails_users_app/log/.keep +0 -0
  211. 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: fba24ecdb42c951741292378419eef430a56cc16816df46a14b2ae3e318f8f94
4
- data.tar.gz: 67ff27467f72322c5a8514c90b0a6039e3fd1268dba103dea3b832eda95ac317
3
+ metadata.gz: 1b0943dadde84e67780d724918fa26377b869791eaab6edfb714e5081ecb5c80
4
+ data.tar.gz: c492323d80541a913b800924d04a7c24a6c8682263ba3ec4deabfa8d7ade3908
5
5
  SHA512:
6
- metadata.gz: 1823304c2733b46470481fd731a1f4650a80e769d96b47dbcdb0e5763e59930d6754068b4cf0729f9f748c55109575f3c8146b09030741fccfafd06cd45669b9
7
- data.tar.gz: bbebe31041ed1720dc54b9522e4c6baac3b27d8d77be0622315657d0fa5b355c3e12474aa756811a6d747b563999c6e76206805c1392a015f92c6b863e8eeda0
6
+ metadata.gz: 2a27e5b9bc3dafbba8aafd7035732b6ffcb813d57bb216d0e544af30260c0e26f23a920d1b2d6d35882046e74a57f8b492b12b9869de5d820ff6a4e09cafd716
7
+ data.tar.gz: f1bdc22fda7a6fdf0a37fc1d5bd419947e0fffa16511873dbe8a1549f30bf862566fe74fa4c9952c4338f5263414c99f3d598daec0a599b467e52ebac374b4f7
@@ -1,5 +1,5 @@
1
1
  vendor
2
2
  node_modules
3
- spec/fixtures/rails_users_app
3
+ spec/fixtures/rails*_users_app
4
4
  spec/fixtures/rack_users_app
5
5
 
@@ -1,6 +1,12 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
3
 
4
+ Layout/CaseIndentation:
5
+ EnforcedStyle: end
6
+
7
+ Layout/FirstArgumentIndentation:
8
+ EnforcedStyle: consistent
9
+
4
10
  Layout/SpaceInsideArrayLiteralBrackets:
5
11
  Enabled: false
6
12
 
@@ -11,12 +17,17 @@ Layout/HeredocIndentation:
11
17
  Layout/LineLength:
12
18
  Max: 120
13
19
 
20
+ Metrics/BlockLength:
21
+ ExcludedMethods:
22
+ - it
23
+ - context
24
+
14
25
  Style/MultilineBlockChain:
15
26
  Enabled: false
16
27
 
17
28
  Style/NumericPredicate:
18
29
  Enabled: false
19
-
30
+
20
31
  Style/AndOr:
21
32
  Enabled: false
22
33
 
@@ -16,29 +16,8 @@ before_script:
16
16
 
17
17
  jobs:
18
18
  include:
19
- - stage: minitest
19
+ - stage: test
20
20
  script:
21
21
  - mkdir tmp
22
- - bundle exec rake minitest
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
 
@@ -1,3 +1,27 @@
1
+ # v0.40.0
2
+
3
+ * Parse source code comments into function labels.
4
+
5
+ # v0.39.2
6
+ * Correctly recognize normalized path info for subengines.
7
+
8
+ # v0.39.1
9
+ * Support Ruby 2.7.
10
+ * Remove support for Rails 4.
11
+ * Stop recommending `-t appmap` argument for `rspec`.
12
+
13
+ # v0.39.0
14
+ * Recognize and record `normalized_path_info` in Rails applications, per 1.4 AppMap format version.
15
+
16
+ # v0.38.1
17
+ * Package configuration can be `shallow`, in case which only the initial entry into the package is recorded.
18
+
19
+ # v0.37.2
20
+ * Fix ParameterFilter deprecation warning.
21
+
22
+ # v0.37.1
23
+ * Fix parameter mapping with keyword and rest arguments.
24
+
1
25
  # v0.37.0
2
26
  * Capture method source and comment.
3
27
 
@@ -0,0 +1,22 @@
1
+ # Contributing to appmap-ruby
2
+
3
+ We are incredibly thankful for the contributions we receive from the community. Before contributing, please take a moment to read our [Contributor License Agreement](https://github.com/applandorg/community/blob/master/docs/CLA%20Instructions.pdf) and our [Code of Conduct](https://github.com/applandorg/community/blob/master/docs/Code%20of%20Conduct%20for%20Contributors.pdf).
4
+
5
+ ## Contributor License Agreement
6
+ We require our external contributors to sign a Contributor License Agreement ("CLA") in order to ensure that
7
+ our projects remain licensed under Free and Open Source licenses such as while allowing
8
+ Appland to build a sustainable business.
9
+
10
+ AppLand is committed to having a true Free and Open Source Software license for our
11
+ non-commercial software. A CLA enables AppLand to safely commercialize our products while
12
+ keeping a standard FOSS license with all the rights that license grants to users.
13
+
14
+ * [Contributor License Agreement](https://github.com/applandorg/community/blob/master/docs/CLA%20Instructions.pdf)
15
+
16
+
17
+ ## Code of Conduct
18
+
19
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and
20
+ healthy community.
21
+
22
+ * [Code of Conduct](https://github.com/applandorg/community/blob/master/docs/Code%20of%20Conduct%20for%20Contributors.pdf)
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
 
2
2
  - [About](#about)
3
+ - [Supported versions](#supported-versions)
3
4
  - [Installation](#installation)
4
5
  - [Configuration](#configuration)
6
+ - [Labels](#labels)
5
7
  - [Running](#running)
6
8
  - [RSpec](#rspec)
7
9
  - [Minitest](#minitest)
8
10
  - [Cucumber](#cucumber)
9
11
  - [Remote recording](#remote-recording)
10
- - [Ruby on Rails](#ruby-on-rails)
12
+ - [AppMap for VSCode](#appmap-for-vscode)
11
13
  - [Uploading AppMaps](#uploading-appmaps)
12
14
  - [Development](#development)
13
15
  - [Running tests](#running-tests)
@@ -23,33 +25,35 @@
23
25
  "AppMap" is a data format which records code structure (modules, classes, and methods), code execution events
24
26
  (function calls and returns), and code metadata (repo name, repo URL, commit
25
27
  SHA, labels, etc). It's more granular than a performance profile, but it's less
26
- granular than a full debug trace. It's designed to be optimal for understanding the design intent and behavior of code.
28
+ granular than a full debug trace. It's designed to be optimal for understanding the design intent and structure of code and key data flows.
27
29
 
28
30
  There are several ways to record AppMaps of your Ruby program using the `appmap` gem:
29
31
 
30
- * Run your RSpec tests with the environment variable `APPMAP=true`. An AppMap will be generated for each spec.
32
+ * Run your tests (RSpec, Minitest, Cucumber) with the environment variable `APPMAP=true`. An AppMap will be generated for each spec.
31
33
  * Run your application server with AppMap remote recording enabled, and use the [AppLand
32
34
  browser extension](https://github.com/applandinc/appland-browser-extension) to start,
33
35
  stop, and upload recordings.
34
- * Run the command `appmap record <program>` to record the entire execution of a program.
36
+ * Wrap some code in an `AppMap.record` block, which returns JSON containing the code execution trace.
35
37
 
36
- Once you have recorded some AppMaps (for example, by running RSpec tests), you use the `appland upload` command
37
- to upload them to the AppLand server. This command, and some others, is provided
38
- by the [AppLand CLI](https://github.com/applandinc/appland-cli/releases).
39
- Then, on the [AppLand website](https://app.land), you can
40
- visualize the design of your code and share links with collaborators.
38
+ Once you have made a recording, there are two ways to view automatically generated diagrams of the AppMaps.
41
39
 
42
- # Installation
40
+ The first option is to load the diagrams directly in your IDE, using the [AppMap extension for VSCode](https://marketplace.visualstudio.com/items?itemName=appland.appmap).
43
41
 
44
- Add `gem 'appmap'` to your Gemfile just as you would any other dependency.
42
+ The second option is to upload them to the [AppLand server](https://app.land) using the [AppLand CLI](https://github.com/applandinc/appland-cli/releases).
45
43
 
46
- **Global installation**
44
+ ### Supported versions
47
45
 
48
- ```
49
- gem 'appmap'
50
- ```
46
+ * Ruby 2.5, 2.6, 2.7
47
+ * Rails 5, 6
48
+
49
+ Support for new versions is added frequently, please check back regularly for updates.
50
+
51
+ # Installation
51
52
 
52
- **Install in test, development groups**
53
+ <a href="https://www.loom.com/share/78ab32a312ff4b85aa8827a37f1cb655"> <p>Quick and easy setup of the AppMap gem for Rails - Watch Video</p> <img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/78ab32a312ff4b85aa8827a37f1cb655-with-play.gif"> </a>
54
+
55
+
56
+ Add `gem 'appmap'` to your Gemfile just as you would any other dependency. We recommend that the Gem be added to the `:development, :test` section.
53
57
 
54
58
  ```
55
59
  group :development, :test do
@@ -65,7 +69,8 @@ If you are using Ruby on Rails, require the railtie after Rails is loaded.
65
69
 
66
70
  ```
67
71
  # application.rb is a good place to do this, along with all the other railties.
68
- require 'appmap/railtie'
72
+ # Don't require the railtie in environments that don't bundle the appmap gem.
73
+ require 'appmap/railtie' if defined?(AppMap).
69
74
  ```
70
75
 
71
76
  # Configuration
@@ -78,7 +83,14 @@ name: MyProject
78
83
  packages:
79
84
  - path: app/controllers
80
85
  - path: app/models
86
+ - path: app/jobs
87
+ - path: app/helpers
88
+ # Include the gems that you want to see in the dependency maps.
89
+ # These are just examples.
81
90
  - gem: activerecord
91
+ - gem: devise
92
+ - gem: aws-sdk
93
+ - gem: will_paginate
82
94
  ```
83
95
 
84
96
  * **name** Provides the project name (required)
@@ -93,6 +105,37 @@ Each entry in the `packages` list is a YAML object which has the following keys:
93
105
  * **gem** As an alternative to specifying the path, specify the name of a dependency gem. When using `gem`, don't specify `path`.
94
106
  * **exclude** A list of files and directories which will be ignored. By default, all modules, classes and public
95
107
  functions are inspected.
108
+ * **shallow** When set to `true`, only the first function call entry into a package will be recorded. Subsequent function calls within
109
+ the same package are not recorded unless code execution leaves the package and re-enters it. Default: `true` when using `gem`,
110
+ `false` when using `path`.
111
+
112
+ # Labels
113
+
114
+ The [AppMap data format](https://github.com/applandinc/appmap) provides for class and function `labels`, which can be used to enhance the AppMap visualizations, and to programatically analyze the data.
115
+
116
+ You can apply function labels using source code comments in your Ruby code. To apply a labels to a function, add a `@label` or `@labels` line to the comment which immediately precedes a function.
117
+
118
+ For example, if you add this comment to your source code:
119
+
120
+ ```ruby
121
+ class ApiKey
122
+ # @labels provider.authentication security
123
+ def authenticate(key)
124
+ # logic to verify the key here...
125
+ end
126
+ end
127
+ ```
128
+
129
+ Then the AppMap metadata section for this function will include:
130
+
131
+ ```json
132
+ {
133
+ "name": "authenticate",
134
+ "type": "function",
135
+ "labels": [ "provider.authentication", "security" ]
136
+ }
137
+ ```
138
+
96
139
 
97
140
  # Running
98
141
 
@@ -119,13 +162,10 @@ require 'appmap/rspec'
119
162
  require File.expand_path("../../config/environment", __FILE__)
120
163
  ```
121
164
 
122
- 2) *Optional* Add `feature: '<feature name>'` and `feature_group: '<feature group name>'` annotations to your
123
- examples.
124
-
125
- 3) Run the tests with the environment variable `APPMAP=true`:
165
+ 2) Run the tests with the environment variable `APPMAP=true`:
126
166
 
127
167
  ```sh-session
128
- $ APPMAP=true bundle exec rspec -t appmap
168
+ $ APPMAP=true bundle exec rspec
129
169
  ```
130
170
 
131
171
  Each RSpec test will output an AppMap file into the directory `tmp/appmap/rspec`. For example:
@@ -135,23 +175,6 @@ $ find tmp/appmap/rspec
135
175
  Hello_says_hello_when_prompted.appmap.json
136
176
  ```
137
177
 
138
- If you include the `feature` and `feature_group` metadata, these attributes will be exported to the AppMap file in the
139
- `metadata` section. It will look something like this:
140
-
141
- ```json
142
- {
143
- ...
144
- "metadata": {
145
- "name": "Hello app says hello when prompted",
146
- "feature": "Hello app says hello",
147
- "feature_group": "Hello"
148
- },
149
- ...
150
- }
151
- ```
152
-
153
- If you don't explicitly declare `feature` and `feature_group`, then they will be inferred from the spec name and example descriptions.
154
-
155
178
  ## Minitest
156
179
 
157
180
  To record Minitest tests, follow these additional steps:
@@ -168,17 +191,23 @@ Note that `test_helper.rb` in a Rails project typically loads the application's
168
191
  require_relative '../config/environment'
169
192
  ```
170
193
 
171
- and `appmap/rspec` must be required before this:
194
+ and `appmap/minitest` must be required before this:
172
195
 
173
196
  ```ruby
174
- require 'appmap/rspec'
197
+ require 'appmap/minitest'
175
198
  require_relative '../config/environment'
176
199
  ```
177
200
 
178
- 2) Run the tests with the environment variable `APPMAP=true`:
201
+ 2) Run your tests as you normally would with the environment variable `APPMAP=true`. For example:
179
202
 
180
- ```sh-session
181
- $ APPMAP=true bundle exec -Ilib -Itest test/*
203
+ ```
204
+ $ APPMAP=true bundle exec rake test
205
+ ```
206
+
207
+ or
208
+
209
+ ```
210
+ $ APPMAP=true bundle exec ruby -Ilib -Itest test/*_test.rb
182
211
  ```
183
212
 
184
213
  Each Minitest test will output an AppMap file into the directory `tmp/appmap/minitest`. For example:
@@ -235,9 +264,9 @@ To manually record ad-hoc AppMaps of your Ruby app, use AppMap remote recording.
235
264
  1. Add the AppMap remote recording middleware. For example, in `config/initializers/appmap_remote_recording.rb`:
236
265
 
237
266
  ```ruby
238
- require 'appmap/middleware/remote_recording'
267
+ if defined?(AppMap)
268
+ require 'appmap/middleware/remote_recording'
239
269
 
240
- unless Rails.env.test?
241
270
  Rails.application.config.middleware.insert_after \
242
271
  Rails::Rack::Logger,
243
272
  AppMap::Middleware::RemoteRecording
@@ -258,14 +287,14 @@ $ bundle exec rails server
258
287
 
259
288
  6. Open the AppLand browser extension and push `Stop`. The recording will be transferred to the AppLand website and opened in your browser.
260
289
 
261
- ## Ruby on Rails
290
+ # AppMap for VSCode
262
291
 
263
- If your app uses Ruby on Rails, the AppMap Railtie will be automatically enabled. Set the Rails config flag `app.config.appmap.enabled = true` to record the entire execution of your Rails app.
264
-
265
- Note that using this method is kind of a blunt instrument. Recording RSpecs and using Remote Recording are usually better options.
292
+ The [AppMap extension for VSCode](https://marketplace.visualstudio.com/items?itemName=appland.appmap) is a great way to onboard developers to new code, and troubleshoot hard-to-understand bugs with visuals.
266
293
 
267
294
  # Uploading AppMaps
268
295
 
296
+ [https://app.land](https://app.land) can be used to store, analyze, and share AppMaps.
297
+
269
298
  For instructions on uploading, see the documentation of the [AppLand CLI](https://github.com/applandinc/appland-cli).
270
299
 
271
300
  # Development
data/Rakefile CHANGED
@@ -18,12 +18,12 @@ namespace 'gem' do
18
18
  require 'bundler/gem_tasks'
19
19
  end
20
20
 
21
- RUBY_VERSIONS=%w[2.5 2.6]
22
- FIXTURE_APPS=%w[rack_users_app rails_users_app rails4_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]
23
23
 
24
24
  def run_cmd(*cmd)
25
25
  $stderr.puts "Running: #{cmd}"
26
- out,s = Open3.capture2e(*cmd)
26
+ out, s = Open3.capture2e(*cmd)
27
27
  unless s.success?
28
28
  $stderr.puts <<-END
29
29
  Command failed:
@@ -113,17 +113,18 @@ module AppMap
113
113
  [ method.defined_class, static ? '.' : '#', method.name ].join
114
114
  end
115
115
 
116
+ source, comment = begin
117
+ [ method.source, method.comment ]
118
+ rescue MethodSource::SourceNotFoundError
119
+ [ nil, nil, ]
120
+ end
121
+
116
122
  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
123
+ function_info[:source] = source unless source.blank?
124
+ function_info[:comment] = comment unless comment.blank?
124
125
  end
125
126
 
126
- function_info[:labels] = package.labels if package.labels
127
+ function_info[:labels] = parse_labels(comment) + (package.labels || [])
127
128
  object_infos << function_info
128
129
 
129
130
  parent = root
@@ -141,6 +142,22 @@ module AppMap
141
142
  end
142
143
  end
143
144
 
145
+ # Labels can be embedded in the function comment. Label format is similar to YARD and JavaDoc.
146
+ # The keyword is @labels or @label. The keyword is followed by space-separated labels.
147
+ # For example:
148
+ # @label provider.authentication security
149
+ def parse_labels(comment)
150
+ return [] unless comment
151
+
152
+ comment
153
+ .split("\n")
154
+ .map { |line| line.match(/^\s*#\s*@labels?\s+(.*)/) }
155
+ .compact
156
+ .map { |match| match[1] }
157
+ .inject([]) { |accum, labels| accum += labels.split(/\s+/); accum }
158
+ .sort
159
+ end
160
+
144
161
  def find_or_create(list, info)
145
162
  obj = list.find { |item| item.type == info[:type] && item.name == info[:name] }
146
163
  return obj if obj
@@ -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
- Package.build_from_gem(gem, exclude: package['exclude'] || [])
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