appmap 0.31.0

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.
Files changed (259) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +5 -0
  3. data/.gitignore +17 -0
  4. data/.rubocop.yml +27 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +44 -0
  7. data/CHANGELOG.md +199 -0
  8. data/Dockerfile.appmap +5 -0
  9. data/Gemfile +5 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +300 -0
  12. data/Rakefile +132 -0
  13. data/appmap.gemspec +44 -0
  14. data/appmap.yml +8 -0
  15. data/examples/install.rb +76 -0
  16. data/examples/mock_webapp/Gemfile +1 -0
  17. data/examples/mock_webapp/appmap.yml +2 -0
  18. data/examples/mock_webapp/exe/mock_webapp_request +12 -0
  19. data/examples/mock_webapp/lib/mock_webapp/controller.rb +23 -0
  20. data/examples/mock_webapp/lib/mock_webapp/request.rb +12 -0
  21. data/examples/mock_webapp/lib/mock_webapp/user.rb +18 -0
  22. data/exe/appmap +154 -0
  23. data/lib/appmap.rb +87 -0
  24. data/lib/appmap/algorithm/prune_class_map.rb +67 -0
  25. data/lib/appmap/algorithm/stats.rb +91 -0
  26. data/lib/appmap/class_map.rb +135 -0
  27. data/lib/appmap/command/record.rb +38 -0
  28. data/lib/appmap/command/stats.rb +14 -0
  29. data/lib/appmap/config.rb +91 -0
  30. data/lib/appmap/cucumber.rb +89 -0
  31. data/lib/appmap/event.rb +168 -0
  32. data/lib/appmap/hook.rb +130 -0
  33. data/lib/appmap/metadata.rb +62 -0
  34. data/lib/appmap/middleware/remote_recording.rb +114 -0
  35. data/lib/appmap/minitest.rb +141 -0
  36. data/lib/appmap/rails/action_handler.rb +91 -0
  37. data/lib/appmap/rails/sql_handler.rb +145 -0
  38. data/lib/appmap/railtie.rb +45 -0
  39. data/lib/appmap/record.rb +27 -0
  40. data/lib/appmap/rspec.rb +301 -0
  41. data/lib/appmap/trace.rb +96 -0
  42. data/lib/appmap/util.rb +40 -0
  43. data/lib/appmap/version.rb +9 -0
  44. data/lore/pages/2019-05-21-install-and-record/index.pug +51 -0
  45. data/lore/pages/2019-05-21-install-and-record/install_example_appmap.png +0 -0
  46. data/lore/pages/2019-05-21-install-and-record/metadata.yml +5 -0
  47. data/lore/pages/layout.pug +66 -0
  48. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css +1912 -0
  49. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css.map +1 -0
  50. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css +7 -0
  51. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css.map +1 -0
  52. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css +331 -0
  53. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css.map +1 -0
  54. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css +8 -0
  55. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css.map +1 -0
  56. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.css +9030 -0
  57. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.css.map +1 -0
  58. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css +7 -0
  59. data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css.map +1 -0
  60. data/lore/public/stylesheets/style.css +8 -0
  61. data/package-lock.json +1064 -0
  62. data/package.json +24 -0
  63. data/spec/abstract_controller4_base_spec.rb +67 -0
  64. data/spec/abstract_controller_base_spec.rb +72 -0
  65. data/spec/config_spec.rb +25 -0
  66. data/spec/fixtures/hook/attr_accessor.rb +5 -0
  67. data/spec/fixtures/hook/compare.rb +7 -0
  68. data/spec/fixtures/hook/constructor.rb +7 -0
  69. data/spec/fixtures/hook/exception_method.rb +11 -0
  70. data/spec/fixtures/hook/instance_method.rb +23 -0
  71. data/spec/fixtures/hook/openssl_sign.rb +87 -0
  72. data/spec/fixtures/hook/singleton_method.rb +54 -0
  73. data/spec/fixtures/rack_users_app/.dockerignore +2 -0
  74. data/spec/fixtures/rack_users_app/.gitignore +2 -0
  75. data/spec/fixtures/rack_users_app/Dockerfile +32 -0
  76. data/spec/fixtures/rack_users_app/Gemfile +10 -0
  77. data/spec/fixtures/rack_users_app/appmap.yml +3 -0
  78. data/spec/fixtures/rack_users_app/config.ru +2 -0
  79. data/spec/fixtures/rack_users_app/docker-compose.yml +9 -0
  80. data/spec/fixtures/rack_users_app/lib/app.rb +36 -0
  81. data/spec/fixtures/rails4_users_app/.gitignore +13 -0
  82. data/spec/fixtures/rails4_users_app/.rbenv-gemsets +2 -0
  83. data/spec/fixtures/rails4_users_app/.ruby-version +1 -0
  84. data/spec/fixtures/rails4_users_app/Dockerfile +30 -0
  85. data/spec/fixtures/rails4_users_app/Dockerfile.pg +3 -0
  86. data/spec/fixtures/rails4_users_app/Gemfile +77 -0
  87. data/spec/fixtures/rails4_users_app/README.rdoc +28 -0
  88. data/spec/fixtures/rails4_users_app/Rakefile +6 -0
  89. data/spec/fixtures/rails4_users_app/app/assets/images/.keep +0 -0
  90. data/spec/fixtures/rails4_users_app/app/assets/javascripts/application.js +16 -0
  91. data/spec/fixtures/rails4_users_app/app/assets/stylesheets/application.css +15 -0
  92. data/spec/fixtures/rails4_users_app/app/controllers/api/users_controller.rb +27 -0
  93. data/spec/fixtures/rails4_users_app/app/controllers/application_controller.rb +5 -0
  94. data/spec/fixtures/rails4_users_app/app/controllers/concerns/.keep +0 -0
  95. data/spec/fixtures/rails4_users_app/app/controllers/health_controller.rb +5 -0
  96. data/spec/fixtures/rails4_users_app/app/controllers/users_controller.rb +5 -0
  97. data/spec/fixtures/rails4_users_app/app/helpers/application_helper.rb +2 -0
  98. data/spec/fixtures/rails4_users_app/app/mailers/.keep +0 -0
  99. data/spec/fixtures/rails4_users_app/app/models/.keep +0 -0
  100. data/spec/fixtures/rails4_users_app/app/models/concerns/.keep +0 -0
  101. data/spec/fixtures/rails4_users_app/app/models/user.rb +18 -0
  102. data/spec/fixtures/rails4_users_app/app/views/layouts/application.html.haml +7 -0
  103. data/spec/fixtures/rails4_users_app/app/views/users/index.html.haml +7 -0
  104. data/spec/fixtures/rails4_users_app/appmap.yml +3 -0
  105. data/spec/fixtures/rails4_users_app/bin/rails +9 -0
  106. data/spec/fixtures/rails4_users_app/bin/setup +29 -0
  107. data/spec/fixtures/rails4_users_app/bin/spring +17 -0
  108. data/spec/fixtures/rails4_users_app/config.ru +4 -0
  109. data/spec/fixtures/rails4_users_app/config/application.rb +26 -0
  110. data/spec/fixtures/rails4_users_app/config/boot.rb +3 -0
  111. data/spec/fixtures/rails4_users_app/config/database.yml +18 -0
  112. data/spec/fixtures/rails4_users_app/config/environment.rb +5 -0
  113. data/spec/fixtures/rails4_users_app/config/environments/development.rb +41 -0
  114. data/spec/fixtures/rails4_users_app/config/environments/production.rb +79 -0
  115. data/spec/fixtures/rails4_users_app/config/environments/test.rb +42 -0
  116. data/spec/fixtures/rails4_users_app/config/initializers/assets.rb +11 -0
  117. data/spec/fixtures/rails4_users_app/config/initializers/backtrace_silencers.rb +7 -0
  118. data/spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb +3 -0
  119. data/spec/fixtures/rails4_users_app/config/initializers/filter_parameter_logging.rb +4 -0
  120. data/spec/fixtures/rails4_users_app/config/initializers/inflections.rb +16 -0
  121. data/spec/fixtures/rails4_users_app/config/initializers/mime_types.rb +4 -0
  122. data/spec/fixtures/rails4_users_app/config/initializers/session_store.rb +3 -0
  123. data/spec/fixtures/rails4_users_app/config/initializers/to_time_preserves_timezone.rb +10 -0
  124. data/spec/fixtures/rails4_users_app/config/initializers/wrap_parameters.rb +14 -0
  125. data/spec/fixtures/rails4_users_app/config/locales/en.yml +23 -0
  126. data/spec/fixtures/rails4_users_app/config/routes.rb +12 -0
  127. data/spec/fixtures/rails4_users_app/config/secrets.yml +22 -0
  128. data/spec/fixtures/rails4_users_app/create_app +23 -0
  129. data/spec/fixtures/rails4_users_app/db/migrate/20191127112304_create_users.rb +10 -0
  130. data/spec/fixtures/rails4_users_app/db/schema.rb +26 -0
  131. data/spec/fixtures/rails4_users_app/db/seeds.rb +7 -0
  132. data/spec/fixtures/rails4_users_app/docker-compose.yml +26 -0
  133. data/spec/fixtures/rails4_users_app/lib/assets/.keep +0 -0
  134. data/spec/fixtures/rails4_users_app/lib/tasks/.keep +0 -0
  135. data/spec/fixtures/rails4_users_app/log/.keep +0 -0
  136. data/spec/fixtures/rails4_users_app/public/404.html +67 -0
  137. data/spec/fixtures/rails4_users_app/public/422.html +67 -0
  138. data/spec/fixtures/rails4_users_app/public/500.html +66 -0
  139. data/spec/fixtures/rails4_users_app/public/favicon.ico +0 -0
  140. data/spec/fixtures/rails4_users_app/public/robots.txt +5 -0
  141. data/spec/fixtures/rails4_users_app/spec/controllers/users_controller_api_spec.rb +49 -0
  142. data/spec/fixtures/rails4_users_app/spec/rails_helper.rb +95 -0
  143. data/spec/fixtures/rails4_users_app/spec/spec_helper.rb +96 -0
  144. data/spec/fixtures/rails4_users_app/test/fixtures/users.yml +9 -0
  145. data/spec/fixtures/rails_users_app/.dockerignore +1 -0
  146. data/spec/fixtures/rails_users_app/.gitignore +39 -0
  147. data/spec/fixtures/rails_users_app/.rspec +1 -0
  148. data/spec/fixtures/rails_users_app/.ruby-version +1 -0
  149. data/spec/fixtures/rails_users_app/Dockerfile +29 -0
  150. data/spec/fixtures/rails_users_app/Dockerfile.pg +3 -0
  151. data/spec/fixtures/rails_users_app/Gemfile +52 -0
  152. data/spec/fixtures/rails_users_app/Rakefile +6 -0
  153. data/spec/fixtures/rails_users_app/app/controllers/api/users_controller.rb +27 -0
  154. data/spec/fixtures/rails_users_app/app/controllers/application_controller.rb +2 -0
  155. data/spec/fixtures/rails_users_app/app/controllers/concerns/.keep +0 -0
  156. data/spec/fixtures/rails_users_app/app/controllers/health_controller.rb +5 -0
  157. data/spec/fixtures/rails_users_app/app/controllers/users_controller.rb +5 -0
  158. data/spec/fixtures/rails_users_app/app/models/activerecord/user.rb +18 -0
  159. data/spec/fixtures/rails_users_app/app/models/concerns/.keep +0 -0
  160. data/spec/fixtures/rails_users_app/app/models/sequel/user.rb +25 -0
  161. data/spec/fixtures/rails_users_app/app/views/layouts/application.html.haml +7 -0
  162. data/spec/fixtures/rails_users_app/app/views/users/index.html.haml +7 -0
  163. data/spec/fixtures/rails_users_app/appmap.yml +3 -0
  164. data/spec/fixtures/rails_users_app/bin/appmap +29 -0
  165. data/spec/fixtures/rails_users_app/bin/byebug +29 -0
  166. data/spec/fixtures/rails_users_app/bin/gli +29 -0
  167. data/spec/fixtures/rails_users_app/bin/htmldiff +29 -0
  168. data/spec/fixtures/rails_users_app/bin/ldiff +29 -0
  169. data/spec/fixtures/rails_users_app/bin/nokogiri +29 -0
  170. data/spec/fixtures/rails_users_app/bin/rackup +29 -0
  171. data/spec/fixtures/rails_users_app/bin/rails +4 -0
  172. data/spec/fixtures/rails_users_app/bin/rake +29 -0
  173. data/spec/fixtures/rails_users_app/bin/rspec +29 -0
  174. data/spec/fixtures/rails_users_app/bin/ruby-parse +29 -0
  175. data/spec/fixtures/rails_users_app/bin/ruby-rewrite +29 -0
  176. data/spec/fixtures/rails_users_app/bin/sequel +29 -0
  177. data/spec/fixtures/rails_users_app/bin/setup +25 -0
  178. data/spec/fixtures/rails_users_app/bin/sprockets +29 -0
  179. data/spec/fixtures/rails_users_app/bin/thor +29 -0
  180. data/spec/fixtures/rails_users_app/bin/update +25 -0
  181. data/spec/fixtures/rails_users_app/config.ru +5 -0
  182. data/spec/fixtures/rails_users_app/config/application.rb +51 -0
  183. data/spec/fixtures/rails_users_app/config/boot.rb +3 -0
  184. data/spec/fixtures/rails_users_app/config/credentials.yml.enc +1 -0
  185. data/spec/fixtures/rails_users_app/config/database.yml +18 -0
  186. data/spec/fixtures/rails_users_app/config/environment.rb +5 -0
  187. data/spec/fixtures/rails_users_app/config/environments/development.rb +40 -0
  188. data/spec/fixtures/rails_users_app/config/environments/production.rb +68 -0
  189. data/spec/fixtures/rails_users_app/config/environments/test.rb +36 -0
  190. data/spec/fixtures/rails_users_app/config/initializers/application_controller_renderer.rb +8 -0
  191. data/spec/fixtures/rails_users_app/config/initializers/backtrace_silencers.rb +7 -0
  192. data/spec/fixtures/rails_users_app/config/initializers/cors.rb +16 -0
  193. data/spec/fixtures/rails_users_app/config/initializers/filter_parameter_logging.rb +4 -0
  194. data/spec/fixtures/rails_users_app/config/initializers/inflections.rb +16 -0
  195. data/spec/fixtures/rails_users_app/config/initializers/mime_types.rb +4 -0
  196. data/spec/fixtures/rails_users_app/config/initializers/record_button.rb +3 -0
  197. data/spec/fixtures/rails_users_app/config/initializers/wrap_parameters.rb +9 -0
  198. data/spec/fixtures/rails_users_app/config/locales/en.yml +33 -0
  199. data/spec/fixtures/rails_users_app/config/routes.rb +11 -0
  200. data/spec/fixtures/rails_users_app/create_app +27 -0
  201. data/spec/fixtures/rails_users_app/db/migrate/20190728211408_create_users.rb +9 -0
  202. data/spec/fixtures/rails_users_app/db/schema.rb +23 -0
  203. data/spec/fixtures/rails_users_app/docker-compose.yml +28 -0
  204. data/spec/fixtures/rails_users_app/features/api_users.feature +13 -0
  205. data/spec/fixtures/rails_users_app/features/support/env.rb +4 -0
  206. data/spec/fixtures/rails_users_app/features/support/hooks.rb +11 -0
  207. data/spec/fixtures/rails_users_app/features/support/steps.rb +18 -0
  208. data/spec/fixtures/rails_users_app/lib/tasks/.keep +0 -0
  209. data/spec/fixtures/rails_users_app/log/.keep +0 -0
  210. data/spec/fixtures/rails_users_app/public/robots.txt +1 -0
  211. data/spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb +29 -0
  212. data/spec/fixtures/rails_users_app/spec/models/user_spec.rb +39 -0
  213. data/spec/fixtures/rails_users_app/spec/rails_helper.rb +66 -0
  214. data/spec/fixtures/rails_users_app/spec/spec_helper.rb +96 -0
  215. data/spec/fixtures/rails_users_app/users_app/.gitignore +20 -0
  216. data/spec/hook_spec.rb +576 -0
  217. data/spec/rails_spec_helper.rb +60 -0
  218. data/spec/railtie_spec.rb +44 -0
  219. data/spec/record_sql_rails4_pg_spec.rb +76 -0
  220. data/spec/record_sql_rails_pg_spec.rb +68 -0
  221. data/spec/remote_recording_spec.rb +117 -0
  222. data/spec/rspec_feature_metadata_spec.rb +32 -0
  223. data/spec/spec_helper.rb +15 -0
  224. data/spec/util_spec.rb +21 -0
  225. data/test/cli_test.rb +116 -0
  226. data/test/cucumber_test.rb +72 -0
  227. data/test/fixtures/cli_record_test/appmap.yml +3 -0
  228. data/test/fixtures/cli_record_test/lib/cli_record_test/main.rb +9 -0
  229. data/test/fixtures/cucumber4_recorder/Gemfile +5 -0
  230. data/test/fixtures/cucumber4_recorder/appmap.yml +3 -0
  231. data/test/fixtures/cucumber4_recorder/features/say_hello.feature +5 -0
  232. data/test/fixtures/cucumber4_recorder/features/support/env.rb +5 -0
  233. data/test/fixtures/cucumber4_recorder/features/support/hooks.rb +11 -0
  234. data/test/fixtures/cucumber4_recorder/features/support/steps.rb +9 -0
  235. data/test/fixtures/cucumber4_recorder/lib/hello.rb +7 -0
  236. data/test/fixtures/cucumber_recorder/Gemfile +5 -0
  237. data/test/fixtures/cucumber_recorder/appmap.yml +3 -0
  238. data/test/fixtures/cucumber_recorder/features/say_hello.feature +5 -0
  239. data/test/fixtures/cucumber_recorder/features/support/env.rb +5 -0
  240. data/test/fixtures/cucumber_recorder/features/support/hooks.rb +11 -0
  241. data/test/fixtures/cucumber_recorder/features/support/steps.rb +9 -0
  242. data/test/fixtures/cucumber_recorder/lib/hello.rb +7 -0
  243. data/test/fixtures/minitest_recorder/Gemfile +5 -0
  244. data/test/fixtures/minitest_recorder/appmap.yml +3 -0
  245. data/test/fixtures/minitest_recorder/lib/hello.rb +5 -0
  246. data/test/fixtures/minitest_recorder/test/hello_test.rb +12 -0
  247. data/test/fixtures/process_recorder/appmap.yml +3 -0
  248. data/test/fixtures/process_recorder/hello.rb +9 -0
  249. data/test/fixtures/rspec_recorder/Gemfile +5 -0
  250. data/test/fixtures/rspec_recorder/appmap.yml +3 -0
  251. data/test/fixtures/rspec_recorder/lib/hello.rb +5 -0
  252. data/test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb +21 -0
  253. data/test/fixtures/rspec_recorder/spec/labeled_hello_spec.rb +9 -0
  254. data/test/fixtures/rspec_recorder/spec/plain_hello_spec.rb +9 -0
  255. data/test/minitest_test.rb +38 -0
  256. data/test/record_process_test.rb +35 -0
  257. data/test/rspec_test.rb +82 -0
  258. data/test/test_helper.rb +4 -0
  259. metadata +525 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 54b9a05aeb3eea84572b115a6de1106e6743b74046048e3c168f99a75aa9e669
4
+ data.tar.gz: eb8a690376d833c4bec9f0789c5499f413f7dcb3b1ef111257785bd344861f64
5
+ SHA512:
6
+ metadata.gz: 453f06041220ecd0a4fc563ae007e7f8247d3dfcccf49657cbf47ddc53d0175e6834d1dbd89a2338a032d6cfae866929216b58a11bb6f0fe3fd2ea69508d7b2a
7
+ data.tar.gz: 77f372ad255c3c664c690affa2962958cebd1e8f34579809e4d975fdf57404889d8506f9153d44a95afda297ffe7b1654529252a5293487477e803bdf0cc9608
@@ -0,0 +1,5 @@
1
+ vendor
2
+ node_modules
3
+ spec/fixtures/rails_users_app
4
+ spec/fixtures/rack_users_app
5
+
@@ -0,0 +1,17 @@
1
+ .DS_Store
2
+ /html/
3
+ .bundle
4
+ /.yardoc
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ tmp/
11
+ vendor
12
+ node_modules
13
+ Gemfile.lock
14
+ appmap.json
15
+ .vscode
16
+ .byebug_history
17
+
@@ -0,0 +1,27 @@
1
+ Layout/SpaceInsideArrayLiteralBrackets:
2
+ Enabled: false
3
+
4
+ # We have squiggly heredocs
5
+ Layout/HeredocIndentation:
6
+ Enabled: false
7
+
8
+ Layout/LineLength:
9
+ Max: 120
10
+
11
+ Style/MultilineBlockChain:
12
+ Enabled: false
13
+
14
+ Style/NumericPredicate:
15
+ Enabled: false
16
+
17
+ Style/AndOr:
18
+ Enabled: false
19
+
20
+ Style/HashEachMethods:
21
+ Enabled: true
22
+
23
+ Style/HashTransformKeys:
24
+ Enabled: true
25
+
26
+ Style/HashTransformValues:
27
+ Enabled: true
@@ -0,0 +1 @@
1
+ 2.6.2
@@ -0,0 +1,44 @@
1
+ language: ruby
2
+
3
+ addons:
4
+ apt:
5
+ packages:
6
+ # https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version
7
+ - docker-ce
8
+
9
+ services:
10
+ - docker
11
+
12
+ # We expect RAILS_ENV to start off unset, then adjust its value as
13
+ # necessary.
14
+ before_script:
15
+ - unset RAILS_ENV
16
+
17
+ jobs:
18
+ include:
19
+ - stage: minitest
20
+ script:
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
44
+
@@ -0,0 +1,199 @@
1
+ # v0.31.0
2
+
3
+ * Add the ability to hook methods by default, and optionally add labels to them in the
4
+ classmap. Use it to hook `ActiveSupport::SecurityUtils.secure_compare`.
5
+
6
+ # v0.30.0
7
+
8
+ * Add support for Minitest.
9
+
10
+ # v0.29.0
11
+
12
+ * Add `lib/appmap/record.rb`, which can be `require`d to record the rest of the process.
13
+
14
+ # v0.28.1
15
+
16
+ * Fix the `defined_class` recorded in an appmap for an instance method included in a class
17
+ at runtime.
18
+ * Only include the `static` attribute on `call` events in an appmap. Determine its value
19
+ based on the receiver of the method call.
20
+
21
+ # v0.28.0
22
+
23
+ * Change behavior of **AppMap.record** to return a complete AppMap as a Hash.
24
+ * Update README with information about recording Cucumber tests.
25
+ * **AppMap.initialize** automatically runs when `AppMap` is required, unless disabled
26
+ by environment variable `APPMAP_INITIALIZE=false`.
27
+ * **AppMap.hook** no longer takes a `configuration` argument.
28
+ * Add **AppMap::Util.scenario_filename**.
29
+
30
+ # v0.27.0
31
+
32
+ * Add **AppMap.record** to programatically record and capture an AppMap of a Ruby block.
33
+
34
+ # v0.26.1
35
+
36
+ * Fix a bug that caused duplicate entries in the list of frameworks that appear
37
+ in the `metadata` section of an appmap.
38
+
39
+ # v0.26.0
40
+
41
+ * **appmap upload** is removed. Upload functionality has been moved to
42
+ the [AppLand CLI](https://github.com/applandinc/appland-cli).
43
+
44
+ # v0.25.2
45
+
46
+ * Stop checking a whitelist to see if each SQL query should be recorded. Record
47
+ all queries.
48
+
49
+ # v0.25.1
50
+
51
+ * Ensure that caught exceptions are re-raised.
52
+ * Add safety around indexing potentially nil backtrace locations.
53
+
54
+ # v0.25.0
55
+
56
+ * Reports `exceptions` in [function return attributes](https://github.com/applandinc/appmap#function-return-attributes).
57
+
58
+ # v0.24.1
59
+ * Fixes an issue which prevented a remote recording from returning scenario data successfully.
60
+ * Remote recording routes now return descriptive status codes as intended.
61
+ * Remote recording routes now have the correct `Content-Type` header.
62
+
63
+ # v0.24.0
64
+
65
+ Internals of `appmap-ruby` have been changed to record each method event using `alias_method`,
66
+ rather than `TracePoint`. Performance is much better as a result.
67
+
68
+ **WARNING** Breaking changes
69
+
70
+ * **Rack** apps no longer generate `http_server_request` events.
71
+ * **appmap inspect** has been removed. `appmap-ruby` no longer parses the source tree. Instead, it observes the methods as they are loaded by the VM. So, to get a class map, you have to create a recording. The `RSpec` recorder still prints an inventory to `Inventory.appmap.json` when it exits. The class map in this file contains every class and method which was loaded by any of the tests.
72
+
73
+ # v0.23.0
74
+
75
+ * **appmap stats** command added.
76
+
77
+ # v0.22.0
78
+
79
+ * **RSpec** recorder generates an "inventory" (AppMap with classMap, without events) named `Inventory.appmap.json`.
80
+ * **appmap inspect** generates an inventory AppMap which includes `version`, `metadata`, and `classMap`. Previously, the file output by this command was the class map represented as an array.
81
+
82
+ # v0.21.0
83
+
84
+ * Scenario data includes `recorder` and `client` info, describing how the data was recorded.
85
+
86
+ # v0.20.0
87
+
88
+ Updated to [AppMap file format](https://github.com/applandinc/appmap) version 1.2.
89
+
90
+ * **Event `message`** is now an array of parameter objects.
91
+ * The value of each `appmap:` tags in an RSpec is recorded as a `label` in the AppMap file metadata.
92
+ * `layout` is removed from AppMap file metadata.
93
+
94
+ # v0.19.0
95
+
96
+ * **RSpec** feature and feature group names can be inferred from example group and example names.
97
+ * Stop using `ActiveSupport::Inflector.transliterate`, since it can cause exceptions.
98
+ * Handle StandardError which occurs while calling `#inspect` of an object.
99
+
100
+ # v0.18.1
101
+
102
+ * Now tested with Rails 4, 5, and 6.
103
+ * Now tested with Ruby 2.5 and 2.6.
104
+ * `explain_sql` is no longer collected.
105
+ * `appmap/railtie` is automatically required when running in a Rails environment.
106
+
107
+ # v0.17.0
108
+
109
+ **WARNING** Breaking changes
110
+
111
+ * **appmap upload** expects arguments `user` and `org`.
112
+ * **appmap upload** receives and retransmits the scenario batch id
113
+ * assigned by the server.
114
+
115
+ # v0.16.0
116
+
117
+ **WARNING** Breaking changes
118
+
119
+ * **Record button** removed. Frontend interactions are now recorded with a browser extension.
120
+ As a result, `AppMap::Middleware::RecordButton` has been renamed to
121
+ `AppMap::Middleware::RemoteRecording`
122
+
123
+ # v0.15.1
124
+
125
+ * **Record button** moved to the bottom of the window.
126
+
127
+ # v0.15.0
128
+
129
+ **WARNING** Breaking changes
130
+
131
+ * **AppMap version** updated to 1.1
132
+ * **Event `parameters`** are reported as an array rather than a map, so that parameter order is preserved.
133
+ * **Event `receiver`** reports the `receiver/this/self` parameter of each method call.
134
+
135
+ # v0.14.1
136
+
137
+ * **RSpec recorder** won't try to modify a frozen string.
138
+
139
+ # v0.14.0
140
+
141
+ * **SQL queries** are reported for SQLite.
142
+
143
+ # v0.13.0
144
+
145
+ * **SQL queries** are reported for ActiveRecord.
146
+
147
+ # v0.12.0
148
+
149
+ * **Record button** integrates into any HTML UI and provides a button to record and upload AppMaps.
150
+
151
+ # v0.11.0
152
+
153
+ * Information about `language` and `frameworks` is provided in the AppMap `metadata`.
154
+
155
+ # v0.10.0
156
+
157
+ * **`AppMap::Algorithm::PruneClassMap`** prunes a class map so that only functions, classes and packages which are
158
+ referenced by some event are retained.
159
+
160
+ # v0.9.0
161
+
162
+ * **`appmap/rspec`** only records trace events which happen during an example block. `before` and `after` events are
163
+ excluded from the AppMap.
164
+ * **`appmap/rspec`** exports `feature` and `feature_group` attributes to the AppMap `metadata`
165
+ section.
166
+
167
+ # v0.8.0
168
+
169
+ * **`appmap upload`** accepts multiple arguments, to upload multiple files in one command.
170
+
171
+ # v0.7.0
172
+
173
+ * **`appmap/railtie`** is provided to integrate AppMap recording into Rails apps.
174
+ * Use `gem :appmap, require: %w[appmap appmap/railtie]` to activate.
175
+ * Set Rails configuration setting `config.appmap.enabled = true` to enable recording of the app via the Railtie, and
176
+ to enable recording of RSpec tests via `appmap/rspec`.
177
+ * In a non-Rails environment, set `APPMAP=true` to to enable recording of RSpec tests.
178
+ * **SQL queries** are reported as AppMap event `sql_query` data.
179
+ * **`self` attribute** is removed from `call` events.
180
+
181
+ # v0.6.0
182
+
183
+ * **Web server requests and responses** through WEBrick are reported as AppMap event `http_server_request` data.
184
+ * **Rails `params` hash** is reported as an AppMap event `message` data.
185
+ * **Rails `request`** is reported as an AppMap event `http_server_request` data.
186
+
187
+ # v0.5.1
188
+
189
+ * **RSpec** test recorder is added.
190
+
191
+ # v0.5.0
192
+
193
+ * **'inspect', 'record' and 'upload' commands** are converted into a unified 'appmap' command with subcommands.
194
+ * **Config file name** is changed from .appmap.yml to appmap.yml.
195
+ * **`appmap.yml`** configuration format is updated.
196
+
197
+ # v0.4.0
198
+
199
+ Initial release.
@@ -0,0 +1,5 @@
1
+ FROM alpine
2
+ ARG GEM_VERSION
3
+
4
+ RUN mkdir /pkg
5
+ COPY pkg/appmap-${GEM_VERSION}.gem /pkg/appmap.gem
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Kevin Gilpin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,300 @@
1
+ - [About](#about)
2
+ - [Installation](#installation)
3
+ - [Configuration](#configuration)
4
+ - [Running](#running)
5
+ - [RSpec](#rspec)
6
+ - [Minitest](#minitest)
7
+ - [Cucumber](#cucumber)
8
+ - [Remote recording](#remote-recording)
9
+ - [Ruby on Rails](#ruby-on-rails)
10
+ - [Uploading AppMaps](#uploading-appmaps)
11
+ - [Development](#development)
12
+ - [Running tests](#running-tests)
13
+ - [Using fixture apps](#using-fixture-apps)
14
+ - [`test/fixtures`](#testfixtures)
15
+ - [`spec/fixtures`](#specfixtures)
16
+ - [Build status](#build-status)
17
+
18
+ # About
19
+
20
+ `appmap-ruby` is a Ruby Gem for recording
21
+ [AppMaps](https://github.com/applandinc/appmap) of your code.
22
+ "AppMap" is a data format which records code structure (modules, classes, and methods), code execution events
23
+ (function calls and returns), and code metadata (repo name, repo URL, commit
24
+ SHA, labels, etc). It's more granular than a performance profile, but it's less
25
+ granular than a full debug trace. It's designed to be optimal for understanding the design intent and behavior of code.
26
+
27
+ There are several ways to record AppMaps of your Ruby program using the `appmap` gem:
28
+
29
+ * 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 AppMap.
31
+ browser extension to start, stop, and upload recordings.
32
+ * Run the command `appmap record <program>` to record the entire execution of a program.
33
+
34
+ Once you have recorded some AppMaps (for example, by running RSpec tests), you use the `appland upload` command
35
+ to upload them to the AppLand server. This command, and some others, is provided
36
+ by the [AppLand CLI](https://github.com/applandinc/appland-cli/releases), to
37
+ Then, on the [AppLand website](https://app.land), you can
38
+ visualize the design of your code and share links with collaborators.
39
+
40
+ # Installation
41
+
42
+ Add `gem 'appmap'` to your Gemfile just as you would any other dependency.
43
+
44
+ **Global installation**
45
+
46
+ ```
47
+ gem 'appmap'
48
+ ```
49
+
50
+ **Install in test, development groups**
51
+
52
+ ```
53
+ group :development, :test do
54
+ gem 'appmap'
55
+ end
56
+ ```
57
+
58
+ Then install with `bundle`.
59
+
60
+ # Configuration
61
+
62
+ When you run your program, the `appmap` gem reads configuration settings from `appmap.yml`. Here's a sample configuration
63
+ file for a typical Rails project:
64
+
65
+ ```yaml
66
+ name: MyProject
67
+ packages:
68
+ - path: app/controllers
69
+ - path: app/models
70
+ ```
71
+
72
+ * **name** Provides the project name (required)
73
+ * **packages** A list of source code directories which should be instrumented.
74
+
75
+ **packages**
76
+
77
+ Each entry in the `packages` list is a YAML object which has the following keys:
78
+
79
+ * **path** The path to the source code directory. The path may be relative to the current working directory, or it may
80
+ be an absolute path.
81
+ * **exclude** A list of files and directories which will be ignored. By default, all modules, classes and public
82
+ functions are inspected.
83
+
84
+ # Running
85
+
86
+ ## RSpec
87
+
88
+ To record RSpec tests, follow these additional steps:
89
+
90
+ 1) Require `appmap/rspec` in your `spec_helper.rb`.
91
+
92
+ ```ruby
93
+ require 'appmap/rspec'
94
+ ```
95
+
96
+ 2) *Optional* Add `feature: '<feature name>'` and `feature_group: '<feature group name>'` annotations to your
97
+ examples.
98
+
99
+ 3) Run the tests with the environment variable `APPMAP=true`:
100
+
101
+ ```sh-session
102
+ $ APPMAP=true bundle exec rspec -t appmap
103
+ ```
104
+
105
+ Each RSpec test will output an AppMap file into the directory `tmp/appmap/rspec`. For example:
106
+
107
+ ```
108
+ $ find tmp/appmap/rspec
109
+ Hello_says_hello_when_prompted.appmap.json
110
+ ```
111
+
112
+ If you include the `feature` and `feature_group` metadata, these attributes will be exported to the AppMap file in the
113
+ `metadata` section. It will look something like this:
114
+
115
+ ```json
116
+ {
117
+ ...
118
+ "metadata": {
119
+ "name": "Hello app says hello when prompted",
120
+ "feature": "Hello app says hello",
121
+ "feature_group": "Hello"
122
+ },
123
+ ...
124
+ }
125
+ ```
126
+
127
+ If you don't explicitly declare `feature` and `feature_group`, then they will be inferred from the spec name and example descriptions.
128
+
129
+ ## Minitest
130
+
131
+ To record Minitest tests, follow these additional steps:
132
+
133
+ 1) Require `appmap/minitest` in `test_helper.rb`
134
+
135
+ ```ruby
136
+ require 'appmap/minitest'
137
+ ```
138
+
139
+ 2) Run the tests with the environment variable `APPMAP=true`:
140
+
141
+ ```sh-session
142
+ $ APPMAP=true bundle exec -Ilib -Itest test/*
143
+ ```
144
+
145
+ Each Minitest test will output an AppMap file into the directory `tmp/appmap/minitest`. For example:
146
+
147
+ ```
148
+ $ find tmp/appmap/minitest
149
+ Hello_says_hello_when_prompted.appmap.json
150
+ ```
151
+
152
+ ## Cucumber
153
+
154
+ To record Cucumber tests, follow these additional steps:
155
+
156
+ 1) Require `appmap/cucumber` in `support/env.rb`:
157
+
158
+ ```ruby
159
+ require 'appmap/cucumber'
160
+ ```
161
+
162
+ 2) Create an `Around` hook in `support/hooks.rb` to record the scenario:
163
+
164
+
165
+ ```ruby
166
+ if AppMap::Cucumber.enabled?
167
+ Around('not @appmap-disable') do |scenario, block|
168
+ appmap = AppMap.record do
169
+ block.call
170
+ end
171
+
172
+ AppMap::Cucumber.write_scenario(scenario, appmap)
173
+ end
174
+ end
175
+ ```
176
+
177
+ 3) Run the tests with the environment variable `APPMAP=true`:
178
+
179
+ ```sh-session
180
+ $ APPMAP=true bundle exec cucumber
181
+ ```
182
+
183
+ Each Cucumber test will output an AppMap file into the directory `tmp/appmap/cucumber`. For example:
184
+
185
+ ```
186
+ $ find tmp/appmap/cucumber
187
+ Hello_Says_hello_when_prompted.appmap.json
188
+ ```
189
+
190
+ ## Remote recording
191
+
192
+ To manually record ad-hoc AppMaps of your Ruby app, use AppMap remote recording.
193
+
194
+ 1. Add the AppMap remote recording middleware. For example, in `config/initializers/appmap_remote_recording.rb`:
195
+
196
+ ```ruby
197
+ require 'appmap/middleware/remote_recording'
198
+
199
+ unless Rails.env.test?
200
+ Rails.application.config.middleware.insert_after \
201
+ Rails::Rack::Logger,
202
+ AppMap::Middleware::RemoteRecording
203
+ end
204
+ ```
205
+
206
+ 2. Download and unpack the [AppLand browser extension](https://github.com/applandinc/appland-browser-extension). Install into Chrome using `chrome://extensions/`. Turn on "Developer Mode" and then load the extension using the "Load unpacked" button.
207
+
208
+ 3. Start your Rails application server. For example:
209
+
210
+ ```sh-session
211
+ $ bundle exec rails server
212
+ ```
213
+
214
+ 4. Open the AppApp browser extension and push `Start`.
215
+
216
+ 5. Use your app. For example, perform a login flow, or run through a manual UI test.
217
+
218
+ 6. Open the AppApp browser extension and push `Stop`. The recording will be transferred to the AppLand website and opened in your browser.
219
+
220
+ ## Ruby on Rails
221
+
222
+ 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.
223
+
224
+ Note that using this method is kind of a blunt instrument. Recording RSpecs and using Remote Recording are usually better options.
225
+
226
+ # Uploading AppMaps
227
+
228
+ For instructions on uploading, see the documentation of the [AppLand CLI](https://github.com/applandinc/appland-cli).
229
+
230
+ # Development
231
+
232
+ ## Running tests
233
+
234
+ Before running tests, configure `local.appmap` to point to your local `appmap-ruby` directory.
235
+ ```
236
+ $ bundle config local.appmap $(pwd)
237
+ ```
238
+
239
+ Run the tests via `rake`:
240
+ ```
241
+ $ bundle exec rake test
242
+ ```
243
+
244
+ ## Using fixture apps
245
+
246
+ ### `test/fixtures`
247
+
248
+ The fixture apps in `test/fixtures` are plain Ruby projects that exercise the basic functionality of the
249
+ `appmap` gem. To develop in a fixture, simple enter the fixture directory and `bundle`.
250
+
251
+ ### `spec/fixtures`
252
+
253
+ The fixture apps in `spec/fixtures` are simple Rack, Rails4, and Rails5 apps.
254
+ You can use them to interactively develop and test the recording features of the `appmap` gem.
255
+ These fixture apps are more sophisticated than `test/fixtures`, because they include additional
256
+ resources such as a PostgreSQL database.
257
+
258
+ To build the fixture container images, first run:
259
+
260
+ ```sh-session
261
+ $ bundle exec rake fixtures:all
262
+ ```
263
+
264
+ This will build the `appmap.gem`, along with a Docker image for each fixture app.
265
+
266
+ Then move to the directory of the fixture you want to use, and provision the environment.
267
+ In this example, we use Ruby 2.6.
268
+
269
+ ```sh-session
270
+ $ export RUBY_VERSION=2.6
271
+ $ docker-compose up -d pg
272
+ $ sleep 10s # Or some reasonable amount of time
273
+ $ docker-compose run --rm app ./create_app
274
+ ```
275
+
276
+ Now you can start a development container.
277
+
278
+ ```sh-session
279
+ $ docker-compose run --rm -v $PWD/../../..:/src/appmap-ruby app bash
280
+ Starting rails_users_app_pg_1 ... done
281
+ root@6fab5f89125f:/app# cd /src/app
282
+ root@6fab5f89125f:/src/app# bundle config local.appmap /src/appmap-ruby
283
+ root@6fab5f89125f:/src/app# bundle update appmap
284
+ ```
285
+
286
+ At this point, the bundle is built with the `appmap` gem located in `/src/appmap`, which is volume-mounted from the host.
287
+ So you can edit the fixture code and the appmap code and run test commands such as `rspec` and `cucumber` in the container.
288
+ For example:
289
+
290
+ ```sh-session
291
+ root@6fab5f89125f:/src/app# bundle exec rspec
292
+ Configuring AppMap from path appmap.yml
293
+ ....
294
+
295
+ Finished in 0.07357 seconds (files took 2.1 seconds to load)
296
+ 4 examples, 0 failures
297
+ ```
298
+
299
+ # Build status
300
+ [![Build Status](https://travis-ci.org/applandinc/appmap-ruby.svg?branch=master)](https://travis-ci.org/applandinc/appmap-ruby)