appmap 0.77.2 → 0.78.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.travis.yml +0 -7
  4. data/CHANGELOG.md +21 -0
  5. data/Rakefile +29 -3
  6. data/ext/appmap/appmap.c +21 -2
  7. data/lib/appmap/builtin_hooks/ruby.yml +6 -3
  8. data/lib/appmap/config.rb +9 -1
  9. data/lib/appmap/handler/eval.rb +41 -0
  10. data/lib/appmap/handler/function.rb +8 -8
  11. data/lib/appmap/handler/net_http.rb +19 -18
  12. data/lib/appmap/handler/rails/request_handler.rb +3 -4
  13. data/lib/appmap/handler/rails/template.rb +68 -62
  14. data/lib/appmap/hook/method/ruby2.rb +56 -0
  15. data/lib/appmap/hook/method/ruby3.rb +56 -0
  16. data/lib/appmap/hook/method.rb +42 -98
  17. data/lib/appmap/hook.rb +2 -2
  18. data/lib/appmap/version.rb +1 -1
  19. data/spec/fixtures/rails7_users_app/.dockerignore +1 -0
  20. data/spec/fixtures/rails7_users_app/.gitattributes +7 -0
  21. data/spec/fixtures/rails7_users_app/.gitignore +31 -0
  22. data/spec/fixtures/rails7_users_app/.rspec +1 -0
  23. data/spec/fixtures/rails7_users_app/.ruby-version +1 -0
  24. data/spec/fixtures/rails7_users_app/Dockerfile +30 -0
  25. data/spec/fixtures/rails7_users_app/Dockerfile.pg +3 -0
  26. data/spec/fixtures/rails7_users_app/Gemfile +99 -0
  27. data/spec/fixtures/rails7_users_app/README.md +24 -0
  28. data/spec/fixtures/rails7_users_app/Rakefile +6 -0
  29. data/spec/fixtures/rails7_users_app/app/assets/config/manifest.js +4 -0
  30. data/spec/fixtures/rails7_users_app/app/assets/images/.keep +0 -0
  31. data/spec/fixtures/rails7_users_app/app/assets/stylesheets/application.css +15 -0
  32. data/spec/fixtures/rails7_users_app/app/channels/application_cable/channel.rb +4 -0
  33. data/spec/fixtures/rails7_users_app/app/channels/application_cable/connection.rb +4 -0
  34. data/spec/fixtures/rails7_users_app/app/controllers/application_controller.rb +2 -0
  35. data/spec/fixtures/rails7_users_app/app/controllers/concerns/.keep +0 -0
  36. data/spec/fixtures/rails7_users_app/app/helpers/application_helper.rb +2 -0
  37. data/spec/fixtures/rails7_users_app/app/javascript/application.js +3 -0
  38. data/spec/fixtures/rails7_users_app/app/javascript/controllers/application.js +9 -0
  39. data/spec/fixtures/rails7_users_app/app/javascript/controllers/hello_controller.js +7 -0
  40. data/spec/fixtures/rails7_users_app/app/javascript/controllers/index.js +11 -0
  41. data/spec/fixtures/rails7_users_app/app/jobs/application_job.rb +7 -0
  42. data/spec/fixtures/rails7_users_app/app/mailers/application_mailer.rb +4 -0
  43. data/spec/fixtures/rails7_users_app/app/models/application_record.rb +3 -0
  44. data/spec/fixtures/rails7_users_app/app/models/concerns/.keep +0 -0
  45. data/spec/fixtures/rails7_users_app/app/models/instance.rb +7 -0
  46. data/spec/fixtures/rails7_users_app/app/models/instructor.rb +7 -0
  47. data/spec/fixtures/rails7_users_app/app/views/layouts/application.html.erb +16 -0
  48. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.html.erb +13 -0
  49. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.text.erb +1 -0
  50. data/spec/fixtures/rails7_users_app/appmap.yml +3 -0
  51. data/spec/fixtures/rails7_users_app/bin/bundle +114 -0
  52. data/spec/fixtures/rails7_users_app/bin/importmap +4 -0
  53. data/spec/fixtures/rails7_users_app/bin/rails +4 -0
  54. data/spec/fixtures/rails7_users_app/bin/rake +4 -0
  55. data/spec/fixtures/rails7_users_app/bin/setup +33 -0
  56. data/spec/fixtures/rails7_users_app/config/application.rb +22 -0
  57. data/spec/fixtures/rails7_users_app/config/boot.rb +4 -0
  58. data/spec/fixtures/rails7_users_app/config/cable.yml +10 -0
  59. data/spec/fixtures/rails7_users_app/config/credentials.yml.enc +1 -0
  60. data/spec/fixtures/rails7_users_app/config/database.yml +86 -0
  61. data/spec/fixtures/rails7_users_app/config/environment.rb +5 -0
  62. data/spec/fixtures/rails7_users_app/config/environments/development.rb +70 -0
  63. data/spec/fixtures/rails7_users_app/config/environments/production.rb +93 -0
  64. data/spec/fixtures/rails7_users_app/config/environments/test.rb +60 -0
  65. data/spec/fixtures/rails7_users_app/config/importmap.rb +7 -0
  66. data/spec/fixtures/rails7_users_app/config/initializers/assets.rb +12 -0
  67. data/spec/fixtures/rails7_users_app/config/initializers/content_security_policy.rb +26 -0
  68. data/spec/fixtures/rails7_users_app/config/initializers/filter_parameter_logging.rb +8 -0
  69. data/spec/fixtures/rails7_users_app/config/initializers/inflections.rb +16 -0
  70. data/spec/fixtures/rails7_users_app/config/initializers/permissions_policy.rb +11 -0
  71. data/spec/fixtures/rails7_users_app/config/locales/en.yml +33 -0
  72. data/spec/fixtures/rails7_users_app/config/puma.rb +43 -0
  73. data/spec/fixtures/rails7_users_app/config/routes.rb +6 -0
  74. data/spec/fixtures/rails7_users_app/config/storage.yml +34 -0
  75. data/spec/fixtures/rails7_users_app/config.ru +6 -0
  76. data/spec/fixtures/rails7_users_app/create_app +31 -0
  77. data/spec/fixtures/rails7_users_app/db/migrate/20220328093141_create_instances.rb +8 -0
  78. data/spec/fixtures/rails7_users_app/db/migrate/20220328093154_create_instructors.rb +8 -0
  79. data/spec/fixtures/rails7_users_app/db/schema.rb +27 -0
  80. data/spec/fixtures/rails7_users_app/db/seeds.rb +7 -0
  81. data/spec/fixtures/rails7_users_app/docker-compose.yml +31 -0
  82. data/spec/fixtures/rails7_users_app/lib/assets/.keep +0 -0
  83. data/spec/fixtures/rails7_users_app/lib/tasks/.keep +0 -0
  84. data/spec/fixtures/rails7_users_app/log/.keep +0 -0
  85. data/spec/fixtures/rails7_users_app/public/404.html +67 -0
  86. data/spec/fixtures/rails7_users_app/public/422.html +67 -0
  87. data/spec/fixtures/rails7_users_app/public/500.html +66 -0
  88. data/spec/fixtures/rails7_users_app/public/apple-touch-icon-precomposed.png +0 -0
  89. data/spec/fixtures/rails7_users_app/public/apple-touch-icon.png +0 -0
  90. data/spec/fixtures/rails7_users_app/public/favicon.ico +0 -0
  91. data/spec/fixtures/rails7_users_app/public/robots.txt +1 -0
  92. data/spec/fixtures/rails7_users_app/storage/.keep +0 -0
  93. data/spec/fixtures/rails7_users_app/test/application_system_test_case.rb +5 -0
  94. data/spec/fixtures/rails7_users_app/test/channels/application_cable/connection_test.rb +11 -0
  95. data/spec/fixtures/rails7_users_app/test/controllers/.keep +0 -0
  96. data/spec/fixtures/rails7_users_app/test/fixtures/files/.keep +0 -0
  97. data/spec/fixtures/rails7_users_app/test/fixtures/instances.yml +11 -0
  98. data/spec/fixtures/rails7_users_app/test/fixtures/instructors.yml +11 -0
  99. data/spec/fixtures/rails7_users_app/test/helpers/.keep +0 -0
  100. data/spec/fixtures/rails7_users_app/test/integration/.keep +0 -0
  101. data/spec/fixtures/rails7_users_app/test/mailers/.keep +0 -0
  102. data/spec/fixtures/rails7_users_app/test/models/.keep +0 -0
  103. data/spec/fixtures/rails7_users_app/test/models/instance_test.rb +6 -0
  104. data/spec/fixtures/rails7_users_app/test/models/instructor_test.rb +7 -0
  105. data/spec/fixtures/rails7_users_app/test/system/.keep +0 -0
  106. data/spec/fixtures/rails7_users_app/test/test_helper.rb +13 -0
  107. data/spec/handler/eval_spec.rb +66 -0
  108. data/spec/hook_spec.rb +2 -2
  109. data/spec/rails_recording_spec.rb +6 -4
  110. data/spec/rails_spec_helper.rb +7 -0
  111. data/spec/rails_test_spec.rb +45 -0
  112. metadata +95 -2
@@ -0,0 +1,43 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9
+ threads min_threads_count, max_threads_count
10
+
11
+ # Specifies the `worker_timeout` threshold that Puma will use to wait before
12
+ # terminating a worker in development environments.
13
+ #
14
+ worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
15
+
16
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
17
+ #
18
+ port ENV.fetch("PORT") { 3000 }
19
+
20
+ # Specifies the `environment` that Puma will run in.
21
+ #
22
+ environment ENV.fetch("RAILS_ENV") { "development" }
23
+
24
+ # Specifies the `pidfile` that Puma will use.
25
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
26
+
27
+ # Specifies the number of `workers` to boot in clustered mode.
28
+ # Workers are forked web server processes. If using threads and workers together
29
+ # the concurrency of the application would be max `threads` * `workers`.
30
+ # Workers do not work on JRuby or Windows (both of which do not support
31
+ # processes).
32
+ #
33
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
34
+
35
+ # Use the `preload_app!` method when specifying a `workers` number.
36
+ # This directive tells Puma to first boot the application and load code
37
+ # before forking the application. This takes advantage of Copy On Write
38
+ # process behavior so workers use less memory.
39
+ #
40
+ # preload_app!
41
+
42
+ # Allow puma to be restarted by `bin/rails restart` command.
43
+ plugin :tmp_restart
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+ # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
3
+
4
+ # Defines the root path route ("/")
5
+ # root "articles#index"
6
+ end
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket-<%= Rails.env %>
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket-<%= Rails.env %>
23
+
24
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name-<%= Rails.env %>
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
@@ -0,0 +1,6 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative "config/environment"
4
+
5
+ run Rails.application
6
+ Rails.application.load_server
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bash
2
+ set -ex
3
+
4
+ # Just checking for a healthy container isn't enough, apparently. If
5
+ # we don't wait here, sometimes the database is inaccessible.
6
+ for i in {1..10}; do
7
+ psql -h pg -U postgres postgres -c 'select 1' >/dev/null 2>&1 && break
8
+ printf ' .'
9
+ sleep 1
10
+ done
11
+ echo
12
+ out="$(psql -h pg -U postgres postgres -c 'select 1' 2>&1)"
13
+ if [[ $? != 0 ]]; then
14
+ echo "Postgres didn't start in time:"
15
+ echo "$out"
16
+ exit 1
17
+ fi
18
+
19
+ # Required for migrations
20
+ export ORM_MODULE=sequel
21
+
22
+ set +e
23
+ psql -h pg -U postgres -c "drop database if exists app_development"
24
+ psql -h pg -U postgres -c "drop database if exists app_test"
25
+ set -e
26
+
27
+ psql -h pg -U postgres -c "create database app_development"
28
+ psql -h pg -U postgres -c "create database app_test"
29
+
30
+ env RAILS_ENV=development bundle exec rake -t db:migrate
31
+ env RAILS_ENV=test bundle exec rake -t db:migrate
@@ -0,0 +1,8 @@
1
+ class CreateInstances < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :instances do |t|
4
+
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class CreateInstructors < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :instructors do |t|
4
+
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,27 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema[7.0].define(version: 2022_03_28_093154) do
14
+ # These are extensions that must be enabled in order to support this database
15
+ enable_extension "plpgsql"
16
+
17
+ create_table "instances", force: :cascade do |t|
18
+ t.datetime "created_at", null: false
19
+ t.datetime "updated_at", null: false
20
+ end
21
+
22
+ create_table "instructors", force: :cascade do |t|
23
+ t.datetime "created_at", null: false
24
+ t.datetime "updated_at", null: false
25
+ end
26
+
27
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
7
+ # Character.create(name: "Luke", movie: movies.first)
@@ -0,0 +1,31 @@
1
+ version: "3"
2
+ services:
3
+ pg:
4
+ build:
5
+ context: .
6
+ dockerfile: Dockerfile.pg
7
+ ports:
8
+ - "5432"
9
+ environment:
10
+ POSTGRES_HOST_AUTH_METHOD: trust
11
+
12
+ app:
13
+ build:
14
+ context: .
15
+ dockerfile: Dockerfile
16
+ image: rails7-app:${RUBY_VERSION}
17
+ command:
18
+ [ "./bin/rails", "server", "-b", "0.0.0.0", "-u", "webrick" ]
19
+ environment:
20
+ RAILS_ENV:
21
+ ORM_MODULE:
22
+ PGHOST: pg
23
+ PGPORT: '5432'
24
+ DATABASE_URL: postgres://postgres@pg
25
+ APPMAP:
26
+ volumes:
27
+ - .:/src/app
28
+ ports:
29
+ - "3000"
30
+ links:
31
+ - pg:pg
File without changes
File without changes
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1 @@
1
+ # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
File without changes
@@ -0,0 +1,5 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5
+ end
@@ -0,0 +1,11 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
4
+ # test "connects with cookies" do
5
+ # cookies.signed[:user_id] = 42
6
+ #
7
+ # connect
8
+ #
9
+ # assert_equal connection.user_id, "42"
10
+ # end
11
+ end
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the "{}" from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the "{}" from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
File without changes
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ require "test_helper"
2
+
3
+ class InstanceTest < ActiveSupport::TestCase
4
+ test "creates valid instance" do
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ require "test_helper"
2
+
3
+ class InstructorTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
File without changes
@@ -0,0 +1,13 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+ require_relative "../config/environment"
3
+ require "rails/test_help"
4
+
5
+ class ActiveSupport::TestCase
6
+ # Run tests in parallel with specified workers
7
+ parallelize(workers: :number_of_processors)
8
+
9
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
10
+ fixtures :all
11
+
12
+ # Add more helper methods to be used by all tests here...
13
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Security/Eval, Style/EvalWithLocation
4
+
5
+ require 'spec_helper'
6
+ require 'appmap/config'
7
+
8
+ describe 'AppMap::Handler::Eval' do
9
+ include_context 'collect events'
10
+ let!(:config) { AppMap::Config.new('hook_spec') }
11
+ before { AppMap.configuration = config }
12
+ after { AppMap.configuration = nil }
13
+
14
+ def record_block
15
+ AppMap::Hook.new(config).enable do
16
+ tracer = AppMap.tracing.trace
17
+ AppMap::Event.reset_id_counter
18
+ begin
19
+ yield
20
+ ensure
21
+ AppMap.tracing.delete(tracer)
22
+ end
23
+ tracer
24
+ end
25
+ end
26
+
27
+ it 'produces a simple result' do
28
+ tracer = record_block do
29
+ expect(eval('12')).to eq(12)
30
+ end
31
+ events = collect_events(tracer)
32
+ expect(events[0]).to match hash_including \
33
+ defined_class: 'Kernel',
34
+ method_id: 'eval',
35
+ parameters: [{ class: 'Array', kind: :rest, name: 'arg', value: '[12]' }]
36
+ end
37
+
38
+ # a la Ruby 2.6.3 ruby-token.rb
39
+ # token_c = eval("class #{token_n} < #{super_token}; end; #{token_n}")
40
+ it 'can define a new class' do
41
+ num = (Random.random_number * 10_000).to_i
42
+ class_name = "Cls_#{num}"
43
+ m = ClassMaker
44
+ cls = nil
45
+ record_block do
46
+ cls = m.make_class class_name
47
+ end
48
+ expect(cls).to be_instance_of(Class)
49
+ # If execution context wasn't substituted, the class would be defined as
50
+ # eg. AppMap::Handler::Eval::Cls_7566
51
+ expect { AppMap::Handler::Eval.const_get(class_name) }.to raise_error(NameError)
52
+ # This would be the right behavior
53
+ expect(m.const_get(class_name)).to be_instance_of(Class)
54
+ expect(m.const_get(class_name)).to eq(cls)
55
+ new_cls = Class.new do
56
+ include m
57
+ end
58
+ expect(new_cls.const_get(class_name)).to eq(cls)
59
+ end
60
+ end
61
+
62
+ module ClassMaker
63
+ def self.make_class(class_name)
64
+ eval "class #{class_name}; end; #{class_name}"
65
+ end
66
+ end
data/spec/hook_spec.rb CHANGED
@@ -115,7 +115,7 @@ describe 'AppMap class Hooking', docker: false do
115
115
  require 'appmap/hook/method'
116
116
  package = config.lookup_package(hook_cls, method)
117
117
  expect(package).to be
118
- hook_method = AppMap::Hook::Method.new(package, hook_cls, method)
118
+ hook_method = AppMap::Handler::Function.new(package, hook_cls, method)
119
119
  hook_method.activate
120
120
 
121
121
  tracer = AppMap.tracing.trace
@@ -1188,7 +1188,7 @@ describe 'AppMap class Hooking', docker: false do
1188
1188
  require 'appmap/hook/method'
1189
1189
 
1190
1190
  pkg = AppMap::Config::Package.new('fixtures/hook/prependend_override')
1191
- AppMap::Hook::Method.new(pkg, PrependedClass, PrependedClass.public_instance_method(:say_hello)).activate
1191
+ AppMap::Handler::Function.new(pkg, PrependedClass, PrependedClass.public_instance_method(:say_hello)).activate
1192
1192
 
1193
1193
  tracer = AppMap.tracing.trace
1194
1194
  AppMap::Event.reset_id_counter
@@ -1,14 +1,16 @@
1
1
  require 'rails_spec_helper'
2
2
 
3
+ # Rails5 doesn't work with Ruby 3.x
3
4
  def default_rails_versions
4
- ruby_2? ? [ 5, 6 ] : [ 6 ]
5
+ testing_ruby_2? ? [ 5, 6 ] : [ 6 ]
5
6
  end
6
7
 
7
- # Rails5 doesn't work with Ruby 3.x
8
- RailsVersions = ENV['RAILS_VERSIONS'] || default_rails_versions
8
+ def rails_versions
9
+ Array(ENV['RAILS_VERSIONS'] || default_rails_versions)
10
+ end
9
11
 
10
12
  describe 'Rails' do
11
- RailsVersions.each do |rails_major_version| # rubocop:disable Metrics/BlockLength
13
+ rails_versions.each do |rails_major_version| # rubocop:disable Metrics/BlockLength
12
14
  context "#{rails_major_version}" do
13
15
  include_context 'Rails app pg database', "spec/fixtures/rails#{rails_major_version}_users_app" unless use_existing_data?
14
16
  include_context 'rails integration test setup'
@@ -5,6 +5,13 @@ require 'active_support'
5
5
  require 'active_support/core_ext'
6
6
  require 'open3'
7
7
 
8
+ # The RUBY_VERSION global variable indicates the version of the
9
+ # runtime. The RUBY_VERSION environment variable is the version we're
10
+ # testing, so it needs to be used to pick a fixture directory.
11
+ def testing_ruby_2?
12
+ ENV['RUBY_VERSION'].split('.')[0].to_i == 2
13
+ end
14
+
8
15
  # docker compose v2 replaced the --filter flag with --status
9
16
  PS_CMD=`docker-compose --version` =~ /version v2/ ?
10
17
  "docker-compose ps -q --status running" :