appmap 0.77.1 → 0.77.4

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -7
  3. data/CHANGELOG.md +21 -0
  4. data/Rakefile +29 -3
  5. data/lib/appmap/config.rb +9 -1
  6. data/lib/appmap/handler/function.rb +8 -8
  7. data/lib/appmap/handler/net_http.rb +19 -18
  8. data/lib/appmap/handler/rails/request_handler.rb +3 -4
  9. data/lib/appmap/handler/rails/template.rb +68 -62
  10. data/lib/appmap/hook/method/ruby2.rb +56 -0
  11. data/lib/appmap/hook/method/ruby3.rb +56 -0
  12. data/lib/appmap/hook/method.rb +42 -98
  13. data/lib/appmap/hook.rb +2 -2
  14. data/lib/appmap/swagger/rake_tasks.rb +6 -1
  15. data/lib/appmap/version.rb +1 -1
  16. data/spec/fixtures/rails7_users_app/.dockerignore +1 -0
  17. data/spec/fixtures/rails7_users_app/.gitattributes +7 -0
  18. data/spec/fixtures/rails7_users_app/.gitignore +31 -0
  19. data/spec/fixtures/rails7_users_app/.rspec +1 -0
  20. data/spec/fixtures/rails7_users_app/.ruby-version +1 -0
  21. data/spec/fixtures/rails7_users_app/Dockerfile +30 -0
  22. data/spec/fixtures/rails7_users_app/Dockerfile.pg +3 -0
  23. data/spec/fixtures/rails7_users_app/Gemfile +99 -0
  24. data/spec/fixtures/rails7_users_app/README.md +24 -0
  25. data/spec/fixtures/rails7_users_app/Rakefile +6 -0
  26. data/spec/fixtures/rails7_users_app/app/assets/config/manifest.js +4 -0
  27. data/spec/fixtures/rails7_users_app/app/assets/images/.keep +0 -0
  28. data/spec/fixtures/rails7_users_app/app/assets/stylesheets/application.css +15 -0
  29. data/spec/fixtures/rails7_users_app/app/channels/application_cable/channel.rb +4 -0
  30. data/spec/fixtures/rails7_users_app/app/channels/application_cable/connection.rb +4 -0
  31. data/spec/fixtures/rails7_users_app/app/controllers/application_controller.rb +2 -0
  32. data/spec/fixtures/rails7_users_app/app/controllers/concerns/.keep +0 -0
  33. data/spec/fixtures/rails7_users_app/app/helpers/application_helper.rb +2 -0
  34. data/spec/fixtures/rails7_users_app/app/javascript/application.js +3 -0
  35. data/spec/fixtures/rails7_users_app/app/javascript/controllers/application.js +9 -0
  36. data/spec/fixtures/rails7_users_app/app/javascript/controllers/hello_controller.js +7 -0
  37. data/spec/fixtures/rails7_users_app/app/javascript/controllers/index.js +11 -0
  38. data/spec/fixtures/rails7_users_app/app/jobs/application_job.rb +7 -0
  39. data/spec/fixtures/rails7_users_app/app/mailers/application_mailer.rb +4 -0
  40. data/spec/fixtures/rails7_users_app/app/models/application_record.rb +3 -0
  41. data/spec/fixtures/rails7_users_app/app/models/concerns/.keep +0 -0
  42. data/spec/fixtures/rails7_users_app/app/models/instance.rb +7 -0
  43. data/spec/fixtures/rails7_users_app/app/models/instructor.rb +7 -0
  44. data/spec/fixtures/rails7_users_app/app/views/layouts/application.html.erb +16 -0
  45. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.html.erb +13 -0
  46. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.text.erb +1 -0
  47. data/spec/fixtures/rails7_users_app/appmap.yml +3 -0
  48. data/spec/fixtures/rails7_users_app/bin/bundle +114 -0
  49. data/spec/fixtures/rails7_users_app/bin/importmap +4 -0
  50. data/spec/fixtures/rails7_users_app/bin/rails +4 -0
  51. data/spec/fixtures/rails7_users_app/bin/rake +4 -0
  52. data/spec/fixtures/rails7_users_app/bin/setup +33 -0
  53. data/spec/fixtures/rails7_users_app/config/application.rb +22 -0
  54. data/spec/fixtures/rails7_users_app/config/boot.rb +4 -0
  55. data/spec/fixtures/rails7_users_app/config/cable.yml +10 -0
  56. data/spec/fixtures/rails7_users_app/config/credentials.yml.enc +1 -0
  57. data/spec/fixtures/rails7_users_app/config/database.yml +86 -0
  58. data/spec/fixtures/rails7_users_app/config/environment.rb +5 -0
  59. data/spec/fixtures/rails7_users_app/config/environments/development.rb +70 -0
  60. data/spec/fixtures/rails7_users_app/config/environments/production.rb +93 -0
  61. data/spec/fixtures/rails7_users_app/config/environments/test.rb +60 -0
  62. data/spec/fixtures/rails7_users_app/config/importmap.rb +7 -0
  63. data/spec/fixtures/rails7_users_app/config/initializers/assets.rb +12 -0
  64. data/spec/fixtures/rails7_users_app/config/initializers/content_security_policy.rb +26 -0
  65. data/spec/fixtures/rails7_users_app/config/initializers/filter_parameter_logging.rb +8 -0
  66. data/spec/fixtures/rails7_users_app/config/initializers/inflections.rb +16 -0
  67. data/spec/fixtures/rails7_users_app/config/initializers/permissions_policy.rb +11 -0
  68. data/spec/fixtures/rails7_users_app/config/locales/en.yml +33 -0
  69. data/spec/fixtures/rails7_users_app/config/puma.rb +43 -0
  70. data/spec/fixtures/rails7_users_app/config/routes.rb +6 -0
  71. data/spec/fixtures/rails7_users_app/config/storage.yml +34 -0
  72. data/spec/fixtures/rails7_users_app/config.ru +6 -0
  73. data/spec/fixtures/rails7_users_app/create_app +31 -0
  74. data/spec/fixtures/rails7_users_app/db/migrate/20220328093141_create_instances.rb +8 -0
  75. data/spec/fixtures/rails7_users_app/db/migrate/20220328093154_create_instructors.rb +8 -0
  76. data/spec/fixtures/rails7_users_app/db/schema.rb +27 -0
  77. data/spec/fixtures/rails7_users_app/db/seeds.rb +7 -0
  78. data/spec/fixtures/rails7_users_app/docker-compose.yml +31 -0
  79. data/spec/fixtures/rails7_users_app/lib/assets/.keep +0 -0
  80. data/spec/fixtures/rails7_users_app/lib/tasks/.keep +0 -0
  81. data/spec/fixtures/rails7_users_app/log/.keep +0 -0
  82. data/spec/fixtures/rails7_users_app/public/404.html +67 -0
  83. data/spec/fixtures/rails7_users_app/public/422.html +67 -0
  84. data/spec/fixtures/rails7_users_app/public/500.html +66 -0
  85. data/spec/fixtures/rails7_users_app/public/apple-touch-icon-precomposed.png +0 -0
  86. data/spec/fixtures/rails7_users_app/public/apple-touch-icon.png +0 -0
  87. data/spec/fixtures/rails7_users_app/public/favicon.ico +0 -0
  88. data/spec/fixtures/rails7_users_app/public/robots.txt +1 -0
  89. data/spec/fixtures/rails7_users_app/storage/.keep +0 -0
  90. data/spec/fixtures/rails7_users_app/test/application_system_test_case.rb +5 -0
  91. data/spec/fixtures/rails7_users_app/test/channels/application_cable/connection_test.rb +11 -0
  92. data/spec/fixtures/rails7_users_app/test/controllers/.keep +0 -0
  93. data/spec/fixtures/rails7_users_app/test/fixtures/files/.keep +0 -0
  94. data/spec/fixtures/rails7_users_app/test/fixtures/instances.yml +11 -0
  95. data/spec/fixtures/rails7_users_app/test/fixtures/instructors.yml +11 -0
  96. data/spec/fixtures/rails7_users_app/test/helpers/.keep +0 -0
  97. data/spec/fixtures/rails7_users_app/test/integration/.keep +0 -0
  98. data/spec/fixtures/rails7_users_app/test/mailers/.keep +0 -0
  99. data/spec/fixtures/rails7_users_app/test/models/.keep +0 -0
  100. data/spec/fixtures/rails7_users_app/test/models/instance_test.rb +6 -0
  101. data/spec/fixtures/rails7_users_app/test/models/instructor_test.rb +7 -0
  102. data/spec/fixtures/rails7_users_app/test/system/.keep +0 -0
  103. data/spec/fixtures/rails7_users_app/test/test_helper.rb +13 -0
  104. data/spec/hook_spec.rb +2 -2
  105. data/spec/rails_recording_spec.rb +6 -4
  106. data/spec/rails_spec_helper.rb +7 -0
  107. data/spec/rails_test_spec.rb +45 -0
  108. data/spec/swagger/swagger_spec.rb +2 -2
  109. metadata +93 -2
@@ -1,17 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppMap
4
- NEW_RUBY = Util.ruby_minor_version >= 2.7
5
- if NEW_RUBY && !Proc.instance_methods.include?(:ruby2_keywords)
6
- warn "Ruby is #{RUBY_VERSION}, but Procs don't respond to #ruby2_keywords"
7
- end
8
-
9
4
  class Hook
10
5
  SIGNATURES = {}
11
-
12
6
  LOOKUP_SIGNATURE = lambda do |id|
13
7
  method = super(id)
14
-
8
+
15
9
  signature = SIGNATURES[[ method.owner, method.name ]]
16
10
  if signature
17
11
  method.singleton_class.module_eval do
@@ -20,36 +14,24 @@ module AppMap
20
14
  end
21
15
  end
22
16
  end
23
-
17
+
24
18
  method
25
19
  end
26
-
27
- class Method
28
- attr_reader :hook_package, :hook_class, :hook_method
29
20
 
30
- # +method_display_name+ may be nil if name resolution gets
31
- # deferred until runtime (e.g. for a singleton method on an
32
- # embedded Struct).
33
- attr_reader :method_display_name
21
+ # Single hooked method.
22
+ # Call #activate to override the original.
23
+ class Method
24
+ attr_reader :hook_package, :hook_class, :hook_method, :parameters, :arity
34
25
 
35
26
  HOOK_DISABLE_KEY = 'AppMap::Hook.disable'
36
27
  private_constant :HOOK_DISABLE_KEY
37
28
 
38
- # Grab the definition of Time.now here, to avoid interfering
39
- # with the method we're hooking.
40
- TIME_NOW = Time.method(:now)
41
- private_constant :TIME_NOW
42
-
43
- ARRAY_OF_EMPTY_HASH = [{}.freeze].freeze
44
-
45
29
  def initialize(hook_package, hook_class, hook_method)
46
30
  @hook_package = hook_package
47
31
  @hook_class = hook_class
48
32
  @hook_method = hook_method
49
-
50
- # Get the class for the method, if it's known.
51
- @defined_class, method_symbol = Hook.qualify_method_name(@hook_method)
52
- @method_display_name = [@defined_class, method_symbol, @hook_method.name].join if @defined_class
33
+ @parameters = hook_method.parameters
34
+ @arity = hook_method.arity
53
35
  end
54
36
 
55
37
  def activate
@@ -62,64 +44,6 @@ module AppMap
62
44
  warn "AppMap: Hooking #{msg} at line #{(hook_method.source_location || []).join(':')}"
63
45
  end
64
46
 
65
- defined_class = @defined_class
66
- hook_package = self.hook_package
67
- hook_method = self.hook_method
68
- before_hook = self.method(:before_hook)
69
- after_hook = self.method(:after_hook)
70
- with_disabled_hook = self.method(:with_disabled_hook)
71
-
72
- is_array_containing_empty_hash = ->(obj) {
73
- obj.is_a?(Array) && obj.length == 1 && obj[0].is_a?(Hash) && obj[0].size == 0
74
- }
75
-
76
- call_instance_method = lambda do |receiver, args, &block|
77
- # https://github.com/applandinc/appmap-ruby/issues/153
78
- if NEW_RUBY && is_array_containing_empty_hash.(args) && hook_method.arity == 1
79
- hook_method.bind_call(receiver, {}, &block)
80
- else
81
- if NEW_RUBY
82
- hook_method.bind_call(receiver, *args, &block)
83
- else
84
- hook_method.bind(receiver).call(*args, &block)
85
- end
86
- end
87
- end
88
-
89
- hook_method_def = Proc.new do |*args, &block|
90
- # We may not have gotten the class for the method during
91
- # initialization (e.g. for a singleton method on an embedded
92
- # struct), so make sure we have it now.
93
- defined_class, = Hook.qualify_method_name(hook_method) unless defined_class
94
-
95
- reentrant = Thread.current[HOOK_DISABLE_KEY]
96
- disabled_by_shallow_flag = \
97
- -> { hook_package&.shallow? && AppMap.tracing.last_package_for_current_thread == hook_package }
98
-
99
- enabled = true if AppMap.tracing.enabled? && !reentrant && !disabled_by_shallow_flag.call
100
-
101
- enabled = false if %i[instance_eval instance_exec].member?(hook_method.name) && args.empty?
102
-
103
- return call_instance_method.call(self, args, &block) unless enabled
104
-
105
- call_event, start_time = with_disabled_hook.call do
106
- before_hook.call(self, defined_class, args)
107
- end
108
- return_value = nil
109
- exception = nil
110
- begin
111
- return_value = call_instance_method.call(self, args, &block)
112
- rescue
113
- exception = $ERROR_INFO
114
- raise
115
- ensure
116
- with_disabled_hook.call do
117
- after_hook.call(self, call_event, start_time, return_value, exception) if call_event
118
- end
119
- end
120
- end
121
- hook_method_def = hook_method_def.ruby2_keywords if hook_method_def.respond_to?(:ruby2_keywords)
122
-
123
47
  hook_method_parameters = hook_method.parameters.dup.freeze
124
48
  SIGNATURES[[ hook_class, hook_method.name ]] = hook_method_parameters
125
49
 
@@ -140,28 +64,42 @@ module AppMap
140
64
 
141
65
  protected
142
66
 
143
- def before_hook(receiver, defined_class, args)
144
- call_event = hook_package.handler_class.handle_call(defined_class, hook_method, receiver, args)
145
- AppMap.tracing.record_event(call_event, package: hook_package, defined_class: defined_class, method: hook_method) if call_event
146
- [ call_event, TIME_NOW.call ]
67
+ def gettime
68
+ Process.clock_gettime Process::CLOCK_MONOTONIC
69
+ end
70
+
71
+ def trace?
72
+ return false unless AppMap.tracing.enabled?
73
+ return false if Thread.current[HOOK_DISABLE_KEY]
74
+ return false if hook_package&.shallow? && AppMap.tracing.last_package_for_current_thread == hook_package
75
+
76
+ true
147
77
  end
148
78
 
149
- def after_hook(_receiver, call_event, start_time, return_value, exception)
150
- elapsed = TIME_NOW.call - start_time
151
- return_event = hook_package.handler_class.handle_return(call_event.id, elapsed, return_value, exception)
79
+ def method_display_name
80
+ return @method_display_name if @method_display_name
81
+
82
+ return @method_display_name = [defined_class, method_symbol, hook_method.name].join if defined_class
83
+
84
+ "#{hook_method.name} (class resolution deferred)"
85
+ end
86
+
87
+ def defined_class
88
+ @defined_class ||= Hook.qualify_method_name(hook_method)&.first
89
+ end
90
+
91
+ def after_hook(_receiver, call_event, elapsed, return_value, exception)
92
+ return_event = handle_return(call_event.id, elapsed, return_value, exception)
152
93
  AppMap.tracing.record_event(return_event) if return_event
153
- nil
154
94
  end
155
95
 
156
- def with_disabled_hook(&function)
96
+ def with_disabled_hook
157
97
  # Don't record functions, such as to_s and inspect, that might be called
158
98
  # by the fn. Otherwise there can be a stack overflow.
159
99
  Thread.current[HOOK_DISABLE_KEY] = true
160
- begin
161
- function.call
162
- ensure
163
- Thread.current[HOOK_DISABLE_KEY] = false
164
- end
100
+ yield
101
+ ensure
102
+ Thread.current[HOOK_DISABLE_KEY] = false
165
103
  end
166
104
  end
167
105
  end
@@ -189,3 +127,9 @@ unless ENV['APPMAP_NO_PATCH_MODULE'] == 'true'
189
127
  prepend AppMap::ModuleMethods
190
128
  end
191
129
  end
130
+
131
+ if RUBY_VERSION < '3'
132
+ require 'appmap/hook/method/ruby2'
133
+ else
134
+ require 'appmap/hook/method/ruby3'
135
+ end
data/lib/appmap/hook.rb CHANGED
@@ -118,7 +118,7 @@ module AppMap
118
118
  cls, method = entry
119
119
  return false if config.never_hook?(cls, method)
120
120
 
121
- Hook::Method.new(hook.package, cls, method).activate
121
+ hook.package.handler_class.new(hook.package, cls, method).activate
122
122
  end
123
123
 
124
124
  methods = []
@@ -209,7 +209,7 @@ module AppMap
209
209
  package = config.lookup_package(hook_cls, method)
210
210
  next unless package
211
211
 
212
- Hook::Method.new(package, hook_cls, method).activate
212
+ package.handler_class.new(package, hook_cls, method).activate
213
213
  end
214
214
  end
215
215
 
@@ -20,9 +20,14 @@ module AppMap
20
20
  appmap_js = AppMap::NodeCLI.new(verbose: Rake.verbose == true)
21
21
 
22
22
  FileUtils.mkdir_p configuration.swagger_config.output_dir
23
+ swagger_template = Tempfile.new('swagger_template')
24
+
25
+ swagger_template.write(configuration.swagger_config.template.to_yaml)
26
+ swagger_template.close
23
27
 
24
28
  cmd = %w[swagger]
25
-
29
+ cmd << '--openapi-template' << swagger_template.path
30
+
26
31
  swagger_raw, = appmap_js.command(cmd)
27
32
 
28
33
  gen_swagger = YAML.load(swagger_raw)
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.77.1'
6
+ VERSION = '0.77.4'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.5.1'
9
9
 
@@ -0,0 +1 @@
1
+ Gemfile.lock
@@ -0,0 +1,7 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ # Mark the database schema as having been generated.
4
+ db/schema.rb linguist-generated
5
+
6
+ # Mark any vendored files as having been vendored.
7
+ vendor/* linguist-vendored
@@ -0,0 +1,31 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore all logfiles and tempfiles.
11
+ /log/*
12
+ /tmp/*
13
+ !/log/.keep
14
+ !/tmp/.keep
15
+
16
+ # Ignore pidfiles, but keep the directory.
17
+ /tmp/pids/*
18
+ !/tmp/pids/
19
+ !/tmp/pids/.keep
20
+
21
+ # Ignore uploaded files in development.
22
+ /storage/*
23
+ !/storage/.keep
24
+ /tmp/storage/*
25
+ !/tmp/storage/
26
+ !/tmp/storage/.keep
27
+
28
+ /public/assets
29
+
30
+ # Ignore master key for decrypting credentials and more.
31
+ /config/master.key
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1 @@
1
+ ruby-3.1.0
@@ -0,0 +1,30 @@
1
+ ARG GEM_VERSION
2
+ ARG RUBY_VERSION
3
+
4
+ FROM appmap:${GEM_VERSION} as appmap
5
+ FROM ruby:${RUBY_VERSION}
6
+
7
+ SHELL ["/bin/bash", "-c"]
8
+
9
+ RUN apt-get update && apt-get install -y vim less
10
+ RUN apt-get install -y postgresql-client
11
+
12
+ RUN mkdir /app
13
+ WORKDIR /app
14
+
15
+ RUN gem install -N bundler
16
+
17
+ COPY Gemfile .
18
+
19
+ RUN bundle
20
+
21
+ COPY . .
22
+
23
+ COPY --from=appmap /pkg/appmap.gem /tmp/
24
+ RUN gem install /tmp/appmap.gem && \
25
+ bundle update --local appmap && \
26
+ bundle binstubs appmap --force
27
+
28
+ EXPOSE 3000
29
+
30
+ HEALTHCHECK --interval=1s --retries=10 CMD curl --fail http://localhost:3000/health || exit 1
@@ -0,0 +1,3 @@
1
+ FROM postgres:10
2
+
3
+ HEALTHCHECK --interval=1s --retries=10 CMD psql -U postgres -c "select 1" || exit 1
@@ -0,0 +1,99 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
5
+ gem "rails", "~> 7.0.2", ">= 7.0.2.3"
6
+
7
+ # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
8
+ gem "sprockets-rails"
9
+
10
+ # Use postgresql as the database for Active Record
11
+ gem "pg", "~> 1.1"
12
+
13
+ # Use the Puma web server [https://github.com/puma/puma]
14
+ gem "puma", "~> 5.0"
15
+
16
+ # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
17
+ gem "importmap-rails"
18
+
19
+ # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
20
+ gem "turbo-rails"
21
+
22
+ # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
23
+ gem "stimulus-rails"
24
+
25
+ # Build JSON APIs with ease [https://github.com/rails/jbuilder]
26
+ gem "jbuilder"
27
+
28
+ # Use Redis adapter to run Action Cable in production
29
+ # gem "redis", "~> 4.0"
30
+
31
+ # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
32
+ # gem "kredis"
33
+
34
+ # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
35
+ # gem "bcrypt", "~> 3.1.7"
36
+
37
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
38
+ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
39
+
40
+ # Reduces boot times through caching; required in config/boot.rb
41
+ gem "bootsnap", require: false
42
+
43
+ # Use Sass to process CSS
44
+ # gem "sassc-rails"
45
+
46
+ # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
47
+ # gem "image_processing", "~> 1.2"
48
+
49
+ group :development, :test do
50
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
51
+ gem "debug", platforms: %i[ mri mingw x64_mingw ]
52
+ end
53
+
54
+ group :development do
55
+ # Use console on exceptions pages [https://github.com/rails/web-console]
56
+ gem "web-console"
57
+
58
+ # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
59
+ # gem "rack-mini-profiler"
60
+
61
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
62
+ # gem "spring"
63
+ end
64
+
65
+ group :test do
66
+ # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
67
+ gem "capybara"
68
+ gem "selenium-webdriver"
69
+ gem "webdrivers"
70
+ end
71
+
72
+ appmap_path = \
73
+ # Support debugging inside the container with volume-mounted source
74
+ if File.directory?('/src/appmap-ruby')
75
+ '/src/appmap-ruby'
76
+ elsif File.exist?('../../../appmap.gemspec')
77
+ '../../..'
78
+ end
79
+
80
+ if appmap_path
81
+ # Set the branch parameter, so that 'bundle config local.appmap' will work
82
+ appmap_branch = Dir.chdir appmap_path do
83
+ `git rev-parse --abbrev-ref HEAD`.strip
84
+ end
85
+ end
86
+
87
+ appmap_options = \
88
+ if appmap_path && appmap_branch
89
+ { git: appmap_path, branch: appmap_branch }
90
+ elsif appmap_path
91
+ { path: appmap_path }
92
+ else
93
+ {}
94
+ end.merge(require: %w[appmap])
95
+
96
+ group :development, :test do
97
+ gem 'appmap', appmap_options
98
+ gem 'pry-byebug', '>=0', '< 99'
99
+ end
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link_tree ../../javascript .js
4
+ //= link_tree ../../../vendor/javascript .js
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2
+ import "@hotwired/turbo-rails"
3
+ import "controllers"
@@ -0,0 +1,9 @@
1
+ import { Application } from "@hotwired/stimulus"
2
+
3
+ const application = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ application.debug = false
7
+ window.Stimulus = application
8
+
9
+ export { application }
@@ -0,0 +1,7 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ this.element.textContent = "Hello World!"
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ // Import and register all your controllers from the importmap under controllers/*
2
+
3
+ import { application } from "controllers/application"
4
+
5
+ // Eager load all controllers defined in the import map under controllers/**/*_controller
6
+ import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7
+ eagerLoadControllersFrom("controllers", application)
8
+
9
+ // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10
+ // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11
+ // lazyLoadControllersFrom("controllers", application)
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: "from@example.com"
3
+ layout "mailer"
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ primary_abstract_class
3
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Instance < ApplicationRecord
4
+ belongs_to :course
5
+ has_and_belongs_to_many :instructor
6
+ end
7
+
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Instructor < ApplicationRecord
4
+ belongs_to :user
5
+ has_and_belongs_to_many :instance
6
+ end
7
+
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>App</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
10
+ <%= javascript_importmap_tags %>
11
+ </head>
12
+
13
+ <body>
14
+ <%= yield %>
15
+ </body>
16
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1,3 @@
1
+ name: rails7_users_app
2
+ packages:
3
+ - path: app