appmap 0.77.2 → 0.77.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Rakefile +29 -3
  4. data/lib/appmap/config.rb +9 -1
  5. data/lib/appmap/version.rb +1 -1
  6. data/spec/fixtures/rails7_users_app/.dockerignore +1 -0
  7. data/spec/fixtures/rails7_users_app/.gitattributes +7 -0
  8. data/spec/fixtures/rails7_users_app/.gitignore +31 -0
  9. data/spec/fixtures/rails7_users_app/.rspec +1 -0
  10. data/spec/fixtures/rails7_users_app/.ruby-version +1 -0
  11. data/spec/fixtures/rails7_users_app/Dockerfile +30 -0
  12. data/spec/fixtures/rails7_users_app/Dockerfile.pg +3 -0
  13. data/spec/fixtures/rails7_users_app/Gemfile +99 -0
  14. data/spec/fixtures/rails7_users_app/README.md +24 -0
  15. data/spec/fixtures/rails7_users_app/Rakefile +6 -0
  16. data/spec/fixtures/rails7_users_app/app/assets/config/manifest.js +4 -0
  17. data/spec/fixtures/rails7_users_app/app/assets/images/.keep +0 -0
  18. data/spec/fixtures/rails7_users_app/app/assets/stylesheets/application.css +15 -0
  19. data/spec/fixtures/rails7_users_app/app/channels/application_cable/channel.rb +4 -0
  20. data/spec/fixtures/rails7_users_app/app/channels/application_cable/connection.rb +4 -0
  21. data/spec/fixtures/rails7_users_app/app/controllers/application_controller.rb +2 -0
  22. data/spec/fixtures/rails7_users_app/app/controllers/concerns/.keep +0 -0
  23. data/spec/fixtures/rails7_users_app/app/helpers/application_helper.rb +2 -0
  24. data/spec/fixtures/rails7_users_app/app/javascript/application.js +3 -0
  25. data/spec/fixtures/rails7_users_app/app/javascript/controllers/application.js +9 -0
  26. data/spec/fixtures/rails7_users_app/app/javascript/controllers/hello_controller.js +7 -0
  27. data/spec/fixtures/rails7_users_app/app/javascript/controllers/index.js +11 -0
  28. data/spec/fixtures/rails7_users_app/app/jobs/application_job.rb +7 -0
  29. data/spec/fixtures/rails7_users_app/app/mailers/application_mailer.rb +4 -0
  30. data/spec/fixtures/rails7_users_app/app/models/application_record.rb +3 -0
  31. data/spec/fixtures/rails7_users_app/app/models/concerns/.keep +0 -0
  32. data/spec/fixtures/rails7_users_app/app/models/instance.rb +7 -0
  33. data/spec/fixtures/rails7_users_app/app/models/instructor.rb +7 -0
  34. data/spec/fixtures/rails7_users_app/app/views/layouts/application.html.erb +16 -0
  35. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.html.erb +13 -0
  36. data/spec/fixtures/rails7_users_app/app/views/layouts/mailer.text.erb +1 -0
  37. data/spec/fixtures/rails7_users_app/appmap.yml +3 -0
  38. data/spec/fixtures/rails7_users_app/bin/bundle +114 -0
  39. data/spec/fixtures/rails7_users_app/bin/importmap +4 -0
  40. data/spec/fixtures/rails7_users_app/bin/rails +4 -0
  41. data/spec/fixtures/rails7_users_app/bin/rake +4 -0
  42. data/spec/fixtures/rails7_users_app/bin/setup +33 -0
  43. data/spec/fixtures/rails7_users_app/config/application.rb +22 -0
  44. data/spec/fixtures/rails7_users_app/config/boot.rb +4 -0
  45. data/spec/fixtures/rails7_users_app/config/cable.yml +10 -0
  46. data/spec/fixtures/rails7_users_app/config/credentials.yml.enc +1 -0
  47. data/spec/fixtures/rails7_users_app/config/database.yml +86 -0
  48. data/spec/fixtures/rails7_users_app/config/environment.rb +5 -0
  49. data/spec/fixtures/rails7_users_app/config/environments/development.rb +70 -0
  50. data/spec/fixtures/rails7_users_app/config/environments/production.rb +93 -0
  51. data/spec/fixtures/rails7_users_app/config/environments/test.rb +60 -0
  52. data/spec/fixtures/rails7_users_app/config/importmap.rb +7 -0
  53. data/spec/fixtures/rails7_users_app/config/initializers/assets.rb +12 -0
  54. data/spec/fixtures/rails7_users_app/config/initializers/content_security_policy.rb +26 -0
  55. data/spec/fixtures/rails7_users_app/config/initializers/filter_parameter_logging.rb +8 -0
  56. data/spec/fixtures/rails7_users_app/config/initializers/inflections.rb +16 -0
  57. data/spec/fixtures/rails7_users_app/config/initializers/permissions_policy.rb +11 -0
  58. data/spec/fixtures/rails7_users_app/config/locales/en.yml +33 -0
  59. data/spec/fixtures/rails7_users_app/config/puma.rb +43 -0
  60. data/spec/fixtures/rails7_users_app/config/routes.rb +6 -0
  61. data/spec/fixtures/rails7_users_app/config/storage.yml +34 -0
  62. data/spec/fixtures/rails7_users_app/config.ru +6 -0
  63. data/spec/fixtures/rails7_users_app/create_app +31 -0
  64. data/spec/fixtures/rails7_users_app/db/migrate/20220328093141_create_instances.rb +8 -0
  65. data/spec/fixtures/rails7_users_app/db/migrate/20220328093154_create_instructors.rb +8 -0
  66. data/spec/fixtures/rails7_users_app/db/schema.rb +27 -0
  67. data/spec/fixtures/rails7_users_app/db/seeds.rb +7 -0
  68. data/spec/fixtures/rails7_users_app/docker-compose.yml +31 -0
  69. data/spec/fixtures/rails7_users_app/lib/assets/.keep +0 -0
  70. data/spec/fixtures/rails7_users_app/lib/tasks/.keep +0 -0
  71. data/spec/fixtures/rails7_users_app/log/.keep +0 -0
  72. data/spec/fixtures/rails7_users_app/public/404.html +67 -0
  73. data/spec/fixtures/rails7_users_app/public/422.html +67 -0
  74. data/spec/fixtures/rails7_users_app/public/500.html +66 -0
  75. data/spec/fixtures/rails7_users_app/public/apple-touch-icon-precomposed.png +0 -0
  76. data/spec/fixtures/rails7_users_app/public/apple-touch-icon.png +0 -0
  77. data/spec/fixtures/rails7_users_app/public/favicon.ico +0 -0
  78. data/spec/fixtures/rails7_users_app/public/robots.txt +1 -0
  79. data/spec/fixtures/rails7_users_app/storage/.keep +0 -0
  80. data/spec/fixtures/rails7_users_app/test/application_system_test_case.rb +5 -0
  81. data/spec/fixtures/rails7_users_app/test/channels/application_cable/connection_test.rb +11 -0
  82. data/spec/fixtures/rails7_users_app/test/controllers/.keep +0 -0
  83. data/spec/fixtures/rails7_users_app/test/fixtures/files/.keep +0 -0
  84. data/spec/fixtures/rails7_users_app/test/fixtures/instances.yml +11 -0
  85. data/spec/fixtures/rails7_users_app/test/fixtures/instructors.yml +11 -0
  86. data/spec/fixtures/rails7_users_app/test/helpers/.keep +0 -0
  87. data/spec/fixtures/rails7_users_app/test/integration/.keep +0 -0
  88. data/spec/fixtures/rails7_users_app/test/mailers/.keep +0 -0
  89. data/spec/fixtures/rails7_users_app/test/models/.keep +0 -0
  90. data/spec/fixtures/rails7_users_app/test/models/instance_test.rb +6 -0
  91. data/spec/fixtures/rails7_users_app/test/models/instructor_test.rb +7 -0
  92. data/spec/fixtures/rails7_users_app/test/system/.keep +0 -0
  93. data/spec/fixtures/rails7_users_app/test/test_helper.rb +13 -0
  94. data/spec/rails_recording_spec.rb +6 -4
  95. data/spec/rails_spec_helper.rb +7 -0
  96. data/spec/rails_test_spec.rb +45 -0
  97. metadata +91 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c287b504d552b0f627f6343e61f42835b144d12f3dea4e9f8a6e33bd72dbc581
4
- data.tar.gz: b00990f93c7961487a0c4ea6bc1f0828c3efa391578100de41600cc72ee1727d
3
+ metadata.gz: 6889544929fdf05360b3e528847aaa1e3c4a423c580b982d5ecbb3403a44f6aa
4
+ data.tar.gz: dad6b337385f4700b0974bf727329afa2bcd4c33f5a17bd951fd9516608a5798
5
5
  SHA512:
6
- metadata.gz: 0245f3bb4e483b6fba7326d759af828022e4339e05a293144e628c7fae558d744b105a0d3be8f44caa106f9b7b056fb3886176f3cdd513fe400c18126c4b7488
7
- data.tar.gz: 84cf727259f8ec5bad21b9d2ce799bc0753aeaeca0047fcf4296a0e5782d392a28340d44af0c08ab5d6a44fddb7baea4ea784ddd65e942329f159cf9eb4eac5b
6
+ metadata.gz: 197d249f8aa3ca22766168688f3b31e3b9cdf4c16d20227012d77dc5d6d1eb16b7814af8e605b51a5dc5a60ef4861f8cfd3f7089878ff88b046fac59a15b52a3
7
+ data.tar.gz: 0e74d7f95043ea588f0a0ef9aca170765db7475c6009d6471ce2299885b59aca25eb4d87bb72cd7045a2a743b6b8c95fbb6348786d99cb938a269c73189a5234
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.77.3](https://github.com/applandinc/appmap-ruby/compare/v0.77.2...v0.77.3) (2022-03-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Rescue exceptions when calling Class#to_s ([f59f2f6](https://github.com/applandinc/appmap-ruby/commit/f59f2f6b39664ff050486c88ff1b859ca0db48d8))
7
+
1
8
  ## [0.77.2](https://github.com/applandinc/appmap-ruby/compare/v0.77.1...v0.77.2) (2022-03-25)
2
9
 
3
10
 
data/Rakefile CHANGED
@@ -2,6 +2,21 @@ $: << File.join(__dir__, 'lib')
2
2
  require 'appmap/version'
3
3
  GEM_VERSION = AppMap::VERSION
4
4
 
5
+ # Make sure the local version is not behind the one on
6
+ # rubygems.org (it's ok if they're the same).
7
+ #
8
+ # If it is behind, the fixture images won't get updated with the gem
9
+ # built from the local source, so you'll wind up testing the rubygems
10
+ # version instead.
11
+ unless ENV['SKIP_VERSION_CHECK']
12
+ require 'json'
13
+ require 'net/http'
14
+ rubygems_version = JSON.parse(Net::HTTP.get(URI.parse('https://rubygems.org/api/v1/gems/appmap.json')))['version']
15
+ if Gem::Version.new(GEM_VERSION) < Gem::Version.new(rubygems_version)
16
+ raise "#{GEM_VERSION} < #{rubygems_version}. Rebase to avoid build issues."
17
+ end
18
+ end
19
+
5
20
  require 'rake/testtask'
6
21
  require 'rdoc/task'
7
22
 
@@ -24,7 +39,7 @@ RUBY_VERSIONS=%w[2.6 2.7 3.0 3.1].select do |version|
24
39
 
25
40
  false
26
41
  end
27
- FIXTURE_APPS=%w[rack_users_app rails6_users_app rails5_users_app]
42
+ FIXTURE_APPS=[:rack_users_app, :rails6_users_app, :rails5_users_app, :rails7_users_app => {:ruby_version => '>= 2.7'}]
28
43
 
29
44
  def run_cmd(*cmd)
30
45
  $stderr.puts "Running: #{cmd}"
@@ -83,7 +98,17 @@ namespace :build do
83
98
  RUBY_VERSIONS.each do |ruby_version|
84
99
  namespace ruby_version do
85
100
  desc "build:fixtures:#{ruby_version}"
86
- FIXTURE_APPS.each do |app|
101
+ FIXTURE_APPS.each do |app_spec|
102
+ app = if app_spec.instance_of?(Hash)
103
+ app_spec = app_spec.flatten
104
+ version_rqt = Gem::Requirement.create(app_spec[1][:ruby_version])
105
+ next unless version_rqt =~ (Gem::Version.new(ruby_version))
106
+ app = app_spec[0]
107
+ else
108
+ app = app_spec
109
+ end.to_s
110
+
111
+
87
112
  desc app
88
113
  task app => ["base:#{ruby_version}"] do
89
114
  build_app_image(app, ruby_version)
@@ -109,12 +134,13 @@ def run_specs(ruby_version, task_args)
109
134
  # description), because it's not intended to be invoked directly
110
135
  RSpec::Core::RakeTask.new("rspec_#{ruby_version}", [:specs]) do |task, args|
111
136
  task.exclude_pattern = 'spec/fixtures/**/*_spec.rb'
137
+ task.rspec_opts = '-f doc'
112
138
  if args.count > 0
113
139
  # There doesn't appear to be a value for +pattern+ that will
114
140
  # cause it to be ignored. Setting it to '' or +nil+ causes an
115
141
  # empty argument to get passed to rspec, which confuses it.
116
142
  task.pattern = 'never match this'
117
- task.rspec_opts = args.to_a.join(' ')
143
+ task.rspec_opts += " " + args.to_a.join(' ')
118
144
  end
119
145
  end
120
146
 
data/lib/appmap/config.rb CHANGED
@@ -450,7 +450,15 @@ module AppMap
450
450
 
451
451
  # Hook a method which is specified by class and method name.
452
452
  def package_for_code_object
453
- class_name = cls.to_s.index('#<Class:') == 0 ? cls.to_s['#<Class:'.length...-1] : cls.name
453
+ class_name = begin
454
+ cls.to_s.index('#<Class:') == 0 ? cls.to_s['#<Class:'.length...-1] : cls.name
455
+ rescue
456
+ # Calling #to_s on some Rails classes
457
+ # (e.g. those generated to represent
458
+ # associations) will raise an exception. Fall
459
+ # back to using the class name.
460
+ cls.name
461
+ end
454
462
  Array(config.gem_hooks[class_name])
455
463
  .find { |hook| hook.include_method?(method.name) }
456
464
  &.package
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.77.2'
6
+ VERSION = '0.77.3'
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
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
+ env_var_version || cli_arg_version ||
66
+ bundler_requirement_for(lockfile_version)
67
+ end
68
+
69
+ def bundler_requirement_for(version)
70
+ return "#{Gem::Requirement.default}.a" unless version
71
+
72
+ bundler_gem_version = Gem::Version.new(version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../config/application"
4
+ require "importmap/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run