omg-railties 8.0.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (351) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +171 -0
  3. data/MIT-LICENSE +20 -0
  4. data/RDOC_MAIN.md +99 -0
  5. data/README.rdoc +39 -0
  6. data/exe/rails +10 -0
  7. data/lib/minitest/rails_plugin.rb +140 -0
  8. data/lib/rails/all.rb +21 -0
  9. data/lib/rails/api/generator.rb +38 -0
  10. data/lib/rails/api/task.rb +235 -0
  11. data/lib/rails/app_loader.rb +77 -0
  12. data/lib/rails/application/bootstrap.rb +118 -0
  13. data/lib/rails/application/configuration.rb +659 -0
  14. data/lib/rails/application/default_middleware_stack.rb +140 -0
  15. data/lib/rails/application/dummy_config.rb +19 -0
  16. data/lib/rails/application/finisher.rb +238 -0
  17. data/lib/rails/application/routes_reloader.rb +79 -0
  18. data/lib/rails/application.rb +658 -0
  19. data/lib/rails/application_controller.rb +28 -0
  20. data/lib/rails/autoloaders/inflector.rb +21 -0
  21. data/lib/rails/autoloaders.rb +48 -0
  22. data/lib/rails/backtrace_cleaner.rb +42 -0
  23. data/lib/rails/cli.rb +21 -0
  24. data/lib/rails/code_statistics.rb +159 -0
  25. data/lib/rails/code_statistics_calculator.rb +99 -0
  26. data/lib/rails/command/actions.rb +52 -0
  27. data/lib/rails/command/base.rb +185 -0
  28. data/lib/rails/command/behavior.rb +84 -0
  29. data/lib/rails/command/environment_argument.rb +56 -0
  30. data/lib/rails/command/helpers/editor.rb +40 -0
  31. data/lib/rails/command.rb +172 -0
  32. data/lib/rails/commands/about/about_command.rb +14 -0
  33. data/lib/rails/commands/app/update_command.rb +94 -0
  34. data/lib/rails/commands/application/application_command.rb +33 -0
  35. data/lib/rails/commands/boot/boot_command.rb +14 -0
  36. data/lib/rails/commands/console/console_command.rb +91 -0
  37. data/lib/rails/commands/console/irb_console.rb +136 -0
  38. data/lib/rails/commands/credentials/USAGE +73 -0
  39. data/lib/rails/commands/credentials/credentials_command/diffing.rb +53 -0
  40. data/lib/rails/commands/credentials/credentials_command.rb +139 -0
  41. data/lib/rails/commands/db/system/change/change_command.rb +26 -0
  42. data/lib/rails/commands/dbconsole/dbconsole_command.rb +88 -0
  43. data/lib/rails/commands/destroy/destroy_command.rb +29 -0
  44. data/lib/rails/commands/dev/dev_command.rb +14 -0
  45. data/lib/rails/commands/devcontainer/devcontainer_command.rb +39 -0
  46. data/lib/rails/commands/encrypted/USAGE +23 -0
  47. data/lib/rails/commands/encrypted/encrypted_command.rb +98 -0
  48. data/lib/rails/commands/gem_help/USAGE +16 -0
  49. data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
  50. data/lib/rails/commands/generate/generate_command.rb +30 -0
  51. data/lib/rails/commands/help/USAGE +17 -0
  52. data/lib/rails/commands/help/help_command.rb +34 -0
  53. data/lib/rails/commands/initializers/initializers_command.rb +20 -0
  54. data/lib/rails/commands/middleware/middleware_command.rb +17 -0
  55. data/lib/rails/commands/new/new_command.rb +21 -0
  56. data/lib/rails/commands/notes/notes_command.rb +30 -0
  57. data/lib/rails/commands/plugin/plugin_command.rb +47 -0
  58. data/lib/rails/commands/rake/rake_command.rb +55 -0
  59. data/lib/rails/commands/restart/restart_command.rb +14 -0
  60. data/lib/rails/commands/routes/routes_command.rb +49 -0
  61. data/lib/rails/commands/runner/USAGE +22 -0
  62. data/lib/rails/commands/runner/runner_command.rb +81 -0
  63. data/lib/rails/commands/secret/secret_command.rb +13 -0
  64. data/lib/rails/commands/server/server_command.rb +290 -0
  65. data/lib/rails/commands/stats/stats_command.rb +19 -0
  66. data/lib/rails/commands/test/USAGE +14 -0
  67. data/lib/rails/commands/test/test_command.rb +81 -0
  68. data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
  69. data/lib/rails/commands/version/version_command.rb +12 -0
  70. data/lib/rails/commands.rb +18 -0
  71. data/lib/rails/configuration.rb +170 -0
  72. data/lib/rails/console/app.rb +8 -0
  73. data/lib/rails/console/helpers.rb +8 -0
  74. data/lib/rails/console/methods.rb +23 -0
  75. data/lib/rails/deprecator.rb +7 -0
  76. data/lib/rails/dev_caching.rb +44 -0
  77. data/lib/rails/engine/commands.rb +9 -0
  78. data/lib/rails/engine/configuration.rb +138 -0
  79. data/lib/rails/engine/lazy_route_set.rb +109 -0
  80. data/lib/rails/engine/railties.rb +23 -0
  81. data/lib/rails/engine/updater.rb +21 -0
  82. data/lib/rails/engine.rb +760 -0
  83. data/lib/rails/gem_version.rb +17 -0
  84. data/lib/rails/generators/actions/create_migration.rb +75 -0
  85. data/lib/rails/generators/actions.rb +528 -0
  86. data/lib/rails/generators/active_model.rb +94 -0
  87. data/lib/rails/generators/app_base.rb +806 -0
  88. data/lib/rails/generators/app_name.rb +39 -0
  89. data/lib/rails/generators/base.rb +432 -0
  90. data/lib/rails/generators/database.rb +287 -0
  91. data/lib/rails/generators/erb/authentication/authentication_generator.rb +15 -0
  92. data/lib/rails/generators/erb/authentication/templates/views/passwords/edit.html.erb +9 -0
  93. data/lib/rails/generators/erb/authentication/templates/views/passwords/new.html.erb +8 -0
  94. data/lib/rails/generators/erb/authentication/templates/views/sessions/new.html.erb +11 -0
  95. data/lib/rails/generators/erb/controller/controller_generator.rb +24 -0
  96. data/lib/rails/generators/erb/controller/templates/view.html.erb.tt +2 -0
  97. data/lib/rails/generators/erb/mailer/mailer_generator.rb +41 -0
  98. data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +13 -0
  99. data/lib/rails/generators/erb/mailer/templates/layout.text.erb.tt +1 -0
  100. data/lib/rails/generators/erb/mailer/templates/view.html.erb.tt +5 -0
  101. data/lib/rails/generators/erb/mailer/templates/view.text.erb.tt +3 -0
  102. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +34 -0
  103. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +37 -0
  104. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +12 -0
  105. data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +16 -0
  106. data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +11 -0
  107. data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
  108. data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +10 -0
  109. data/lib/rails/generators/erb.rb +26 -0
  110. data/lib/rails/generators/generated_attribute.rb +274 -0
  111. data/lib/rails/generators/migration.rb +71 -0
  112. data/lib/rails/generators/model_helpers.rb +62 -0
  113. data/lib/rails/generators/named_base.rb +227 -0
  114. data/lib/rails/generators/rails/app/USAGE +31 -0
  115. data/lib/rails/generators/rails/app/app_generator.rb +678 -0
  116. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +119 -0
  117. data/lib/rails/generators/rails/app/templates/Gemfile.tt +83 -0
  118. data/lib/rails/generators/rails/app/templates/README.md.tt +24 -0
  119. data/lib/rails/generators/rails/app/templates/Rakefile.tt +6 -0
  120. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +15 -0
  121. data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +6 -0
  122. data/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb.tt +2 -0
  123. data/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt +7 -0
  124. data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +4 -0
  125. data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +3 -0
  126. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +33 -0
  127. data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +13 -0
  128. data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.text.erb.tt +1 -0
  129. data/lib/rails/generators/rails/app/templates/app/views/pwa/manifest.json.erb.tt +22 -0
  130. data/lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js +26 -0
  131. data/lib/rails/generators/rails/app/templates/bin/brakeman.tt +6 -0
  132. data/lib/rails/generators/rails/app/templates/bin/dev.tt +1 -0
  133. data/lib/rails/generators/rails/app/templates/bin/rails.tt +3 -0
  134. data/lib/rails/generators/rails/app/templates/bin/rake.tt +3 -0
  135. data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +7 -0
  136. data/lib/rails/generators/rails/app/templates/bin/setup.tt +45 -0
  137. data/lib/rails/generators/rails/app/templates/bin/thrust.tt +4 -0
  138. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +42 -0
  139. data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +6 -0
  140. data/lib/rails/generators/rails/app/templates/config/cable.yml.tt +10 -0
  141. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +82 -0
  142. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +114 -0
  143. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +72 -0
  144. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +82 -0
  145. data/lib/rails/generators/rails/app/templates/config/deploy.yml.tt +107 -0
  146. data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +5 -0
  147. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +89 -0
  148. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +125 -0
  149. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +62 -0
  150. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +7 -0
  151. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +25 -0
  152. data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +16 -0
  153. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +8 -0
  154. data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +16 -0
  155. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_8_0.rb.tt +25 -0
  156. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +31 -0
  157. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +43 -0
  158. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +16 -0
  159. data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +34 -0
  160. data/lib/rails/generators/rails/app/templates/config.ru.tt +6 -0
  161. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +9 -0
  162. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +16 -0
  163. data/lib/rails/generators/rails/app/templates/dockerignore.tt +56 -0
  164. data/lib/rails/generators/rails/app/templates/env.erb.tt +5 -0
  165. data/lib/rails/generators/rails/app/templates/gitattributes.tt +9 -0
  166. data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +138 -0
  167. data/lib/rails/generators/rails/app/templates/github/dependabot.yml +12 -0
  168. data/lib/rails/generators/rails/app/templates/gitignore.tt +38 -0
  169. data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
  170. data/lib/rails/generators/rails/app/templates/public/400.html +67 -0
  171. data/lib/rails/generators/rails/app/templates/public/404.html +67 -0
  172. data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +66 -0
  173. data/lib/rails/generators/rails/app/templates/public/422.html +67 -0
  174. data/lib/rails/generators/rails/app/templates/public/500.html +66 -0
  175. data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
  176. data/lib/rails/generators/rails/app/templates/public/icon.svg +3 -0
  177. data/lib/rails/generators/rails/app/templates/public/robots.txt +1 -0
  178. data/lib/rails/generators/rails/app/templates/rubocop.yml.tt +8 -0
  179. data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -0
  180. data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb.tt +5 -0
  181. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +21 -0
  182. data/lib/rails/generators/rails/application_record/application_record_generator.rb +13 -0
  183. data/lib/rails/generators/rails/authentication/USAGE +6 -0
  184. data/lib/rails/generators/rails/authentication/authentication_generator.rb +54 -0
  185. data/lib/rails/generators/rails/authentication/templates/controllers/concerns/authentication.rb +55 -0
  186. data/lib/rails/generators/rails/authentication/templates/controllers/passwords_controller.rb +33 -0
  187. data/lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb +21 -0
  188. data/lib/rails/generators/rails/authentication/templates/mailers/passwords_mailer.rb +6 -0
  189. data/lib/rails/generators/rails/authentication/templates/models/current.rb +4 -0
  190. data/lib/rails/generators/rails/authentication/templates/models/session.rb +3 -0
  191. data/lib/rails/generators/rails/authentication/templates/models/user.rb +6 -0
  192. data/lib/rails/generators/rails/authentication/templates/test/mailers/previews/passwords_mailer_preview.rb +7 -0
  193. data/lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.html.erb +4 -0
  194. data/lib/rails/generators/rails/authentication/templates/views/passwords_mailer/reset.text.erb +2 -0
  195. data/lib/rails/generators/rails/benchmark/USAGE +19 -0
  196. data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +30 -0
  197. data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
  198. data/lib/rails/generators/rails/controller/USAGE +26 -0
  199. data/lib/rails/generators/rails/controller/controller_generator.rb +42 -0
  200. data/lib/rails/generators/rails/controller/templates/controller.rb.tt +9 -0
  201. data/lib/rails/generators/rails/credentials/credentials_generator.rb +61 -0
  202. data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +12 -0
  203. data/lib/rails/generators/rails/db/system/change/change_generator.rb +206 -0
  204. data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +168 -0
  205. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +3 -0
  206. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +47 -0
  207. data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +37 -0
  208. data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +31 -0
  209. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +57 -0
  210. data/lib/rails/generators/rails/generator/USAGE +13 -0
  211. data/lib/rails/generators/rails/generator/generator_generator.rb +27 -0
  212. data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
  213. data/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
  214. data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
  215. data/lib/rails/generators/rails/helper/USAGE +12 -0
  216. data/lib/rails/generators/rails/helper/helper_generator.rb +20 -0
  217. data/lib/rails/generators/rails/helper/templates/helper.rb.tt +4 -0
  218. data/lib/rails/generators/rails/integration_test/USAGE +10 -0
  219. data/lib/rails/generators/rails/integration_test/integration_test_generator.rb +9 -0
  220. data/lib/rails/generators/rails/master_key/master_key_generator.rb +53 -0
  221. data/lib/rails/generators/rails/migration/USAGE +45 -0
  222. data/lib/rails/generators/rails/migration/migration_generator.rb +14 -0
  223. data/lib/rails/generators/rails/model/model_generator.rb +18 -0
  224. data/lib/rails/generators/rails/plugin/USAGE +21 -0
  225. data/lib/rails/generators/rails/plugin/plugin_generator.rb +499 -0
  226. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +28 -0
  227. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +23 -0
  228. data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +20 -0
  229. data/lib/rails/generators/rails/plugin/templates/README.md.tt +28 -0
  230. data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +14 -0
  231. data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +5 -0
  232. data/lib/rails/generators/rails/plugin/templates/app/helpers/%namespaced_name%/application_helper.rb.tt +5 -0
  233. data/lib/rails/generators/rails/plugin/templates/app/jobs/%namespaced_name%/application_job.rb.tt +5 -0
  234. data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +7 -0
  235. data/lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt +6 -0
  236. data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +17 -0
  237. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +15 -0
  238. data/lib/rails/generators/rails/plugin/templates/bin/rubocop.tt +7 -0
  239. data/lib/rails/generators/rails/plugin/templates/bin/test.tt +4 -0
  240. data/lib/rails/generators/rails/plugin/templates/config/routes.rb.tt +6 -0
  241. data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +103 -0
  242. data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +12 -0
  243. data/lib/rails/generators/rails/plugin/templates/gitignore.tt +14 -0
  244. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +7 -0
  245. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/railtie.rb.tt +5 -0
  246. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -0
  247. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +8 -0
  248. data/lib/rails/generators/rails/plugin/templates/lib/tasks/%namespaced_name%_tasks.rake.tt +4 -0
  249. data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +5 -0
  250. data/lib/rails/generators/rails/plugin/templates/rails/routes.rb.tt +3 -0
  251. data/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +15 -0
  252. data/lib/rails/generators/rails/plugin/templates/rubocop.yml.tt +8 -0
  253. data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +7 -0
  254. data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb.tt +5 -0
  255. data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +7 -0
  256. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +21 -0
  257. data/lib/rails/generators/rails/resource/USAGE +23 -0
  258. data/lib/rails/generators/rails/resource/resource_generator.rb +27 -0
  259. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +23 -0
  260. data/lib/rails/generators/rails/scaffold/USAGE +41 -0
  261. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +18 -0
  262. data/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
  263. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +56 -0
  264. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +57 -0
  265. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +64 -0
  266. data/lib/rails/generators/rails/script/USAGE +18 -0
  267. data/lib/rails/generators/rails/script/script_generator.rb +18 -0
  268. data/lib/rails/generators/rails/script/templates/script.rb.tt +3 -0
  269. data/lib/rails/generators/rails/system_test/USAGE +10 -0
  270. data/lib/rails/generators/rails/system_test/system_test_generator.rb +9 -0
  271. data/lib/rails/generators/rails/task/USAGE +9 -0
  272. data/lib/rails/generators/rails/task/task_generator.rb +13 -0
  273. data/lib/rails/generators/rails/task/templates/task.rb.tt +8 -0
  274. data/lib/rails/generators/resource_helpers.rb +82 -0
  275. data/lib/rails/generators/test_case.rb +37 -0
  276. data/lib/rails/generators/test_unit/controller/controller_generator.rb +19 -0
  277. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +23 -0
  278. data/lib/rails/generators/test_unit/generator/generator_generator.rb +27 -0
  279. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +16 -0
  280. data/lib/rails/generators/test_unit/helper/helper_generator.rb +11 -0
  281. data/lib/rails/generators/test_unit/integration/integration_generator.rb +20 -0
  282. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +9 -0
  283. data/lib/rails/generators/test_unit/job/job_generator.rb +20 -0
  284. data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +9 -0
  285. data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +28 -0
  286. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +23 -0
  287. data/lib/rails/generators/test_unit/mailer/templates/preview.rb.tt +14 -0
  288. data/lib/rails/generators/test_unit/model/model_generator.rb +37 -0
  289. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +29 -0
  290. data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +9 -0
  291. data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +15 -0
  292. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
  293. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -0
  294. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +82 -0
  295. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +44 -0
  296. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +54 -0
  297. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +57 -0
  298. data/lib/rails/generators/test_unit/system/system_generator.rb +24 -0
  299. data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb.tt +5 -0
  300. data/lib/rails/generators/test_unit/system/templates/system_test.rb.tt +9 -0
  301. data/lib/rails/generators/test_unit.rb +10 -0
  302. data/lib/rails/generators/testing/assertions.rb +147 -0
  303. data/lib/rails/generators/testing/behavior.rb +116 -0
  304. data/lib/rails/generators/testing/setup_and_teardown.rb +20 -0
  305. data/lib/rails/generators.rb +327 -0
  306. data/lib/rails/health_controller.rb +55 -0
  307. data/lib/rails/info.rb +105 -0
  308. data/lib/rails/info_controller.rb +71 -0
  309. data/lib/rails/initializable.rb +95 -0
  310. data/lib/rails/mailers_controller.rb +122 -0
  311. data/lib/rails/paths.rb +246 -0
  312. data/lib/rails/plugin/test.rb +9 -0
  313. data/lib/rails/pwa_controller.rb +15 -0
  314. data/lib/rails/rack/logger.rb +88 -0
  315. data/lib/rails/rack/silence_request.rb +33 -0
  316. data/lib/rails/rack.rb +8 -0
  317. data/lib/rails/rackup/server.rb +15 -0
  318. data/lib/rails/railtie/configurable.rb +36 -0
  319. data/lib/rails/railtie/configuration.rb +114 -0
  320. data/lib/rails/railtie.rb +302 -0
  321. data/lib/rails/source_annotation_extractor.rb +214 -0
  322. data/lib/rails/tasks/engine.rake +85 -0
  323. data/lib/rails/tasks/framework.rake +34 -0
  324. data/lib/rails/tasks/log.rake +41 -0
  325. data/lib/rails/tasks/misc.rake +68 -0
  326. data/lib/rails/tasks/statistics.rake +23 -0
  327. data/lib/rails/tasks/tmp.rake +51 -0
  328. data/lib/rails/tasks/yarn.rake +29 -0
  329. data/lib/rails/tasks/zeitwerk.rake +41 -0
  330. data/lib/rails/tasks.rb +17 -0
  331. data/lib/rails/templates/layouts/application.html.erb +51 -0
  332. data/lib/rails/templates/rails/info/notes.html.erb +65 -0
  333. data/lib/rails/templates/rails/info/properties.html.erb +1 -0
  334. data/lib/rails/templates/rails/info/routes.html.erb +9 -0
  335. data/lib/rails/templates/rails/mailers/email.html.erb +201 -0
  336. data/lib/rails/templates/rails/mailers/index.html.erb +15 -0
  337. data/lib/rails/templates/rails/mailers/mailer.html.erb +12 -0
  338. data/lib/rails/templates/rails/welcome/index.html.erb +93 -0
  339. data/lib/rails/test_help.rb +47 -0
  340. data/lib/rails/test_unit/line_filtering.rb +13 -0
  341. data/lib/rails/test_unit/railtie.rb +25 -0
  342. data/lib/rails/test_unit/reporter.rb +121 -0
  343. data/lib/rails/test_unit/runner.rb +209 -0
  344. data/lib/rails/test_unit/test_parser.rb +133 -0
  345. data/lib/rails/test_unit/testing.rake +39 -0
  346. data/lib/rails/testing/maintain_test_schema.rb +16 -0
  347. data/lib/rails/version.rb +10 -0
  348. data/lib/rails/welcome_controller.rb +11 -0
  349. data/lib/rails/zeitwerk_checker.rb +15 -0
  350. data/lib/rails.rb +130 -0
  351. metadata +518 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c971e119d56fd6eaead8a8c18ace16df3ef5b8a87476912a8c417e2ddaffb0c6
4
+ data.tar.gz: e37f8a490c4ffff7c4ea46de4432227c5f3cd68039ac718ed64dd04d6804a15b
5
+ SHA512:
6
+ metadata.gz: 93079933917d862c96d7620702d8959b9ef8d2594d1326a57b0e12ce5c9253705bc7c3c0442067c83c98c5dcd14df960732bbea615f18401c0ca021f5643ae8d
7
+ data.tar.gz: 5f89b209b54631104084516de80dd06aa82c5e7f3172dcca01c2f9bdd7603941c9bb26ade37dc9a4108398df42ffb8622eb6233d7250f92534d5a46043adff0f
data/CHANGELOG.md ADDED
@@ -0,0 +1,171 @@
1
+ * Do not include redis by default in generated Dev Containers.
2
+
3
+ Now that applications use the Solid Queue and Solid Cache gems by default, we do not need to include redis
4
+ in the Dev Container. We will only include redis if `--skip-solid` is used when generating an app that uses
5
+ Active Job or Action Cable.
6
+
7
+ When generating a Dev Container for an existing app, we will not include redis if either of the solid gems
8
+ are in use.
9
+
10
+ *Andrew Novoselac*
11
+
12
+ * Use [Solid Cable](https://github.com/rails/solid_cable) as the default Action Cable adapter in production, configured as a separate queue database in config/database.yml. It keeps messages in a table and continuously polls for updates. This makes it possible to drop the common dependency on Redis, if it isn't needed for any other purpose. Despite polling, the performance of Solid Cable is comparable to Redis in most situations. And in all circumstances, it makes it easier to deploy Rails when Redis is no longer a required dependency for Action Cable functionality.
13
+
14
+ *DHH*
15
+
16
+ * Use [Solid Queue](https://github.com/rails/solid_queue) as the default Active Job backend in production, configured as a separate queue database in config/database.yml. In a single-server deployment, it'll run as a Puma plugin. This is configured in `config/deploy.yml` and can easily be changed to use a dedicated jobs machine.
17
+
18
+ *DHH*
19
+
20
+ * Use [Solid Cache](https://github.com/rails/solid_cache) as the default Rails.cache backend in production, configured as a separate cache database in config/database.yml.
21
+
22
+ *DHH*
23
+
24
+ * Add Rails::Rack::SilenceRequest middleware and use it via `config.silence_healthcheck_path = path`
25
+ to silence requests to "/up". This prevents the Kamal-required health checks from clogging up
26
+ the production logs.
27
+
28
+ *DHH*
29
+
30
+ * Introduce `mariadb-mysql` and `mariadb-trilogy` database options for `rails new`
31
+
32
+ When used with the `--devcontainer` flag, these options will use `mariadb` as the database for the
33
+ Dev Container. The original `mysql` and `trilogy` options will use `mysql`. Users who are not
34
+ generating a Dev Container do not need to use the new options.
35
+
36
+ *Andrew Novoselac*
37
+
38
+ * Deprecate `::STATS_DIRECTORIES`.
39
+
40
+ The global constant `STATS_DIRECTORIES` has been deprecated in favor of
41
+ `Rails::CodeStatistics.register_directory`.
42
+
43
+ Add extra directories with `Rails::CodeStatistics.register_directory(label, path)`:
44
+
45
+ ```ruby
46
+ require "rails/code_statistics"
47
+ Rails::CodeStatistics.register_directory('My Directory', 'path/to/dir')
48
+ ```
49
+
50
+ *Petrik de Heus*
51
+
52
+ * Enable query log tags by default on development env
53
+
54
+ This can be used to trace troublesome SQL statements back to the application
55
+ code that generated these statements. It is also useful when using multiple
56
+ databases because the query logs can identify which database is being used.
57
+
58
+ *Matheus Richard*
59
+
60
+ * Defer route drawing to the first request, or when url_helpers are called
61
+
62
+ Executes the first routes reload in middleware, or when a route set's
63
+ url_helpers receives a route call / asked if it responds to a route.
64
+ Previously, this was executed unconditionally on boot, which can
65
+ slow down boot time unnecessarily for larger apps with lots of routes.
66
+
67
+ Environments like production that have `config.eager_load = true` will
68
+ continue to eagerly load routes on boot.
69
+
70
+ *Gannon McGibbon*
71
+
72
+ * Generate form helpers to use `textarea*` methods instead of `text_area*` methods
73
+
74
+ *Sean Doyle*
75
+
76
+ * Add authentication generator to give a basic start to an authentication system using database-tracked sessions and password reset.
77
+
78
+ Generate with...
79
+
80
+ ```
81
+ bin/rails generate authentication
82
+ ```
83
+
84
+ Generated files:
85
+
86
+ ```
87
+ app/models/current.rb
88
+ app/models/user.rb
89
+ app/models/session.rb
90
+ app/controllers/sessions_controller.rb
91
+ app/controllers/passwords_controller.rb
92
+ app/mailers/passwords_mailer.rb
93
+ app/views/sessions/new.html.erb
94
+ app/views/passwords/new.html.erb
95
+ app/views/passwords/edit.html.erb
96
+ app/views/passwords_mailer/reset.html.erb
97
+ app/views/passwords_mailer/reset.text.erb
98
+ db/migrate/xxxxxxx_create_users.rb
99
+ db/migrate/xxxxxxx_create_sessions.rb
100
+ test/mailers/previews/passwords_mailer_preview.rb
101
+ ```
102
+
103
+ *DHH*
104
+
105
+
106
+ * Add not-null type modifier to migration attributes.
107
+
108
+ Generating with...
109
+
110
+ ```
111
+ bin/rails generate migration CreateUsers email_address:string!:uniq password_digest:string!
112
+ ```
113
+
114
+ Produces:
115
+
116
+ ```ruby
117
+ class CreateUsers < ActiveRecord::Migration[8.0]
118
+ def change
119
+ create_table :users do |t|
120
+ t.string :email_address, null: false
121
+ t.string :password_digest, null: false
122
+
123
+ t.timestamps
124
+ end
125
+ add_index :users, :email_address, unique: true
126
+ end
127
+ end
128
+ ```
129
+
130
+ *DHH*
131
+
132
+ * Add a `script` folder to applications, and a scripts generator.
133
+
134
+ The new `script` folder is meant to hold one-off or general purpose scripts,
135
+ such as data migration scripts, cleanup scripts, etc.
136
+
137
+ A new script generator allows you to create such scripts:
138
+
139
+ ```
140
+ bin/rails generate script my_script
141
+ bin/rails generate script data/backfill
142
+ ```
143
+
144
+ You can run the generated script using:
145
+
146
+ ```
147
+ bundle exec ruby script/my_script.rb
148
+ bundle exec ruby script/data/backfill.rb
149
+ ```
150
+
151
+ *Jerome Dalbert*, *Haroon Ahmed*
152
+
153
+ * Deprecate `bin/rake stats` in favor of `bin/rails stats`.
154
+
155
+ *Juan Vásquez*
156
+
157
+ * Add internal page `/rails/info/notes`, that displays the same information as `bin/rails notes`.
158
+
159
+ *Deepak Mahakale*
160
+
161
+ * Add Rubocop and GitHub Actions to plugin generator.
162
+ This can be skipped using --skip-rubocop and --skip-ci.
163
+
164
+ *Chris Oliver*
165
+
166
+ * Use Kamal for deployment by default, which includes generating a Rails-specific config/deploy.yml.
167
+ This can be skipped using --skip-kamal. See more: https://kamal-deploy.org/
168
+
169
+ *DHH*
170
+
171
+ Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/railties/CHANGELOG.md) for previous changes.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) David Heinemeier Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/RDOC_MAIN.md ADDED
@@ -0,0 +1,99 @@
1
+ # Welcome to \Rails
2
+
3
+ ## What's \Rails?
4
+
5
+ \Rails is a web-application framework that includes everything needed to
6
+ create database-backed web applications according to the
7
+ [Model-View-Controller (MVC)](https://en.wikipedia.org/wiki/Model-view-controller)
8
+ pattern.
9
+
10
+ Understanding the MVC pattern is key to understanding \Rails. MVC divides your
11
+ application into three layers: Model, View, and Controller, each with a specific responsibility.
12
+
13
+ ## Model layer
14
+
15
+ The _**Model layer**_ represents the domain model (such as Account, Product,
16
+ Person, Post, etc.) and encapsulates the business logic specific to
17
+ your application. In \Rails, database-backed model classes are derived from
18
+ `ActiveRecord::Base`. [Active Record](files/activerecord/README.rdoc) allows you to present the data from
19
+ database rows as objects and embellish these data objects with business logic
20
+ methods.
21
+ Although most \Rails models are backed by a database, models can also be ordinary
22
+ Ruby classes, or Ruby classes that implement a set of interfaces as provided by
23
+ the [Active Model](files/activemodel/README.rdoc) module.
24
+
25
+ ## View layer
26
+
27
+ The _**View layer**_ is composed of "templates" that are responsible for providing
28
+ appropriate representations of your application's resources. Templates can
29
+ come in a variety of formats, but most view templates are HTML with embedded
30
+ Ruby code (\ERB files). Views are typically rendered to generate a controller response
31
+ or to generate the body of an email. In \Rails, View generation is handled by [Action View](files/actionview/README.rdoc).
32
+
33
+ ## Controller layer
34
+
35
+ The _**Controller layer**_ is responsible for handling incoming HTTP requests and
36
+ providing a suitable response. Usually, this means returning HTML, but \Rails controllers
37
+ can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and
38
+ manipulate models, and render view templates in order to generate the appropriate HTTP response.
39
+ In \Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and
40
+ controller classes are derived from `ActionController::Base`. Action Dispatch and Action Controller
41
+ are bundled together in [Action Pack](files/actionpack/README.rdoc).
42
+
43
+ ## Frameworks and libraries
44
+
45
+ [Active Record](files/activerecord/README.rdoc), [Active Model](files/activemodel/README.rdoc), [Action Pack](files/actionpack/README.rdoc), and [Action View](files/actionview/README.rdoc) can each be used independently outside \Rails.
46
+
47
+ In addition to that, \Rails also comes with:
48
+
49
+ - [Action Mailer](files/actionmailer/README.rdoc), a library to generate and send emails
50
+ - [Action Mailbox](files/actionmailbox/README.md), a library to receive emails within a \Rails application
51
+ - [Active Job](files/activejob/README.md), a framework for declaring jobs and making them run on a variety of queuing backends
52
+ - [Action Cable](files/actioncable/README.md), a framework to integrate WebSockets with a \Rails application
53
+ - [Active Storage](files/activestorage/README.md), a library to attach cloud and local files to \Rails applications
54
+ - [Action Text](files/actiontext/README.md), a library to handle rich text content
55
+ - [Active Support](files/activesupport/README.rdoc), a collection of utility classes and standard library extensions that are useful for \Rails, and may also be used independently outside \Rails
56
+
57
+ ## Getting Started
58
+
59
+ 1. Install \Rails at the command prompt if you haven't yet:
60
+
61
+ $ gem install rails
62
+
63
+ 2. At the command prompt, create a new \Rails application:
64
+
65
+ $ rails new myapp
66
+
67
+ where "myapp" is the application name.
68
+
69
+ 3. Change directory to `myapp` and start the web server:
70
+
71
+ $ cd myapp
72
+ $ bin/rails server
73
+
74
+ Run with `--help` or `-h` for options.
75
+
76
+ 4. Go to `http://localhost:3000` and you'll see the \Rails bootscreen with your
77
+ \Rails and Ruby versions.
78
+
79
+ 5. Follow the guidelines to start developing your application. You may find the
80
+ following resources handy:
81
+
82
+ * [Getting Started with Rails](https://guides.rubyonrails.org/getting_started.html)
83
+ * [Ruby on Rails Guides](https://guides.rubyonrails.org)
84
+ * [The API Documentation](https://api.rubyonrails.org)
85
+
86
+ ## Contributing
87
+
88
+ We encourage you to contribute to Ruby on \Rails! Please check out the
89
+ [Contributing to Ruby on Rails guide](https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html) for guidelines about how to proceed. [Join us!](https://contributors.rubyonrails.org)
90
+
91
+ Trying to report a possible security vulnerability in \Rails? Please
92
+ check out our [security policy](https://rubyonrails.org/security) for
93
+ guidelines about how to proceed.
94
+
95
+ Everyone interacting in \Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the \Rails [code of conduct](https://rubyonrails.org/conduct).
96
+
97
+ ## License
98
+
99
+ Ruby on \Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
data/README.rdoc ADDED
@@ -0,0 +1,39 @@
1
+ = Railties -- Gluing the Engine to the \Rails
2
+
3
+ Railties is responsible for gluing all frameworks together. Overall, it:
4
+
5
+ * handles the bootstrapping process for a \Rails application;
6
+
7
+ * manages the +rails+ command line interface;
8
+
9
+ * and provides the \Rails generators core.
10
+
11
+ == Download
12
+
13
+ The latest version of Railties can be installed with RubyGems:
14
+
15
+ * gem install railties
16
+
17
+ Source code can be downloaded as part of the \Rails project on GitHub
18
+
19
+ * https://github.com/rails/rails/tree/main/railties
20
+
21
+ == License
22
+
23
+ Railties is released under the MIT license:
24
+
25
+ * https://opensource.org/licenses/MIT
26
+
27
+ == Support
28
+
29
+ API documentation is at
30
+
31
+ * https://api.rubyonrails.org
32
+
33
+ Bug reports can be filed for the Ruby on \Rails project here:
34
+
35
+ * https://github.com/rails/rails/issues
36
+
37
+ Feature requests should be discussed on the rails-core mailing list here:
38
+
39
+ * https://discuss.rubyonrails.org/c/rubyonrails-core
data/exe/rails ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ git_path = File.expand_path("../../.git", __dir__)
5
+
6
+ if File.exist?(git_path)
7
+ railties_path = File.expand_path("../lib", __dir__)
8
+ $:.unshift(railties_path)
9
+ end
10
+ require "rails/cli"
@@ -0,0 +1,140 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/module/attribute_accessors"
4
+ require "rails/test_unit/reporter"
5
+ require "rails/test_unit/runner"
6
+
7
+ module Minitest
8
+ class BacktraceFilterWithFallback
9
+ def initialize(preferred, fallback)
10
+ @preferred = preferred
11
+ @fallback = fallback
12
+ end
13
+
14
+ def filter(backtrace)
15
+ filtered = @preferred.filter(backtrace)
16
+ filtered = @fallback.filter(backtrace) if filtered.empty?
17
+ filtered
18
+ end
19
+ end
20
+
21
+ class SuppressedSummaryReporter < SummaryReporter
22
+ # Disable extra failure output after a run if output is inline.
23
+ def aggregated_results(*)
24
+ super unless options[:output_inline]
25
+ end
26
+ end
27
+
28
+ class ProfileReporter < StatisticsReporter
29
+ def initialize(io = $stdout, options = {})
30
+ super
31
+ @results = []
32
+ @count = options[:profile]
33
+ end
34
+
35
+ def record(result)
36
+ @results << result
37
+ end
38
+
39
+ def report
40
+ total_time = @results.sum(&:time)
41
+
42
+ @results.sort! { |a, b| b.time <=> a.time }
43
+ slow_results = @results.take(@count)
44
+ slow_tests_total_time = slow_results.sum(&:time)
45
+
46
+ ratio = (total_time == 0) ? 0.0 : (slow_tests_total_time / total_time) * 100
47
+
48
+ io.puts("\nTop %d slowest tests (%.2f seconds, %.1f%% of total time):\n" % [slow_results.size, slow_tests_total_time, ratio])
49
+ slow_results.each do |result|
50
+ io.puts(" %s\n %.4f seconds %s\n" % [result.location, result.time, source_location(result)])
51
+ end
52
+ io.puts("\n")
53
+ end
54
+
55
+ private
56
+ def source_location(result)
57
+ filename, line = result.source_location
58
+ return "" unless filename
59
+
60
+ pwd = Dir.pwd
61
+ if filename.start_with?(pwd)
62
+ filename = Pathname.new(filename).relative_path_from(pwd)
63
+ end
64
+ "#{filename}:#{line}"
65
+ end
66
+ end
67
+
68
+ def self.plugin_rails_options(opts, options)
69
+ ::Rails::TestUnit::Runner.attach_before_load_options(opts)
70
+
71
+ opts.on("-b", "--backtrace", "Show the complete backtrace") do
72
+ options[:full_backtrace] = true
73
+ end
74
+
75
+ opts.on("-d", "--defer-output", "Output test failures and errors after the test run") do
76
+ options[:output_inline] = false
77
+ end
78
+
79
+ opts.on("-f", "--fail-fast", "Abort test run on first failure or error") do
80
+ options[:fail_fast] = true
81
+ end
82
+
83
+ opts.on("-c", "--[no-]color", "Enable color in the output") do |value|
84
+ options[:color] = value
85
+ end
86
+
87
+ opts.on("--profile [COUNT]", "Enable profiling of tests and list the slowest test cases (default: 10)") do |value|
88
+ default_count = 10
89
+
90
+ if value.nil?
91
+ count = default_count
92
+ else
93
+ count = Integer(value, exception: false)
94
+ if count.nil?
95
+ warn("Non integer specified as profile count, separate " \
96
+ "your path from options with -- e.g. " \
97
+ "`#{::Rails::TestUnitReporter.executable} --profile -- #{value}`")
98
+ count = default_count
99
+ end
100
+ end
101
+
102
+ options[:profile] = count
103
+ end
104
+
105
+ options[:color] = true
106
+ options[:output_inline] = true
107
+ end
108
+
109
+ # Owes great inspiration to test runner trailblazers like RSpec,
110
+ # minitest-reporters, maxitest, and others.
111
+ def self.plugin_rails_init(options)
112
+ # Don't mess with Minitest unless RAILS_ENV is set
113
+ return unless ENV["RAILS_ENV"] || ENV["RAILS_MINITEST_PLUGIN"]
114
+
115
+ unless options[:full_backtrace]
116
+ # Plugin can run without Rails loaded, check before filtering.
117
+ if ::Rails.respond_to?(:backtrace_cleaner)
118
+ Minitest.backtrace_filter = BacktraceFilterWithFallback.new(::Rails.backtrace_cleaner, Minitest.backtrace_filter)
119
+ end
120
+ end
121
+
122
+ # Suppress summary reports when outputting inline rerun snippets.
123
+ if reporter.reporters.reject! { |reporter| reporter.kind_of?(SummaryReporter) }
124
+ reporter << SuppressedSummaryReporter.new(options[:io], options)
125
+ end
126
+
127
+ # Replace progress reporter for colors.
128
+ if reporter.reporters.reject! { |reporter| reporter.kind_of?(ProgressReporter) }
129
+ reporter << ::Rails::TestUnitReporter.new(options[:io], options)
130
+ end
131
+
132
+ # Add slowest tests reporter at the end.
133
+ if options[:profile]
134
+ reporter << ProfileReporter.new(options[:io], options)
135
+ end
136
+ end
137
+
138
+ # Backwards compatibility with Rails 5.0 generated plugin test scripts
139
+ mattr_reader :run_via, default: {}
140
+ end
data/lib/rails/all.rb ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails"
4
+
5
+ %w(
6
+ active_record/railtie
7
+ active_storage/engine
8
+ action_controller/railtie
9
+ action_view/railtie
10
+ action_mailer/railtie
11
+ active_job/railtie
12
+ action_cable/engine
13
+ action_mailbox/engine
14
+ action_text/engine
15
+ rails/test_unit/railtie
16
+ ).each do |railtie|
17
+ begin # rubocop:disable Style/RedundantBegin
18
+ require railtie
19
+ rescue LoadError
20
+ end
21
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sdoc"
4
+ require "active_support/core_ext/array/extract"
5
+
6
+ class RDoc::Generator::API < RDoc::Generator::SDoc # :nodoc:
7
+ RDoc::RDoc.add_generator self
8
+
9
+ def generate_class_tree_level(classes, visited = {})
10
+ # Only process core extensions on the first visit and remove
11
+ # Active Storage duplicated classes that are at the top level
12
+ # since they aren't nested under a definition of the `ActiveStorage` module.
13
+ if visited.empty?
14
+ classes = classes.reject { |klass| active_storage?(klass) }
15
+ core_exts = classes.extract! { |klass| core_extension?(klass) }
16
+
17
+ super.unshift([ "Core extensions", "", "", build_core_ext_subtree(core_exts, visited) ])
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ private
24
+ def build_core_ext_subtree(classes, visited)
25
+ classes.map do |klass|
26
+ [ klass.name, klass.document_self_or_methods ? klass.path : "", "",
27
+ generate_class_tree_level(klass.classes_and_modules, visited) ]
28
+ end
29
+ end
30
+
31
+ def core_extension?(klass)
32
+ klass.name != "ActiveSupport" && klass.in_files.any? { |file| file.absolute_name.include?("core_ext") }
33
+ end
34
+
35
+ def active_storage?(klass)
36
+ klass.name != "ActiveStorage" && klass.in_files.all? { |file| file.absolute_name.include?("active_storage") }
37
+ end
38
+ end