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
@@ -0,0 +1,499 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/hash/except"
4
+ require "rails/generators/rails/app/app_generator"
5
+ require "date"
6
+
7
+ module Rails
8
+ # The plugin builder allows you to override elements of the plugin
9
+ # generator without being forced to reverse the operations of the default
10
+ # generator.
11
+ #
12
+ # This allows you to override entire operations, like the creation of the
13
+ # Gemfile, \README, or JavaScript files, without needing to know exactly
14
+ # what those operations do so you can create another template action.
15
+ class PluginBuilder
16
+ def rakefile
17
+ template "Rakefile"
18
+ end
19
+
20
+ def app
21
+ if mountable?
22
+ if api?
23
+ directory "app", exclude_pattern: %r{app/(views|helpers)}
24
+ else
25
+ directory "app"
26
+ empty_directory_with_keep_file "app/assets/images/#{namespaced_name}"
27
+ end
28
+
29
+ empty_directory_with_keep_file "app/models/concerns"
30
+ empty_directory_with_keep_file "app/controllers/concerns"
31
+ remove_dir "app/mailers" if options[:skip_action_mailer]
32
+ remove_dir "app/jobs" if options[:skip_active_job]
33
+ elsif full?
34
+ empty_directory_with_keep_file "app/models"
35
+ empty_directory_with_keep_file "app/controllers"
36
+ empty_directory_with_keep_file "app/models/concerns"
37
+ empty_directory_with_keep_file "app/controllers/concerns"
38
+ empty_directory_with_keep_file "app/mailers" unless options[:skip_action_mailer]
39
+ empty_directory_with_keep_file "app/jobs" unless options[:skip_active_job]
40
+
41
+ unless api?
42
+ empty_directory_with_keep_file "app/assets/images/#{namespaced_name}"
43
+ empty_directory_with_keep_file "app/helpers"
44
+ empty_directory_with_keep_file "app/views"
45
+ end
46
+ end
47
+ end
48
+
49
+ def readme
50
+ template "README.md"
51
+ end
52
+
53
+ def gemfile
54
+ template "Gemfile"
55
+ end
56
+
57
+ def license
58
+ template "MIT-LICENSE" unless inside_application?
59
+ end
60
+
61
+ def gemspec
62
+ template "%name%.gemspec"
63
+ end
64
+
65
+ def gitignore
66
+ template "gitignore", ".gitignore"
67
+ end
68
+
69
+ def cifiles
70
+ empty_directory ".github/workflows"
71
+ template "github/ci.yml", ".github/workflows/ci.yml"
72
+ template "github/dependabot.yml", ".github/dependabot.yml"
73
+ end
74
+
75
+ def rubocop
76
+ template "rubocop.yml", ".rubocop.yml"
77
+ end
78
+
79
+ def version_control
80
+ if !options[:skip_git] && !options[:pretend]
81
+ run git_init_command, capture: options[:quiet], abort_on_failure: false
82
+ end
83
+ end
84
+
85
+ def lib
86
+ template "lib/%namespaced_name%.rb"
87
+ template "lib/tasks/%namespaced_name%_tasks.rake"
88
+ template "lib/%namespaced_name%/version.rb"
89
+
90
+ if engine?
91
+ template "lib/%namespaced_name%/engine.rb"
92
+ else
93
+ template "lib/%namespaced_name%/railtie.rb"
94
+ end
95
+ end
96
+
97
+ def config
98
+ template "config/routes.rb" if engine?
99
+ end
100
+
101
+ def test
102
+ template "test/test_helper.rb"
103
+ template "test/%namespaced_name%_test.rb"
104
+
105
+ if engine?
106
+ empty_directory_with_keep_file "test/fixtures/files"
107
+ empty_directory_with_keep_file "test/controllers"
108
+ empty_directory_with_keep_file "test/mailers"
109
+ empty_directory_with_keep_file "test/models"
110
+ empty_directory_with_keep_file "test/integration"
111
+
112
+ unless api?
113
+ empty_directory_with_keep_file "test/helpers"
114
+ end
115
+
116
+ template "test/integration/navigation_test.rb"
117
+ end
118
+ end
119
+
120
+ DUMMY_IGNORE_OPTIONS = %i[dev edge master template]
121
+
122
+ def generate_test_dummy(force = false)
123
+ opts = options.transform_keys(&:to_sym).except(*DUMMY_IGNORE_OPTIONS)
124
+ opts[:force] = force
125
+ opts[:skip_thruster] = true
126
+ opts[:skip_brakeman] = true
127
+ opts[:skip_bundle] = true
128
+ opts[:skip_ci] = true
129
+ opts[:skip_kamal] = true
130
+ opts[:skip_solid] = true
131
+ opts[:skip_git] = true
132
+ opts[:skip_hotwire] = true
133
+ opts[:skip_rubocop] = true
134
+ opts[:dummy_app] = true
135
+
136
+ invoke Rails::Generators::AppGenerator,
137
+ [ File.expand_path(dummy_path, destination_root) ], opts
138
+ end
139
+
140
+ def test_dummy_config
141
+ template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true
142
+
143
+ if mountable?
144
+ template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
145
+ end
146
+ if engine? && !api?
147
+ insert_into_file "#{dummy_path}/config/application.rb", indent(<<~RUBY, 4), after: /^\s*config\.load_defaults.*\n/
148
+
149
+ # For compatibility with applications that use this config
150
+ config.action_controller.include_all_helpers = false
151
+ RUBY
152
+ end
153
+ end
154
+
155
+ def test_dummy_assets
156
+ template "rails/stylesheets.css", "#{dummy_path}/app/assets/stylesheets/application.css", force: true
157
+ end
158
+
159
+ def test_dummy_clean
160
+ inside dummy_path do
161
+ remove_file ".ruby-version"
162
+ remove_dir "db"
163
+ remove_file "Gemfile"
164
+ remove_dir "lib"
165
+ remove_file "public/robots.txt"
166
+ remove_file "README.md"
167
+ remove_file "test"
168
+ remove_file "vendor"
169
+ end
170
+ end
171
+
172
+ def stylesheets
173
+ if mountable?
174
+ copy_file "rails/stylesheets.css",
175
+ "app/assets/stylesheets/#{namespaced_name}/application.css"
176
+ elsif full?
177
+ empty_directory_with_keep_file "app/assets/stylesheets/#{namespaced_name}"
178
+ end
179
+ end
180
+
181
+ def bin
182
+ exclude_pattern = Regexp.union([(engine? ? /test\.tt/ : /rails\.tt/), (/rubocop/ if skip_rubocop?)].compact)
183
+ directory "bin", { exclude_pattern: exclude_pattern } do |content|
184
+ "#{shebang}\n" + content
185
+ end
186
+ chmod "bin", 0755 & ~File.umask, verbose: false
187
+ end
188
+
189
+ def gemfile_entry
190
+ return unless inside_application?
191
+
192
+ gemfile_in_app_path = File.join(rails_app_path, "Gemfile")
193
+ if File.exist? gemfile_in_app_path
194
+ entry = %{\ngem "#{name}", path: "#{relative_path}"}
195
+ append_file gemfile_in_app_path, entry
196
+ end
197
+ end
198
+ end
199
+
200
+ module Generators
201
+ class PluginGenerator < AppBase # :nodoc:
202
+ add_shared_options_for "plugin"
203
+
204
+ alias_method :plugin_path, :app_path
205
+
206
+ class_option :dummy_path, type: :string, default: "test/dummy",
207
+ desc: "Create dummy application at given path"
208
+
209
+ class_option :full, type: :boolean, default: false,
210
+ desc: "Generate a rails engine with bundled Rails application for testing"
211
+
212
+ class_option :mountable, type: :boolean, default: false,
213
+ desc: "Generate mountable isolated engine"
214
+
215
+ class_option :skip_gemspec, type: :boolean, default: false,
216
+ desc: "Skip gemspec file"
217
+
218
+ class_option :skip_gemfile_entry, type: :boolean, default: false,
219
+ desc: "If creating plugin in application's directory " \
220
+ "skip adding entry to Gemfile"
221
+
222
+ class_option :api, type: :boolean, default: false,
223
+ desc: "Generate a smaller stack for API application plugins"
224
+
225
+ def initialize(*args)
226
+ @dummy_path = nil
227
+ super
228
+ imply_options
229
+
230
+ if !engine? || !with_dummy_app?
231
+ self.options = options.merge(skip_asset_pipeline: true).freeze
232
+ end
233
+ end
234
+
235
+ public_task :report_implied_options
236
+ public_task :set_default_accessors!
237
+ public_task :create_root
238
+
239
+ def target_rails_prerelease
240
+ super("plugin new")
241
+ end
242
+
243
+ def create_root_files
244
+ build(:readme)
245
+ build(:rakefile)
246
+ build(:gemspec) unless options[:skip_gemspec]
247
+ build(:license)
248
+ build(:gitignore) unless options[:skip_git]
249
+ build(:gemfile)
250
+ build(:version_control)
251
+ end
252
+
253
+ def create_app_files
254
+ build(:app)
255
+ end
256
+
257
+ def create_rubocop_file
258
+ return if skip_rubocop?
259
+ build(:rubocop)
260
+ end
261
+
262
+ def create_cifiles
263
+ return if skip_ci?
264
+ build(:cifiles)
265
+ end
266
+
267
+ def create_config_files
268
+ build(:config)
269
+ end
270
+
271
+ def create_lib_files
272
+ build(:lib)
273
+ end
274
+
275
+ def create_assets_manifest_file
276
+ build(:assets_manifest) if !api? && engine?
277
+ end
278
+
279
+ def create_public_stylesheets_files
280
+ build(:stylesheets) unless api?
281
+ end
282
+
283
+ def create_bin_files
284
+ build(:bin)
285
+ end
286
+
287
+ def create_test_files
288
+ build(:test) unless options[:skip_test]
289
+ end
290
+
291
+ def create_test_dummy_files
292
+ return unless with_dummy_app?
293
+ create_dummy_app
294
+ end
295
+
296
+ def update_gemfile
297
+ build(:gemfile_entry) unless options[:skip_gemfile_entry]
298
+ end
299
+
300
+ def finish_template
301
+ build(:leftovers)
302
+ end
303
+
304
+ public_task :apply_rails_template
305
+
306
+ def name
307
+ @name ||= begin
308
+ # same as ActiveSupport::Inflector#underscore except not replacing '-'
309
+ underscored = original_name.dup
310
+ underscored.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
311
+ underscored.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
312
+ underscored.downcase!
313
+
314
+ underscored
315
+ end
316
+ end
317
+
318
+ def underscored_name
319
+ @underscored_name ||= original_name.underscore
320
+ end
321
+
322
+ def namespaced_name
323
+ @namespaced_name ||= name.tr("-", "/")
324
+ end
325
+
326
+ private
327
+ def gemfile_entries
328
+ [
329
+ rails_gemfile_entry,
330
+ simplify_gemfile_entries(
331
+ web_server_gemfile_entry,
332
+ database_gemfile_entry,
333
+ asset_pipeline_gemfile_entry,
334
+ ),
335
+ ].flatten.compact
336
+ end
337
+
338
+ def rails_gemfile_entry
339
+ if options[:skip_gemspec]
340
+ super
341
+ elsif rails_prerelease?
342
+ super.dup.tap do |entry|
343
+ entry.comment = <<~COMMENT
344
+ Your gem is dependent on a prerelease version of Rails. Once you can lock this
345
+ dependency down to a specific version, move it to your gemspec.
346
+ COMMENT
347
+ end
348
+ end
349
+ end
350
+
351
+ def simplify_gemfile_entries(*gemfile_entries)
352
+ gemfile_entries.flatten.compact.map { |entry| GemfileEntry.floats(entry.name) }
353
+ end
354
+
355
+ def create_dummy_app(path = nil)
356
+ dummy_path(path) if path
357
+
358
+ say_status :vendor_app, dummy_path
359
+ mute do
360
+ build(:generate_test_dummy)
361
+ build(:test_dummy_config)
362
+ build(:test_dummy_assets) unless skip_asset_pipeline?
363
+ build(:test_dummy_clean)
364
+ # ensure that bin/rails has proper dummy_path
365
+ build(:bin)
366
+ end
367
+ end
368
+
369
+ def engine?
370
+ full? || mountable? || options[:engine]
371
+ end
372
+
373
+ def full?
374
+ options[:full]
375
+ end
376
+
377
+ def mountable?
378
+ options[:mountable]
379
+ end
380
+
381
+ def skip_git?
382
+ options[:skip_git]
383
+ end
384
+
385
+ def with_dummy_app?
386
+ options[:skip_test].blank? || options[:dummy_path] != "test/dummy"
387
+ end
388
+
389
+ def api?
390
+ options[:api]
391
+ end
392
+
393
+ def self.banner
394
+ "rails plugin new #{arguments.map(&:usage).join(' ')} [options]"
395
+ end
396
+
397
+ def original_name
398
+ @original_name ||= File.basename(destination_root)
399
+ end
400
+
401
+ def modules
402
+ @modules ||= namespaced_name.camelize.split("::")
403
+ end
404
+
405
+ def wrap_in_modules(unwrapped_code)
406
+ unwrapped_code = "#{unwrapped_code}".strip.gsub(/\s$\n/, "")
407
+ modules.reverse.inject(unwrapped_code) do |content, mod|
408
+ str = +"module #{mod}\n"
409
+ str << content.lines.map { |line| " #{line}" }.join
410
+ str << (content.present? ? "\nend" : "end")
411
+ end
412
+ end
413
+
414
+ def camelized_modules
415
+ @camelized_modules ||= namespaced_name.camelize
416
+ end
417
+
418
+ def humanized
419
+ @humanized ||= original_name.underscore.humanize
420
+ end
421
+
422
+ def camelized
423
+ @camelized ||= name.gsub(/\W/, "_").squeeze("_").camelize
424
+ end
425
+
426
+ def author
427
+ default = "TODO: Write your name"
428
+ if skip_git?
429
+ @author = default
430
+ else
431
+ @author = `git config user.name`.chomp rescue default
432
+ end
433
+ end
434
+
435
+ def email
436
+ default = "TODO: Write your email address"
437
+ if skip_git?
438
+ @email = default
439
+ else
440
+ @email = `git config user.email`.chomp rescue default
441
+ end
442
+ end
443
+
444
+ def rails_version_specifier(gem_version = Rails.gem_version)
445
+ [">= #{gem_version}"]
446
+ end
447
+
448
+ def valid_const?
449
+ if /-\d/.match?(original_name)
450
+ raise Error, "Invalid plugin name #{original_name}. Please give a name which does not contain a namespace starting with numeric characters."
451
+ elsif /[^\w-]+/.match?(original_name)
452
+ raise Error, "Invalid plugin name #{original_name}. Please give a name which uses only alphabetic, numeric, \"_\" or \"-\" characters."
453
+ elsif /^\d/.match?(camelized)
454
+ raise Error, "Invalid plugin name #{original_name}. Please give a name which does not start with numbers."
455
+ elsif RESERVED_NAMES.include?(name)
456
+ raise Error, "Invalid plugin name #{original_name}. Please give a " \
457
+ "name which does not match one of the reserved rails " \
458
+ "words: #{RESERVED_NAMES.join(", ")}"
459
+ elsif Object.const_defined?(camelized)
460
+ raise Error, "Invalid plugin name #{original_name}, constant #{camelized} is already in use. Please choose another plugin name."
461
+ end
462
+ end
463
+
464
+ def get_builder_class
465
+ defined?(::PluginBuilder) ? ::PluginBuilder : Rails::PluginBuilder
466
+ end
467
+
468
+ def dummy_path(path = nil)
469
+ @dummy_path = path if path
470
+ @dummy_path || options[:dummy_path]
471
+ end
472
+
473
+ def mute(&block)
474
+ shell.mute(&block)
475
+ end
476
+
477
+ def rails_app_path
478
+ APP_PATH.sub("/config/application", "") if defined?(APP_PATH)
479
+ end
480
+
481
+ def inside_application?
482
+ rails_app_path && destination_root.start_with?(rails_app_path.to_s)
483
+ end
484
+
485
+ def relative_path
486
+ return unless inside_application?
487
+ app_path.delete_prefix("#{rails_app_path}/")
488
+ end
489
+
490
+ def test_command
491
+ if engine? && !options[:skip_active_record] && with_dummy_app?
492
+ "db:test:prepare test"
493
+ else
494
+ "test"
495
+ end
496
+ end
497
+ end
498
+ end
499
+ end
@@ -0,0 +1,28 @@
1
+ require_relative "lib/<%= namespaced_name %>/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = <%= name.inspect %>
5
+ spec.version = <%= camelized_modules %>::VERSION
6
+ spec.authors = [ <%= author.inspect %> ]
7
+ spec.email = [ <%= email.inspect %> ]
8
+ spec.homepage = "TODO"
9
+ spec.summary = "TODO: Summary of <%= camelized_modules %>."
10
+ spec.description = "TODO: Description of <%= camelized_modules %>."
11
+ <%- unless inside_application? -%>
12
+ spec.license = "MIT"
13
+ <%- end -%>
14
+
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
21
+ spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
25
+ end
26
+
27
+ <%= "# " if rails_prerelease? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
28
+ end
@@ -0,0 +1,23 @@
1
+ source "https://rubygems.org"
2
+ <% unless options[:skip_gemspec] -%>
3
+
4
+ # Specify your gem's dependencies in <%= name %>.gemspec.
5
+ gemspec
6
+ <% end -%>
7
+ <% gemfile_entries.each do |gemfile_entry| %>
8
+ <%= gemfile_entry %>
9
+ <% end -%>
10
+ <%- unless options.skip_rubocop? -%>
11
+
12
+ # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
13
+ gem "rubocop-rails-omakase", require: false
14
+ <%- end -%>
15
+ <% if RUBY_ENGINE == "ruby" -%>
16
+
17
+ # Start debugger with binding.b [https://github.com/ruby/debug]
18
+ # gem "debug", ">= 1.0.0"
19
+ <% end -%>
20
+ <% if RUBY_PLATFORM.match?(/mingw|mswin|java/) -%>
21
+
22
+ gem "tzinfo-data", platforms: %i[ <%= bundler_windows_platforms %> jruby ]
23
+ <% end -%>
@@ -0,0 +1,20 @@
1
+ Copyright <%= author %>
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.
@@ -0,0 +1,28 @@
1
+ # <%= camelized_modules %>
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem "<%= name %>"
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install <%= name %>
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,14 @@
1
+ require "bundler/setup"
2
+ <% if engine? && !options[:skip_active_record] && with_dummy_app? -%>
3
+
4
+ APP_RAKEFILE = File.expand_path("<%= dummy_path -%>/Rakefile", __dir__)
5
+ load "rails/tasks/engine.rake"
6
+ <% end -%>
7
+ <% if engine? -%>
8
+
9
+ load "rails/tasks/statistics.rake"
10
+ <% end -%>
11
+ <% unless options[:skip_gemspec] -%>
12
+
13
+ require "bundler/gem_tasks"
14
+ <% end -%>
@@ -0,0 +1,5 @@
1
+ <%= wrap_in_modules <<~rb
2
+ class ApplicationController < ActionController::#{api? ? "API" : "Base"}
3
+ end
4
+ rb
5
+ %>
@@ -0,0 +1,5 @@
1
+ <%= wrap_in_modules <<~rb
2
+ module ApplicationHelper
3
+ end
4
+ rb
5
+ %>
@@ -0,0 +1,5 @@
1
+ <%= wrap_in_modules <<~rb
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ rb
5
+ %>
@@ -0,0 +1,7 @@
1
+ <%= wrap_in_modules <<~rb
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ rb
7
+ %>
@@ -0,0 +1,6 @@
1
+ <%= wrap_in_modules <<~rb
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ rb
6
+ %>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= humanized %></title>
5
+ <%%= csrf_meta_tags %>
6
+ <%%= csp_meta_tag %>
7
+
8
+ <%%= yield :head %>
9
+
10
+ <%%= stylesheet_link_tag "<%= namespaced_name %>/application", media: "all" %>
11
+ </head>
12
+ <body>
13
+
14
+ <%%= yield %>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1,15 @@
1
+ # This command will automatically be run when you run "rails" with Rails gems
2
+ # installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path("..", __dir__)
5
+ ENGINE_PATH = File.expand_path("../lib/<%= namespaced_name -%>/engine", __dir__)
6
+ <% if with_dummy_app? -%>
7
+ APP_PATH = File.expand_path("../<%= dummy_path -%>/config/application", __dir__)
8
+ <% end -%>
9
+
10
+ # Set up gems listed in the Gemfile.
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
13
+
14
+ <%= rails_require_statement %>
15
+ require "rails/engine/commands"
@@ -0,0 +1,7 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+
4
+ # explicit rubocop config increases performance slightly while avoiding config confusion.
5
+ ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
6
+
7
+ load Gem.bin_path("rubocop", "rubocop")