railties 5.2.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +293 -89
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.rdoc +39 -33
  5. data/README.rdoc +3 -3
  6. data/lib/minitest/rails_plugin.rb +24 -13
  7. data/lib/rails/all.rb +4 -0
  8. data/lib/rails/api/generator.rb +2 -1
  9. data/lib/rails/api/task.rb +17 -0
  10. data/lib/rails/app_loader.rb +2 -2
  11. data/lib/rails/app_updater.rb +4 -1
  12. data/lib/rails/application/bootstrap.rb +9 -17
  13. data/lib/rails/application/configuration.rb +177 -27
  14. data/lib/rails/application/default_middleware_stack.rb +7 -3
  15. data/lib/rails/application/dummy_erb_compiler.rb +18 -0
  16. data/lib/rails/application/finisher.rb +69 -2
  17. data/lib/rails/application/routes_reloader.rb +9 -19
  18. data/lib/rails/application.rb +96 -66
  19. data/lib/rails/application_controller.rb +0 -1
  20. data/lib/rails/autoloaders.rb +48 -0
  21. data/lib/rails/backtrace_cleaner.rb +14 -21
  22. data/lib/rails/code_statistics.rb +8 -6
  23. data/lib/rails/code_statistics_calculator.rb +6 -6
  24. data/lib/rails/command/actions.rb +10 -0
  25. data/lib/rails/command/base.rb +17 -5
  26. data/lib/rails/command/behavior.rb +8 -49
  27. data/lib/rails/command/environment_argument.rb +9 -16
  28. data/lib/rails/command/spellchecker.rb +57 -0
  29. data/lib/rails/command.rb +18 -11
  30. data/lib/rails/commands/console/console_command.rb +6 -0
  31. data/lib/rails/commands/credentials/USAGE +33 -0
  32. data/lib/rails/commands/credentials/credentials_command/diffing.rb +41 -0
  33. data/lib/rails/commands/credentials/credentials_command.rb +78 -21
  34. data/lib/rails/commands/db/system/change/change_command.rb +25 -0
  35. data/lib/rails/commands/dbconsole/dbconsole_command.rb +66 -51
  36. data/lib/rails/commands/dev/dev_command.rb +19 -0
  37. data/lib/rails/commands/encrypted/USAGE +28 -0
  38. data/lib/rails/commands/encrypted/encrypted_command.rb +5 -4
  39. data/lib/rails/commands/generate/generate_command.rb +1 -1
  40. data/lib/rails/commands/help/help_command.rb +1 -1
  41. data/lib/rails/commands/initializers/initializers_command.rb +23 -0
  42. data/lib/rails/commands/new/new_command.rb +2 -2
  43. data/lib/rails/commands/notes/notes_command.rb +29 -0
  44. data/lib/rails/commands/plugin/plugin_command.rb +1 -1
  45. data/lib/rails/commands/rake/rake_command.rb +9 -8
  46. data/lib/rails/commands/routes/routes_command.rb +37 -0
  47. data/lib/rails/commands/runner/runner_command.rb +13 -9
  48. data/lib/rails/commands/secrets/USAGE +6 -0
  49. data/lib/rails/commands/secrets/secrets_command.rb +3 -3
  50. data/lib/rails/commands/server/server_command.rb +92 -56
  51. data/lib/rails/commands/test/test_command.rb +2 -2
  52. data/lib/rails/configuration.rb +48 -19
  53. data/lib/rails/engine/configuration.rb +6 -2
  54. data/lib/rails/engine/updater.rb +1 -1
  55. data/lib/rails/engine.rb +63 -35
  56. data/lib/rails/gem_version.rb +2 -2
  57. data/lib/rails/generators/actions/create_migration.rb +5 -1
  58. data/lib/rails/generators/actions.rb +89 -56
  59. data/lib/rails/generators/app_base.rb +80 -108
  60. data/lib/rails/generators/app_name.rb +50 -0
  61. data/lib/rails/generators/base.rb +19 -12
  62. data/lib/rails/generators/database.rb +57 -0
  63. data/lib/rails/generators/erb/mailer/mailer_generator.rb +1 -2
  64. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +0 -1
  65. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +7 -4
  66. data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +1 -1
  67. data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +9 -1
  68. data/lib/rails/generators/erb.rb +0 -1
  69. data/lib/rails/generators/generated_attribute.rb +50 -31
  70. data/lib/rails/generators/migration.rb +3 -3
  71. data/lib/rails/generators/model_helpers.rb +33 -2
  72. data/lib/rails/generators/named_base.rb +3 -7
  73. data/lib/rails/generators/rails/app/USAGE +2 -1
  74. data/lib/rails/generators/rails/app/app_generator.rb +127 -84
  75. data/lib/rails/generators/rails/app/templates/Gemfile.tt +18 -21
  76. data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
  77. data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -3
  78. data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +6 -0
  79. data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +5 -0
  80. data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +23 -0
  81. data/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt +5 -0
  82. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +6 -5
  83. data/lib/rails/generators/rails/app/templates/bin/rails.tt +5 -2
  84. data/lib/rails/generators/rails/app/templates/bin/rake.tt +5 -2
  85. data/lib/rails/generators/rails/app/templates/bin/setup.tt +9 -9
  86. data/lib/rails/generators/rails/app/templates/bin/spring.tt +9 -0
  87. data/lib/rails/generators/rails/app/templates/bin/yarn.tt +11 -3
  88. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +16 -7
  89. data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -2
  90. data/lib/rails/generators/rails/app/templates/config/cable.yml.tt +1 -1
  91. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +4 -5
  92. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +12 -11
  93. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +13 -12
  94. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +1 -1
  95. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +13 -12
  96. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +12 -11
  97. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +16 -15
  98. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
  99. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +11 -10
  100. data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
  101. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +22 -5
  102. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +43 -17
  103. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +26 -7
  104. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -1
  105. data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +4 -3
  106. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +7 -0
  107. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
  108. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +63 -0
  109. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -0
  110. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +1 -1
  111. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +13 -4
  112. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +1 -1
  113. data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +6 -6
  114. data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
  115. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +1 -1
  116. data/lib/rails/generators/rails/app/templates/gitattributes.tt +14 -0
  117. data/lib/rails/generators/rails/app/templates/gitignore.tt +10 -7
  118. data/lib/rails/generators/rails/app/templates/package.json.tt +8 -2
  119. data/lib/rails/generators/rails/app/templates/public/robots.txt +1 -1
  120. data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -1
  121. data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +11 -0
  122. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +9 -2
  123. data/lib/rails/generators/rails/assets/USAGE +3 -7
  124. data/lib/rails/generators/rails/assets/assets_generator.rb +0 -1
  125. data/lib/rails/generators/rails/benchmark/USAGE +19 -0
  126. data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +29 -0
  127. data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
  128. data/lib/rails/generators/rails/controller/USAGE +2 -2
  129. data/lib/rails/generators/rails/controller/controller_generator.rb +10 -39
  130. data/lib/rails/generators/rails/credentials/credentials_generator.rb +6 -7
  131. data/lib/rails/generators/rails/db/system/change/change_generator.rb +65 -0
  132. data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +10 -7
  133. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -0
  134. data/lib/rails/generators/rails/generator/USAGE +2 -2
  135. data/lib/rails/generators/rails/generator/generator_generator.rb +0 -1
  136. data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
  137. data/lib/rails/generators/rails/helper/USAGE +2 -3
  138. data/lib/rails/generators/rails/helper/helper_generator.rb +5 -0
  139. data/lib/rails/generators/rails/integration_test/USAGE +2 -2
  140. data/lib/rails/generators/rails/migration/USAGE +4 -4
  141. data/lib/rails/generators/rails/model/USAGE +15 -16
  142. data/lib/rails/generators/rails/plugin/plugin_generator.rb +32 -56
  143. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +18 -18
  144. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +3 -10
  145. data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
  146. data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +1 -2
  147. data/lib/rails/generators/rails/plugin/templates/app/helpers/%namespaced_name%/application_helper.rb.tt +1 -1
  148. data/lib/rails/generators/rails/plugin/templates/app/jobs/%namespaced_name%/application_job.rb.tt +1 -1
  149. data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +1 -1
  150. data/lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt +1 -1
  151. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +3 -3
  152. data/lib/rails/generators/rails/plugin/templates/gitignore.tt +14 -11
  153. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +1 -1
  154. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/railtie.rb.tt +1 -1
  155. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
  156. data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +1 -1
  157. data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
  158. data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
  159. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +0 -4
  160. data/lib/rails/generators/rails/resource/USAGE +4 -4
  161. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
  162. data/lib/rails/generators/rails/scaffold/USAGE +5 -5
  163. data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
  164. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +19 -0
  165. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
  166. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +2 -2
  167. data/lib/rails/generators/rails/system_test/USAGE +2 -2
  168. data/lib/rails/generators/rails/task/USAGE +3 -3
  169. data/lib/rails/generators/resource_helpers.rb +1 -6
  170. data/lib/rails/generators/test_case.rb +1 -1
  171. data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
  172. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
  173. data/lib/rails/generators/test_unit/generator/generator_generator.rb +0 -1
  174. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +2 -2
  175. data/lib/rails/generators/test_unit/integration/integration_generator.rb +5 -0
  176. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
  177. data/lib/rails/generators/test_unit/job/job_generator.rb +5 -0
  178. data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
  179. data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +1 -1
  180. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
  181. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +3 -3
  182. data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
  183. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
  184. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
  185. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +12 -3
  186. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +1 -1
  187. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +1 -1
  188. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +10 -2
  189. data/lib/rails/generators/test_unit/system/system_generator.rb +5 -0
  190. data/lib/rails/generators/testing/assertions.rb +2 -2
  191. data/lib/rails/generators/testing/behaviour.rb +4 -2
  192. data/lib/rails/generators.rb +38 -24
  193. data/lib/rails/info.rb +4 -4
  194. data/lib/rails/info_controller.rb +2 -3
  195. data/lib/rails/mailers_controller.rb +10 -4
  196. data/lib/rails/paths.rb +26 -10
  197. data/lib/rails/rack/logger.rb +5 -6
  198. data/lib/rails/railtie/configurable.rb +0 -1
  199. data/lib/rails/railtie/configuration.rb +3 -3
  200. data/lib/rails/railtie.rb +33 -13
  201. data/lib/rails/ruby_version_check.rb +3 -3
  202. data/lib/rails/secrets.rb +0 -1
  203. data/lib/rails/source_annotation_extractor.rb +124 -117
  204. data/lib/rails/tasks/engine.rake +1 -4
  205. data/lib/rails/tasks/framework.rake +13 -3
  206. data/lib/rails/tasks/log.rake +0 -1
  207. data/lib/rails/tasks/misc.rake +1 -1
  208. data/lib/rails/tasks/statistics.rake +5 -1
  209. data/lib/rails/tasks/yarn.rake +14 -1
  210. data/lib/rails/tasks/zeitwerk.rake +69 -0
  211. data/lib/rails/tasks.rb +1 -4
  212. data/lib/rails/templates/rails/mailers/email.html.erb +11 -7
  213. data/lib/rails/templates/rails/welcome/index.html.erb +3 -3
  214. data/lib/rails/test_help.rb +11 -9
  215. data/lib/rails/test_unit/reporter.rb +3 -2
  216. data/lib/rails/test_unit/runner.rb +25 -8
  217. data/lib/rails/test_unit/testing.rake +7 -1
  218. data/lib/rails.rb +10 -8
  219. metadata +45 -39
  220. data/lib/rails/generators/js/assets/assets_generator.rb +0 -15
  221. data/lib/rails/generators/js/assets/templates/javascript.js +0 -2
  222. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +0 -22
  223. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.js.tt +0 -13
  224. data/lib/rails/generators/rails/app/templates/bin/bundle.tt +0 -2
  225. data/lib/rails/generators/rails/app/templates/bin/update.tt +0 -34
  226. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
  227. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
  228. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +0 -35
  229. data/lib/rails/generators/rails/assets/templates/javascript.js +0 -2
  230. data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
  231. data/lib/rails/tasks/annotations.rake +0 -22
  232. data/lib/rails/tasks/dev.rake +0 -10
  233. data/lib/rails/tasks/initializers.rake +0 -8
  234. data/lib/rails/tasks/routes.rake +0 -31
@@ -3,7 +3,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  ruby <%= "'#{RUBY_VERSION}'" -%>
5
5
 
6
- <% unless gemfile_entries.first.comment -%>
6
+ <% unless gemfile_entries.first&.comment -%>
7
7
 
8
8
  <% end -%>
9
9
  <% gemfile_entries.each do |gem| -%>
@@ -14,24 +14,21 @@ ruby <%= "'#{RUBY_VERSION}'" -%>
14
14
  <%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%>
15
15
  <% if gem.options.any? -%>
16
16
  , <%= gem.options.map { |k,v|
17
- "#{k}: #{v.inspect}" }.join(', ') %>
17
+ "#{k}: #{v.inspect.gsub('"', '\'')}" }.join(', ') %>
18
18
  <% end -%>
19
19
  <% end -%>
20
20
 
21
- # Use ActiveModel has_secure_password
21
+ # Use Active Model has_secure_password
22
22
  # gem 'bcrypt', '~> 3.1.7'
23
23
  <% unless skip_active_storage? -%>
24
24
 
25
- # Use ActiveStorage variant
26
- # gem 'mini_magick', '~> 4.8'
25
+ # Use Active Storage variant
26
+ # gem 'image_processing', '~> 1.2'
27
27
  <% end -%>
28
28
 
29
- # Use Capistrano for deployment
30
- # gem 'capistrano-rails', group: :development
31
-
32
29
  <% if depend_on_bootsnap? -%>
33
30
  # Reduces boot times through caching; required in config/boot.rb
34
- gem 'bootsnap', '>= 1.1.0', require: false
31
+ gem 'bootsnap', '>= 1.4.4', require: false
35
32
 
36
33
  <%- end -%>
37
34
  <%- if options.api? -%>
@@ -45,37 +42,37 @@ group :development, :test do
45
42
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
46
43
  end
47
44
 
45
+ <% end -%>
48
46
  group :development do
49
- <%- unless options.api? -%>
47
+ <%- unless options.api? || options.skip_dev_gems? -%>
50
48
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
51
- <%- if options.dev? || options.edge? -%>
49
+ <%- if options.dev? || options.edge? || options.master? -%>
52
50
  gem 'web-console', github: 'rails/web-console'
53
51
  <%- else -%>
54
- gem 'web-console', '>= 3.3.0'
52
+ gem 'web-console', '>= 4.1.0'
55
53
  <%- end -%>
54
+ # Display performance information such as SQL time and flame graphs for each request in your browser.
55
+ # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
56
+ gem 'rack-mini-profiler', '~> 2.0'
56
57
  <%- end -%>
57
58
  <% if depend_on_listen? -%>
58
- gem 'listen', '>= 3.0.5', '< 3.2'
59
+ gem 'listen', '~> 3.3'
59
60
  <% end -%>
60
61
  <% if spring_install? -%>
61
62
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
62
63
  gem 'spring'
63
- <% if depend_on_listen? -%>
64
- gem 'spring-watcher-listen', '~> 2.0.0'
65
- <% end -%>
66
64
  <% end -%>
67
65
  end
68
66
 
69
67
  <%- if depends_on_system_test? -%>
70
68
  group :test do
71
69
  # Adds support for Capybara system testing and selenium driver
72
- gem 'capybara', '>= 2.15', '< 4.0'
70
+ gem 'capybara', '>= 3.26'
73
71
  gem 'selenium-webdriver'
74
- # Easy installation and use of chromedriver to run system tests with Chrome
75
- gem 'chromedriver-helper'
72
+ # Easy installation and use of web drivers to run system tests with browsers
73
+ gem 'webdrivers'
76
74
  end
77
- <%- end -%>
78
- <% end -%>
79
75
 
76
+ <%- end -%>
80
77
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
81
78
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require_relative 'config/application'
4
+ require_relative "config/application"
5
5
 
6
6
  Rails.application.load_tasks
@@ -1,5 +1,2 @@
1
1
  //= link_tree ../images
2
- <% unless options.skip_javascript -%>
3
- //= link_directory ../javascripts .js
4
- <% end -%>
5
2
  //= link_directory ../stylesheets .css
@@ -0,0 +1,6 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
3
+
4
+ import { createConsumer } from "@rails/actioncable"
5
+
6
+ export default createConsumer()
@@ -0,0 +1,5 @@
1
+ // Load all the channels within this directory and all subdirectories.
2
+ // Channel files must be named *_channel.js.
3
+
4
+ const channels = require.context('.', true, /_channel\.js$/)
5
+ channels.keys().forEach(channels)
@@ -0,0 +1,23 @@
1
+ // This file is automatically compiled by Webpack, along with any other files
2
+ // present in this directory. You're encouraged to place your actual application logic in
3
+ // a relevant structure within app/javascript and only use these pack files to reference
4
+ // that code so it'll be compiled.
5
+
6
+ import Rails from "@rails/ujs"
7
+ <%- unless options[:skip_turbolinks] -%>
8
+ import Turbolinks from "turbolinks"
9
+ <%- end -%>
10
+ <%- unless skip_active_storage? -%>
11
+ import * as ActiveStorage from "@rails/activestorage"
12
+ <%- end -%>
13
+ <%- unless options[:skip_action_cable] -%>
14
+ import "channels"
15
+ <%- end -%>
16
+
17
+ Rails.start()
18
+ <%- unless options[:skip_turbolinks] -%>
19
+ Turbolinks.start()
20
+ <%- end -%>
21
+ <%- unless skip_active_storage? -%>
22
+ ActiveStorage.start()
23
+ <%- end -%>
@@ -1,2 +1,7 @@
1
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
2
7
  end
@@ -2,18 +2,19 @@
2
2
  <html>
3
3
  <head>
4
4
  <title><%= camelized %></title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
6
  <%%= csrf_meta_tags %>
6
7
  <%%= csp_meta_tag %>
7
8
 
8
9
  <%- if options[:skip_javascript] -%>
9
- <%%= stylesheet_link_tag 'application', media: 'all' %>
10
+ <%%= stylesheet_link_tag 'application', media: 'all' %>
10
11
  <%- else -%>
11
12
  <%- unless options[:skip_turbolinks] -%>
12
- <%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
13
- <%%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
13
+ <%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
14
+ <%%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
14
15
  <%- else -%>
15
- <%%= stylesheet_link_tag 'application', media: 'all' %>
16
- <%%= javascript_include_tag 'application' %>
16
+ <%%= stylesheet_link_tag 'application', media: 'all' %>
17
+ <%%= javascript_pack_tag 'application' %>
17
18
  <%- end -%>
18
19
  <%- end -%>
19
20
  </head>
@@ -1,3 +1,6 @@
1
+ <% if spring_install? -%>
2
+ load File.expand_path("spring", __dir__)
3
+ <% end -%>
1
4
  APP_PATH = File.expand_path('../config/application', __dir__)
2
- require_relative '../config/boot'
3
- require 'rails/commands'
5
+ require_relative "../config/boot"
6
+ require "rails/commands"
@@ -1,3 +1,6 @@
1
- require_relative '../config/boot'
2
- require 'rake'
1
+ <% if spring_install? -%>
2
+ load File.expand_path("spring", __dir__)
3
+ <% end -%>
4
+ require_relative "../config/boot"
5
+ require "rake"
3
6
  Rake.application.run
@@ -1,5 +1,4 @@
1
- require 'fileutils'
2
- include FileUtils
1
+ require "fileutils"
3
2
 
4
3
  # path to your application root.
5
4
  APP_ROOT = File.expand_path('..', __dir__)
@@ -8,27 +7,28 @@ def system!(*args)
8
7
  system(*args) || abort("\n== Command #{args} failed ==")
9
8
  end
10
9
 
11
- chdir APP_ROOT do
12
- # This script is a starting point to setup your application.
10
+ FileUtils.chdir APP_ROOT do
11
+ # This script is a way to set up or update your development environment automatically.
12
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
13
13
  # Add necessary setup steps to this file.
14
14
 
15
15
  puts '== Installing dependencies =='
16
16
  system! 'gem install bundler --conservative'
17
17
  system('bundle check') || system!('bundle install')
18
- <% unless options.skip_yarn? -%>
18
+ <% unless options.skip_javascript? -%>
19
19
 
20
- # Install JavaScript dependencies if using Yarn
21
- # system('bin/yarn')
20
+ # Install JavaScript dependencies
21
+ system! 'bin/yarn'
22
22
  <% end -%>
23
23
  <% unless options.skip_active_record? -%>
24
24
 
25
25
  # puts "\n== Copying sample files =="
26
26
  # unless File.exist?('config/database.yml')
27
- # cp 'config/database.yml.sample', 'config/database.yml'
27
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
28
28
  # end
29
29
 
30
30
  puts "\n== Preparing database =="
31
- system! 'bin/rails db:setup'
31
+ system! 'bin/rails db:prepare'
32
32
  <% end -%>
33
33
 
34
34
  puts "\n== Removing old logs and tempfiles =="
@@ -0,0 +1,9 @@
1
+ if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
2
+ # Load Spring without loading other gems in the Gemfile, for speed.
3
+ require "bundler"
4
+ Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring|
5
+ Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
6
+ gem "spring", spring.version
7
+ require "spring/binstub"
8
+ end
9
+ end
@@ -1,8 +1,16 @@
1
+ require 'pathname'
2
+
1
3
  APP_ROOT = File.expand_path('..', __dir__)
2
4
  Dir.chdir(APP_ROOT) do
3
- begin
4
- exec "yarnpkg", *ARGV
5
- rescue Errno::ENOENT
5
+ executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path|
6
+ normalized_path = File.expand_path(path)
7
+
8
+ normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn'))
9
+ end
10
+
11
+ if executable_path
12
+ exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV
13
+ else
6
14
  $stderr.puts "Yarn executable was not detected in the system."
7
15
  $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
8
16
  exit 1
@@ -1,16 +1,18 @@
1
- require_relative 'boot'
1
+ require_relative "boot"
2
2
 
3
3
  <% if include_all_railties? -%>
4
- require 'rails/all'
4
+ require "rails/all"
5
5
  <% else -%>
6
6
  require "rails"
7
7
  # Pick the frameworks you want:
8
8
  require "active_model/railtie"
9
- require "active_job/railtie"
9
+ <%= comment_if :skip_active_job %>require "active_job/railtie"
10
10
  <%= comment_if :skip_active_record %>require "active_record/railtie"
11
11
  <%= comment_if :skip_active_storage %>require "active_storage/engine"
12
12
  require "action_controller/railtie"
13
13
  <%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
14
+ <%= comment_if :skip_action_mailbox %>require "action_mailbox/engine"
15
+ <%= comment_if :skip_action_text %>require "action_text/engine"
14
16
  require "action_view/railtie"
15
17
  <%= comment_if :skip_action_cable %>require "action_cable/engine"
16
18
  <%= comment_if :skip_sprockets %>require "sprockets/railtie"
@@ -23,13 +25,20 @@ Bundler.require(*Rails.groups)
23
25
 
24
26
  module <%= app_const_base %>
25
27
  class Application < Rails::Application
28
+ <%- if !options.dummy_app? -%>
26
29
  # Initialize configuration defaults for originally generated Rails version.
27
30
  config.load_defaults <%= build(:config_target_version) %>
31
+ <%- else -%>
32
+ config.load_defaults Rails::VERSION::STRING.to_f
33
+ <%- end -%>
28
34
 
29
- # Settings in config/environments/* take precedence over those specified here.
30
- # Application configuration can go into files in config/initializers
31
- # -- all .rb files in that directory are automatically loaded after loading
32
- # the framework and any gems in your application.
35
+ # Configuration for the application, engines, and railties goes here.
36
+ #
37
+ # These settings can be overridden in specific environments using the files
38
+ # in config/environments, which are processed later.
39
+ #
40
+ # config.time_zone = "Central Time (US & Canada)"
41
+ # config.eager_load_paths << Rails.root.join("extras")
33
42
  <%- if options.api? -%>
34
43
 
35
44
  # Only loads a smaller set of middleware suitable for API only apps.
@@ -1,6 +1,6 @@
1
1
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
2
 
3
- require 'bundler/setup' # Set up gems listed in the Gemfile.
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
4
4
  <% if depend_on_bootsnap? -%>
5
- require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
5
+ require "bootsnap/setup" # Speed up boot time by caching expensive operations.
6
6
  <%- end -%>
@@ -2,7 +2,7 @@ development:
2
2
  adapter: async
3
3
 
4
4
  test:
5
- adapter: async
5
+ adapter: test
6
6
 
7
7
  production:
8
8
  adapter: redis
@@ -54,14 +54,13 @@ test:
54
54
  <<: *default
55
55
  url: jdbc:db://localhost/<%= app_name %>_test
56
56
 
57
- # As with config/secrets.yml, you never want to store sensitive information,
57
+ # As with config/credentials.yml, you never want to store sensitive information,
58
58
  # like your database password, in your source code. If your source code is
59
59
  # ever seen by anyone, they now have access to your database.
60
60
  #
61
- # Instead, provide the password as a unix environment variable when you boot
62
- # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
63
- # for a full rundown on how to provide these environment variables in a
64
- # production deployment.
61
+ # Instead, provide the password as an environment variable when you boot the
62
+ # app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
63
+ # for a full overview on how database connection configuration can be specified.
65
64
  #
66
65
  production:
67
66
  url: jdbc:db://localhost/<%= app_name %>_production
@@ -1,4 +1,4 @@
1
- # MySQL. Versions 5.1.10 and up are supported.
1
+ # MySQL. Versions 5.5.8 and up are supported.
2
2
  #
3
3
  # Install the MySQL driver:
4
4
  # gem install activerecord-jdbcmysql-adapter
@@ -27,24 +27,25 @@ test:
27
27
  <<: *default
28
28
  database: <%= app_name %>_test
29
29
 
30
- # As with config/secrets.yml, you never want to store sensitive information,
30
+ # As with config/credentials.yml, you never want to store sensitive information,
31
31
  # like your database password, in your source code. If your source code is
32
32
  # ever seen by anyone, they now have access to your database.
33
33
  #
34
- # Instead, provide the password as a unix environment variable when you boot
35
- # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
36
- # for a full rundown on how to provide these environment variables in a
37
- # production deployment.
38
- #
39
- # On Heroku and other platform providers, you may have a full connection URL
40
- # available as an environment variable. For example:
34
+ # Instead, provide the password or a full connection URL as an environment
35
+ # variable when you boot the app. For example:
41
36
  #
42
37
  # DATABASE_URL="mysql://myuser:mypass@localhost/somedatabase"
43
38
  #
44
- # You can use this database configuration with:
39
+ # If the connection URL is provided in the special DATABASE_URL environment
40
+ # variable, Rails will automatically merge its configuration values on top of
41
+ # the values provided in this file. Alternatively, you can specify a connection
42
+ # URL environment variable explicitly:
45
43
  #
46
44
  # production:
47
- # url: <%%= ENV['DATABASE_URL'] %>
45
+ # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
46
+ #
47
+ # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
48
+ # for a full overview on how database connection configuration can be specified.
48
49
  #
49
50
  production:
50
51
  <<: *default
@@ -1,4 +1,4 @@
1
- # PostgreSQL. Versions 9.1 and up are supported.
1
+ # PostgreSQL. Versions 9.3 and up are supported.
2
2
  #
3
3
  # Configure Using Gemfile
4
4
  # gem 'activerecord-jdbcpostgresql-adapter'
@@ -15,7 +15,7 @@ development:
15
15
  # The specified database role being used to connect to postgres.
16
16
  # To create additional roles in postgres see `$ createuser --help`.
17
17
  # When left blank, postgres will use the default role. This is
18
- # the same name as the operating system user that initialized the database.
18
+ # the same name as the operating system user running Rails.
19
19
  #username: <%= app_name %>
20
20
 
21
21
  # The password associated with the postgres role (username).
@@ -43,24 +43,25 @@ test:
43
43
  <<: *default
44
44
  database: <%= app_name %>_test
45
45
 
46
- # As with config/secrets.yml, you never want to store sensitive information,
46
+ # As with config/credentials.yml, you never want to store sensitive information,
47
47
  # like your database password, in your source code. If your source code is
48
48
  # ever seen by anyone, they now have access to your database.
49
49
  #
50
- # Instead, provide the password as a unix environment variable when you boot
51
- # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
52
- # for a full rundown on how to provide these environment variables in a
53
- # production deployment.
54
- #
55
- # On Heroku and other platform providers, you may have a full connection URL
56
- # available as an environment variable. For example:
50
+ # Instead, provide the password or a full connection URL as an environment
51
+ # variable when you boot the app. For example:
57
52
  #
58
53
  # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
59
54
  #
60
- # You can use this database configuration with:
55
+ # If the connection URL is provided in the special DATABASE_URL environment
56
+ # variable, Rails will automatically merge its configuration values on top of
57
+ # the values provided in this file. Alternatively, you can specify a connection
58
+ # URL environment variable explicitly:
61
59
  #
62
60
  # production:
63
- # url: <%%= ENV['DATABASE_URL'] %>
61
+ # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
62
+ #
63
+ # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
64
+ # for a full overview on how database connection configuration can be specified.
64
65
  #
65
66
  production:
66
67
  <<: *default
@@ -1,4 +1,4 @@
1
- # SQLite version 3.x
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
2
  # gem 'activerecord-jdbcsqlite3-adapter'
3
3
  #
4
4
  # Configure Using Gemfile
@@ -1,4 +1,4 @@
1
- # MySQL. Versions 5.1.10 and up are supported.
1
+ # MySQL. Versions 5.5.8 and up are supported.
2
2
  #
3
3
  # Install the MySQL driver
4
4
  # gem install mysql2
@@ -11,7 +11,7 @@
11
11
  #
12
12
  default: &default
13
13
  adapter: mysql2
14
- encoding: utf8
14
+ encoding: utf8mb4
15
15
  pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
16
16
  username: root
17
17
  password:
@@ -32,24 +32,25 @@ test:
32
32
  <<: *default
33
33
  database: <%= app_name %>_test
34
34
 
35
- # As with config/secrets.yml, you never want to store sensitive information,
35
+ # As with config/credentials.yml, you never want to store sensitive information,
36
36
  # like your database password, in your source code. If your source code is
37
37
  # ever seen by anyone, they now have access to your database.
38
38
  #
39
- # Instead, provide the password as a unix environment variable when you boot
40
- # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
41
- # for a full rundown on how to provide these environment variables in a
42
- # production deployment.
43
- #
44
- # On Heroku and other platform providers, you may have a full connection URL
45
- # available as an environment variable. For example:
39
+ # Instead, provide the password or a full connection URL as an environment
40
+ # variable when you boot the app. For example:
46
41
  #
47
42
  # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
48
43
  #
49
- # You can use this database configuration with:
44
+ # If the connection URL is provided in the special DATABASE_URL environment
45
+ # variable, Rails will automatically merge its configuration values on top of
46
+ # the values provided in this file. Alternatively, you can specify a connection
47
+ # URL environment variable explicitly:
50
48
  #
51
49
  # production:
52
- # url: <%%= ENV['DATABASE_URL'] %>
50
+ # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
51
+ #
52
+ # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
53
+ # for a full overview on how database connection configuration can be specified.
53
54
  #
54
55
  production:
55
56
  <<: *default
@@ -33,26 +33,27 @@ test:
33
33
  <<: *default
34
34
  database: <%= app_name %>_test
35
35
 
36
- # As with config/secrets.yml, you never want to store sensitive information,
36
+ # As with config/credentials.yml, you never want to store sensitive information,
37
37
  # like your database password, in your source code. If your source code is
38
38
  # ever seen by anyone, they now have access to your database.
39
39
  #
40
- # Instead, provide the password as a unix environment variable when you boot
41
- # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
42
- # for a full rundown on how to provide these environment variables in a
43
- # production deployment.
44
- #
45
- # On Heroku and other platform providers, you may have a full connection URL
46
- # available as an environment variable. For example:
40
+ # Instead, provide the password or a full connection URL as an environment
41
+ # variable when you boot the app. For example:
47
42
  #
48
43
  # DATABASE_URL="oracle-enhanced://myuser:mypass@localhost/somedatabase"
49
44
  #
50
- # Note that the adapter name uses a dash instead of an underscore.
45
+ # (Note that the adapter name uses a dash instead of an underscore.)
51
46
  #
52
- # You can use this database configuration with:
47
+ # If the connection URL is provided in the special DATABASE_URL environment
48
+ # variable, Rails will automatically merge its configuration values on top of
49
+ # the values provided in this file. Alternatively, you can specify a connection
50
+ # URL environment variable explicitly:
53
51
  #
54
52
  # production:
55
- # url: <%%= ENV['DATABASE_URL'] %>
53
+ # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
54
+ #
55
+ # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
56
+ # for a full overview on how database connection configuration can be specified.
56
57
  #
57
58
  production:
58
59
  <<: *default
@@ -1,10 +1,10 @@
1
- # PostgreSQL. Versions 9.1 and up are supported.
1
+ # PostgreSQL. Versions 9.3 and up are supported.
2
2
  #
3
3
  # Install the pg driver:
4
4
  # gem install pg
5
- # On OS X with Homebrew:
5
+ # On macOS with Homebrew:
6
6
  # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
- # On OS X with MacPorts:
7
+ # On macOS with MacPorts:
8
8
  # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
9
  # On Windows:
10
10
  # gem install pg
@@ -18,7 +18,7 @@ default: &default
18
18
  adapter: postgresql
19
19
  encoding: unicode
20
20
  # For details on connection pooling, see Rails configuration guide
21
- # http://guides.rubyonrails.org/configuring.html#database-pooling
21
+ # https://guides.rubyonrails.org/configuring.html#database-pooling
22
22
  pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23
23
 
24
24
  development:
@@ -28,7 +28,7 @@ development:
28
28
  # The specified database role being used to connect to postgres.
29
29
  # To create additional roles in postgres see `$ createuser --help`.
30
30
  # When left blank, postgres will use the default role. This is
31
- # the same name as the operating system user that initialized the database.
31
+ # the same name as the operating system user running Rails.
32
32
  #username: <%= app_name %>
33
33
 
34
34
  # The password associated with the postgres role (username).
@@ -59,24 +59,25 @@ test:
59
59
  <<: *default
60
60
  database: <%= app_name %>_test
61
61
 
62
- # As with config/secrets.yml, you never want to store sensitive information,
62
+ # As with config/credentials.yml, you never want to store sensitive information,
63
63
  # like your database password, in your source code. If your source code is
64
64
  # ever seen by anyone, they now have access to your database.
65
65
  #
66
- # Instead, provide the password as a unix environment variable when you boot
67
- # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
68
- # for a full rundown on how to provide these environment variables in a
69
- # production deployment.
70
- #
71
- # On Heroku and other platform providers, you may have a full connection URL
72
- # available as an environment variable. For example:
66
+ # Instead, provide the password or a full connection URL as an environment
67
+ # variable when you boot the app. For example:
73
68
  #
74
69
  # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75
70
  #
76
- # You can use this database configuration with:
71
+ # If the connection URL is provided in the special DATABASE_URL environment
72
+ # variable, Rails will automatically merge its configuration values on top of
73
+ # the values provided in this file. Alternatively, you can specify a connection
74
+ # URL environment variable explicitly:
77
75
  #
78
76
  # production:
79
- # url: <%%= ENV['DATABASE_URL'] %>
77
+ # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
78
+ #
79
+ # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
80
+ # for a full overview on how database connection configuration can be specified.
80
81
  #
81
82
  production:
82
83
  <<: *default
@@ -1,4 +1,4 @@
1
- # SQLite version 3.x
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
2
  # gem install sqlite3
3
3
  #
4
4
  # Ensure the SQLite 3 gem is defined in your Gemfile