railties 6.0.0 → 7.1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +699 -245
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.md +99 -0
- data/README.rdoc +7 -8
- data/lib/minitest/rails_plugin.rb +80 -2
- data/lib/rails/all.rb +0 -1
- data/lib/rails/api/task.rb +37 -5
- data/lib/rails/app_updater.rb +9 -6
- data/lib/rails/application/bootstrap.rb +52 -14
- data/lib/rails/application/configuration.rb +327 -86
- data/lib/rails/application/default_middleware_stack.rb +33 -7
- data/lib/rails/application/dummy_config.rb +19 -0
- data/lib/rails/application/finisher.rb +94 -113
- data/lib/rails/application/routes_reloader.rb +17 -3
- data/lib/rails/application.rb +258 -201
- data/lib/rails/application_controller.rb +3 -4
- data/lib/rails/autoloaders/inflector.rb +21 -0
- data/lib/rails/autoloaders.rb +42 -42
- data/lib/rails/backtrace_cleaner.rb +13 -8
- data/lib/rails/cli.rb +5 -2
- data/lib/rails/code_statistics.rb +6 -4
- data/lib/rails/code_statistics_calculator.rb +16 -7
- data/lib/rails/command/actions.rb +10 -12
- data/lib/rails/command/base.rb +66 -46
- data/lib/rails/command/behavior.rb +3 -3
- data/lib/rails/command/environment_argument.rb +33 -17
- data/lib/rails/command/helpers/editor.rb +17 -12
- data/lib/rails/command.rb +90 -32
- data/lib/rails/commands/about/about_command.rb +14 -0
- data/lib/rails/commands/application/application_command.rb +2 -0
- data/lib/rails/commands/console/console_command.rb +17 -13
- data/lib/rails/commands/credentials/USAGE +54 -39
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +53 -0
- data/lib/rails/commands/credentials/credentials_command.rb +83 -60
- data/lib/rails/commands/db/system/change/change_command.rb +8 -2
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +39 -124
- data/lib/rails/commands/destroy/destroy_command.rb +3 -2
- data/lib/rails/commands/dev/dev_command.rb +1 -6
- data/lib/rails/commands/encrypted/USAGE +15 -20
- data/lib/rails/commands/encrypted/encrypted_command.rb +46 -35
- data/lib/rails/commands/gem_help/USAGE +16 -0
- data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
- data/lib/rails/commands/generate/generate_command.rb +3 -3
- data/lib/rails/commands/help/USAGE +15 -14
- data/lib/rails/commands/help/help_command.rb +21 -2
- data/lib/rails/commands/initializers/initializers_command.rb +1 -4
- data/lib/rails/commands/middleware/middleware_command.rb +17 -0
- data/lib/rails/commands/new/new_command.rb +2 -0
- data/lib/rails/commands/notes/notes_command.rb +5 -14
- data/lib/rails/commands/plugin/plugin_command.rb +2 -0
- data/lib/rails/commands/rake/rake_command.rb +27 -23
- data/lib/rails/commands/restart/restart_command.rb +14 -0
- data/lib/rails/commands/routes/routes_command.rb +13 -1
- data/lib/rails/commands/runner/USAGE +14 -12
- data/lib/rails/commands/runner/runner_command.rb +34 -21
- data/lib/rails/commands/secret/secret_command.rb +13 -0
- data/lib/rails/commands/secrets/USAGE +44 -43
- data/lib/rails/commands/secrets/secrets_command.rb +20 -38
- data/lib/rails/commands/server/server_command.rb +40 -64
- data/lib/rails/commands/test/USAGE +14 -0
- data/lib/rails/commands/test/test_command.rb +58 -16
- data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
- data/lib/rails/commands/version/version_command.rb +1 -0
- data/lib/rails/configuration.rb +53 -23
- data/lib/rails/console/app.rb +1 -4
- data/lib/rails/console/helpers.rb +2 -2
- data/lib/rails/deprecator.rb +7 -0
- data/lib/rails/engine/configuration.rb +54 -9
- data/lib/rails/engine/updater.rb +1 -1
- data/lib/rails/engine.rb +105 -81
- data/lib/rails/gem_version.rb +5 -5
- data/lib/rails/generators/actions/create_migration.rb +9 -5
- data/lib/rails/generators/actions.rb +275 -97
- data/lib/rails/generators/active_model.rb +28 -14
- data/lib/rails/generators/app_base.rb +487 -165
- data/lib/rails/generators/app_name.rb +3 -14
- data/lib/rails/generators/base.rb +42 -31
- data/lib/rails/generators/database.rb +41 -4
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +0 -1
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +11 -11
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +11 -28
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
- data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -17
- data/lib/rails/generators/erb.rb +1 -2
- data/lib/rails/generators/generated_attribute.rb +60 -19
- data/lib/rails/generators/migration.rb +4 -8
- data/lib/rails/generators/model_helpers.rb +29 -4
- data/lib/rails/generators/named_base.rb +15 -15
- data/lib/rails/generators/rails/app/USAGE +23 -6
- data/lib/rails/generators/rails/app/app_generator.rb +151 -80
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +103 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +44 -54
- data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +4 -9
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +3 -3
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +2 -2
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +19 -15
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +18 -23
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +5 -6
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +17 -16
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +17 -18
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +14 -13
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
- data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +32 -14
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +42 -55
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +27 -15
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +3 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +21 -28
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +6 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +284 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +13 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +13 -15
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +17 -20
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +8 -1
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -5
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +9 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +12 -9
- data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +13 -11
- data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
- data/lib/rails/generators/rails/benchmark/USAGE +19 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +30 -0
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
- data/lib/rails/generators/rails/controller/USAGE +13 -5
- data/lib/rails/generators/rails/controller/controller_generator.rb +7 -42
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -5
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +30 -25
- data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +31 -1
- data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +6 -2
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
- data/lib/rails/generators/rails/generator/USAGE +2 -2
- data/lib/rails/generators/rails/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
- data/lib/rails/generators/rails/helper/USAGE +2 -3
- data/lib/rails/generators/rails/integration_test/USAGE +2 -2
- data/lib/rails/generators/rails/migration/USAGE +22 -12
- data/lib/rails/generators/rails/model/model_generator.rb +4 -0
- data/lib/rails/generators/rails/plugin/USAGE +17 -6
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +86 -46
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +15 -20
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +10 -39
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +0 -1
- data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +7 -22
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +10 -14
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +3 -3
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
- data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +6 -14
- data/lib/rails/generators/rails/resource/USAGE +4 -4
- data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
- data/lib/rails/generators/rails/scaffold/USAGE +5 -5
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -20
- data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +7 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -6
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +7 -11
- data/lib/rails/generators/rails/system_test/USAGE +2 -2
- data/lib/rails/generators/rails/task/USAGE +3 -3
- data/lib/rails/generators/resource_helpers.rb +2 -2
- data/lib/rails/generators/test_case.rb +3 -3
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +0 -1
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +3 -3
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -5
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +6 -6
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +8 -8
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
- data/lib/rails/generators/testing/assertions.rb +2 -2
- data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +8 -7
- data/lib/rails/generators.rb +43 -45
- data/lib/rails/health_controller.rb +55 -0
- data/lib/rails/info.rb +4 -4
- data/lib/rails/info_controller.rb +30 -13
- data/lib/rails/initializable.rb +1 -1
- data/lib/rails/mailers_controller.rb +18 -9
- data/lib/rails/paths.rb +28 -19
- data/lib/rails/rack/logger.rb +17 -17
- data/lib/rails/rackup/server.rb +15 -0
- data/lib/rails/railtie/configurable.rb +0 -1
- data/lib/rails/railtie/configuration.rb +15 -3
- data/lib/rails/railtie.rb +80 -37
- data/lib/rails/ruby_version_check.rb +5 -3
- data/lib/rails/secrets.rb +14 -9
- data/lib/rails/source_annotation_extractor.rb +69 -34
- data/lib/rails/tasks/engine.rake +8 -11
- data/lib/rails/tasks/framework.rake +4 -6
- data/lib/rails/tasks/log.rake +1 -1
- data/lib/rails/tasks/misc.rake +4 -15
- data/lib/rails/tasks/statistics.rake +9 -6
- data/lib/rails/tasks/tmp.rake +13 -6
- data/lib/rails/tasks/yarn.rake +17 -6
- data/lib/rails/tasks/zeitwerk.rake +16 -41
- data/lib/rails/tasks.rb +0 -6
- data/lib/rails/templates/layouts/application.html.erb +15 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +46 -11
- data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
- data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
- data/lib/rails/templates/rails/welcome/index.html.erb +65 -48
- data/lib/rails/test_help.rb +13 -14
- data/lib/rails/test_unit/line_filtering.rb +1 -1
- data/lib/rails/test_unit/railtie.rb +0 -4
- data/lib/rails/test_unit/reporter.rb +8 -3
- data/lib/rails/test_unit/runner.rb +61 -19
- data/lib/rails/test_unit/test_parser.rb +88 -0
- data/lib/rails/test_unit/testing.rake +17 -36
- data/lib/rails/testing/maintain_test_schema.rb +16 -0
- data/lib/rails/version.rb +1 -1
- data/lib/rails/welcome_controller.rb +1 -0
- data/lib/rails/zeitwerk_checker.rb +15 -0
- data/lib/rails.rb +31 -23
- metadata +89 -58
- data/RDOC_MAIN.rdoc +0 -98
- data/lib/rails/application/dummy_erb_compiler.rb +0 -18
- data/lib/rails/command/spellchecker.rb +0 -58
- data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
- data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -10
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
- data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +0 -45
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
- data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
- data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
- data/lib/rails/generators/rails/assets/USAGE +0 -17
- data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/rails/model/USAGE +0 -114
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
- data/lib/rails/tasks/annotations.rake +0 -22
- data/lib/rails/tasks/dev.rake +0 -11
- data/lib/rails/tasks/initializers.rake +0 -9
- data/lib/rails/tasks/middleware.rake +0 -9
- data/lib/rails/tasks/restart.rake +0 -9
- data/lib/rails/tasks/routes.rake +0 -9
@@ -21,8 +21,8 @@ module Rails
|
|
21
21
|
RUBY
|
22
22
|
end
|
23
23
|
|
24
|
-
def method_missing(
|
25
|
-
@generator.send(
|
24
|
+
def method_missing(...)
|
25
|
+
@generator.send(...)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -54,6 +54,10 @@ module Rails
|
|
54
54
|
template "ruby-version", ".ruby-version"
|
55
55
|
end
|
56
56
|
|
57
|
+
def node_version
|
58
|
+
template "node-version", ".node-version"
|
59
|
+
end
|
60
|
+
|
57
61
|
def gemfile
|
58
62
|
template "Gemfile"
|
59
63
|
end
|
@@ -66,20 +70,28 @@ module Rails
|
|
66
70
|
template "gitignore", ".gitignore"
|
67
71
|
end
|
68
72
|
|
73
|
+
def gitattributes
|
74
|
+
template "gitattributes", ".gitattributes"
|
75
|
+
end
|
76
|
+
|
77
|
+
def dockerfiles
|
78
|
+
template "Dockerfile"
|
79
|
+
template "dockerignore", ".dockerignore"
|
80
|
+
|
81
|
+
template "docker-entrypoint", "bin/docker-entrypoint"
|
82
|
+
chmod "bin/docker-entrypoint", 0755 & ~File.umask, verbose: false
|
83
|
+
end
|
84
|
+
|
69
85
|
def version_control
|
70
86
|
if !options[:skip_git] && !options[:pretend]
|
71
|
-
run
|
87
|
+
run git_init_command, capture: options[:quiet], abort_on_failure: false
|
72
88
|
end
|
73
89
|
end
|
74
90
|
|
75
|
-
def package_json
|
76
|
-
template "package.json"
|
77
|
-
end
|
78
|
-
|
79
91
|
def app
|
80
92
|
directory "app"
|
81
93
|
|
82
|
-
|
94
|
+
empty_directory_with_keep_file "app/assets/images"
|
83
95
|
|
84
96
|
keep_file "app/controllers/concerns"
|
85
97
|
keep_file "app/models/concerns"
|
@@ -94,46 +106,39 @@ module Rails
|
|
94
106
|
|
95
107
|
def bin_when_updating
|
96
108
|
bin
|
97
|
-
|
98
|
-
if options[:skip_javascript]
|
99
|
-
remove_file "bin/yarn"
|
100
|
-
end
|
101
109
|
end
|
102
110
|
|
103
111
|
def config
|
104
112
|
empty_directory "config"
|
105
113
|
|
106
114
|
inside "config" do
|
107
|
-
template "routes.rb"
|
115
|
+
template "routes.rb" unless options[:update]
|
108
116
|
template "application.rb"
|
109
117
|
template "environment.rb"
|
110
|
-
template "cable.yml" unless options[:skip_action_cable]
|
111
|
-
template "puma.rb" unless options[:
|
112
|
-
template "
|
113
|
-
template "storage.yml" unless skip_active_storage?
|
118
|
+
template "cable.yml" unless options[:update] || options[:skip_action_cable]
|
119
|
+
template "puma.rb" unless options[:update]
|
120
|
+
template "storage.yml" unless options[:update] || skip_active_storage?
|
114
121
|
|
115
122
|
directory "environments"
|
116
123
|
directory "initializers"
|
117
|
-
directory "locales"
|
124
|
+
directory "locales" unless options[:update]
|
118
125
|
end
|
119
126
|
end
|
120
127
|
|
121
128
|
def config_when_updating
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
129
|
+
action_cable_config_exist = File.exist?("config/cable.yml")
|
130
|
+
active_storage_config_exist = File.exist?("config/storage.yml")
|
131
|
+
rack_cors_config_exist = File.exist?("config/initializers/cors.rb")
|
132
|
+
assets_config_exist = File.exist?("config/initializers/assets.rb")
|
133
|
+
asset_manifest_exist = File.exist?("app/assets/config/manifest.js")
|
134
|
+
asset_app_stylesheet_exist = File.exist?("app/assets/stylesheets/application.css")
|
135
|
+
csp_config_exist = File.exist?("config/initializers/content_security_policy.rb")
|
136
|
+
permissions_policy_config_exist = File.exist?("config/initializers/permissions_policy.rb")
|
128
137
|
|
129
138
|
@config_target_version = Rails.application.config.loaded_config_version || "5.0"
|
130
139
|
|
131
140
|
config
|
132
141
|
|
133
|
-
unless cookie_serializer_config_exist
|
134
|
-
gsub_file "config/initializers/cookies_serializer.rb", /json(?!,)/, "marshal"
|
135
|
-
end
|
136
|
-
|
137
142
|
if !options[:skip_action_cable] && !action_cable_config_exist
|
138
143
|
template "config/cable.yml"
|
139
144
|
end
|
@@ -142,22 +147,30 @@ module Rails
|
|
142
147
|
template "config/storage.yml"
|
143
148
|
end
|
144
149
|
|
145
|
-
if
|
150
|
+
if skip_sprockets? && skip_propshaft? && !assets_config_exist
|
146
151
|
remove_file "config/initializers/assets.rb"
|
147
152
|
end
|
148
153
|
|
154
|
+
if skip_sprockets? && !asset_manifest_exist
|
155
|
+
remove_file "app/assets/config/manifest.js"
|
156
|
+
end
|
157
|
+
|
158
|
+
if skip_sprockets? && !asset_app_stylesheet_exist
|
159
|
+
remove_file "app/assets/stylesheets/application.css"
|
160
|
+
end
|
161
|
+
|
149
162
|
unless rack_cors_config_exist
|
150
163
|
remove_file "config/initializers/cors.rb"
|
151
164
|
end
|
152
165
|
|
153
166
|
if options[:api]
|
154
|
-
unless cookie_serializer_config_exist
|
155
|
-
remove_file "config/initializers/cookies_serializer.rb"
|
156
|
-
end
|
157
|
-
|
158
167
|
unless csp_config_exist
|
159
168
|
remove_file "config/initializers/content_security_policy.rb"
|
160
169
|
end
|
170
|
+
|
171
|
+
unless permissions_policy_config_exist
|
172
|
+
remove_file "config/initializers/permissions_policy.rb"
|
173
|
+
end
|
161
174
|
end
|
162
175
|
end
|
163
176
|
|
@@ -174,7 +187,15 @@ module Rails
|
|
174
187
|
return if options[:pretend] || options[:dummy_app]
|
175
188
|
|
176
189
|
require "rails/generators/rails/credentials/credentials_generator"
|
177
|
-
Rails::Generators::CredentialsGenerator.new([], quiet:
|
190
|
+
Rails::Generators::CredentialsGenerator.new([], quiet: true).add_credentials_file
|
191
|
+
end
|
192
|
+
|
193
|
+
def credentials_diff_enroll
|
194
|
+
return if options[:skip_decrypted_diffs] || options[:dummy_app] || options[:pretend]
|
195
|
+
|
196
|
+
@generator.shell.mute do
|
197
|
+
rails_command "credentials:diff --enroll", inline: true, shell: @generator.shell
|
198
|
+
end
|
178
199
|
end
|
179
200
|
|
180
201
|
def database_yml
|
@@ -205,7 +226,6 @@ module Rails
|
|
205
226
|
end
|
206
227
|
|
207
228
|
def test
|
208
|
-
empty_directory_with_keep_file "test/fixtures"
|
209
229
|
empty_directory_with_keep_file "test/fixtures/files"
|
210
230
|
empty_directory_with_keep_file "test/controllers"
|
211
231
|
empty_directory_with_keep_file "test/mailers"
|
@@ -225,6 +245,7 @@ module Rails
|
|
225
245
|
|
226
246
|
def tmp
|
227
247
|
empty_directory_with_keep_file "tmp"
|
248
|
+
empty_directory_with_keep_file "tmp/pids"
|
228
249
|
empty_directory "tmp/cache"
|
229
250
|
empty_directory "tmp/cache/assets"
|
230
251
|
end
|
@@ -243,55 +264,86 @@ module Rails
|
|
243
264
|
# can change in Ruby 1.8.7 when we FileUtils.cd.
|
244
265
|
RAILS_DEV_PATH = File.expand_path("../../../../../..", __dir__)
|
245
266
|
|
246
|
-
class AppGenerator < AppBase
|
247
|
-
|
267
|
+
class AppGenerator < AppBase
|
268
|
+
# :stopdoc:
|
248
269
|
|
249
270
|
add_shared_options_for "application"
|
250
271
|
|
251
272
|
# Add rails command options
|
252
|
-
class_option :version, type: :boolean, aliases: "-v", group: :rails,
|
253
|
-
|
254
|
-
|
255
|
-
class_option :
|
256
|
-
|
257
|
-
|
258
|
-
class_option :
|
259
|
-
|
273
|
+
class_option :version, type: :boolean, aliases: "-v", group: :rails, desc: "Show Rails version number and quit"
|
274
|
+
class_option :api, type: :boolean, desc: "Preconfigure smaller stack for API only apps"
|
275
|
+
class_option :minimal, type: :boolean, desc: "Preconfigure a minimal rails app"
|
276
|
+
class_option :javascript, type: :string, aliases: ["-j", "--js"], default: "importmap", desc: "Choose JavaScript approach [options: importmap (default), bun, webpack, esbuild, rollup]"
|
277
|
+
class_option :css, type: :string, aliases: "-c", desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass] check https://github.com/rails/cssbundling-rails for more options"
|
278
|
+
class_option :skip_bundle, type: :boolean, aliases: "-B", default: nil, desc: "Don't run bundle install"
|
279
|
+
class_option :skip_decrypted_diffs, type: :boolean, default: nil, desc: "Don't configure git to show decrypted diffs of encrypted credentials"
|
280
|
+
|
281
|
+
OPTION_IMPLICATIONS = # :nodoc:
|
282
|
+
AppBase::OPTION_IMPLICATIONS.merge(
|
283
|
+
skip_git: [:skip_decrypted_diffs],
|
284
|
+
minimal: [
|
285
|
+
:skip_action_cable,
|
286
|
+
:skip_action_mailbox,
|
287
|
+
:skip_action_mailer,
|
288
|
+
:skip_action_text,
|
289
|
+
:skip_active_job,
|
290
|
+
:skip_active_storage,
|
291
|
+
:skip_bootsnap,
|
292
|
+
:skip_dev_gems,
|
293
|
+
:skip_hotwire,
|
294
|
+
:skip_javascript,
|
295
|
+
:skip_jbuilder,
|
296
|
+
:skip_system_test,
|
297
|
+
],
|
298
|
+
api: [
|
299
|
+
:skip_asset_pipeline,
|
300
|
+
:skip_javascript,
|
301
|
+
],
|
302
|
+
) do |option, implications, more_implications|
|
303
|
+
implications + more_implications
|
304
|
+
end
|
260
305
|
|
261
|
-
|
262
|
-
desc: "Preconfigure Webpack with a particular framework (options: #{WEBPACKS.join(", ")})"
|
306
|
+
META_OPTIONS = [:minimal] # :nodoc:
|
263
307
|
|
264
|
-
|
265
|
-
|
308
|
+
def self.apply_rails_template(template, destination) # :nodoc:
|
309
|
+
generator = new([destination], { template: template }, { destination_root: destination })
|
310
|
+
generator.set_default_accessors!
|
311
|
+
generator.apply_rails_template
|
312
|
+
generator.run_bundle
|
313
|
+
generator.run_after_bundle_callbacks
|
314
|
+
end
|
266
315
|
|
267
316
|
def initialize(*args)
|
268
317
|
super
|
269
318
|
|
319
|
+
imply_options(OPTION_IMPLICATIONS, meta_options: META_OPTIONS)
|
320
|
+
|
270
321
|
if !options[:skip_active_record] && !DATABASES.include?(options[:database])
|
271
322
|
raise Error, "Invalid value for --database option. Supported preconfigurations are: #{DATABASES.join(", ")}."
|
272
323
|
end
|
273
324
|
|
274
|
-
# Force sprockets and yarn to be skipped when generating API only apps.
|
275
|
-
# Can't modify options hash as it's frozen by default.
|
276
|
-
if options[:api]
|
277
|
-
self.options = options.merge(skip_sprockets: true, skip_javascript: true).freeze
|
278
|
-
end
|
279
|
-
|
280
325
|
@after_bundle_callbacks = []
|
281
326
|
end
|
282
327
|
|
328
|
+
public_task :report_implied_options
|
283
329
|
public_task :set_default_accessors!
|
284
330
|
public_task :create_root
|
331
|
+
public_task :target_rails_prerelease
|
285
332
|
|
286
333
|
def create_root_files
|
287
334
|
build(:readme)
|
288
335
|
build(:rakefile)
|
336
|
+
build(:node_version) if using_node?
|
289
337
|
build(:ruby_version)
|
290
338
|
build(:configru)
|
291
|
-
|
292
|
-
|
339
|
+
|
340
|
+
unless options[:skip_git]
|
341
|
+
build(:gitignore)
|
342
|
+
build(:gitattributes)
|
343
|
+
end
|
344
|
+
|
345
|
+
build(:gemfile)
|
293
346
|
build(:version_control)
|
294
|
-
build(:package_json) unless options[:skip_javascript]
|
295
347
|
end
|
296
348
|
|
297
349
|
def create_app_files
|
@@ -309,11 +361,16 @@ module Rails
|
|
309
361
|
|
310
362
|
def update_active_storage
|
311
363
|
unless skip_active_storage?
|
312
|
-
rails_command "active_storage:update"
|
364
|
+
rails_command "active_storage:update", inline: true
|
313
365
|
end
|
314
366
|
end
|
315
367
|
remove_task :update_active_storage
|
316
368
|
|
369
|
+
def create_dockerfiles
|
370
|
+
return if options[:skip_docker] || options[:dummy_app]
|
371
|
+
build(:dockerfiles)
|
372
|
+
end
|
373
|
+
|
317
374
|
def create_config_files
|
318
375
|
build(:config)
|
319
376
|
end
|
@@ -329,6 +386,7 @@ module Rails
|
|
329
386
|
|
330
387
|
def create_credentials
|
331
388
|
build(:credentials)
|
389
|
+
build(:credentials_diff_enroll)
|
332
390
|
end
|
333
391
|
|
334
392
|
def display_upgrade_guide_info
|
@@ -379,7 +437,7 @@ module Rails
|
|
379
437
|
end
|
380
438
|
|
381
439
|
def create_storage_files
|
382
|
-
build(:storage)
|
440
|
+
build(:storage)
|
383
441
|
end
|
384
442
|
|
385
443
|
def delete_app_assets_if_api_option
|
@@ -418,15 +476,16 @@ module Rails
|
|
418
476
|
end
|
419
477
|
end
|
420
478
|
|
421
|
-
def
|
422
|
-
if
|
423
|
-
|
479
|
+
def delete_assets_initializer_skipping_sprockets_and_propshaft
|
480
|
+
if skip_sprockets? && skip_propshaft?
|
481
|
+
remove_file "config/initializers/assets.rb"
|
424
482
|
end
|
425
|
-
end
|
426
483
|
|
427
|
-
|
428
|
-
|
429
|
-
|
484
|
+
if skip_sprockets?
|
485
|
+
remove_file "app/assets/config/manifest.js"
|
486
|
+
remove_dir "app/assets/config"
|
487
|
+
remove_file "app/assets/stylesheets/application.css"
|
488
|
+
create_file "app/assets/stylesheets/application.css", "/* Application styles */\n" unless options[:api]
|
430
489
|
end
|
431
490
|
end
|
432
491
|
|
@@ -436,6 +495,12 @@ module Rails
|
|
436
495
|
end
|
437
496
|
end
|
438
497
|
|
498
|
+
def delete_active_job_folder_if_skipping_active_job
|
499
|
+
if options[:skip_active_job]
|
500
|
+
remove_dir "app/jobs"
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
439
504
|
def delete_action_mailer_files_skipping_action_mailer
|
440
505
|
if options[:skip_action_mailer]
|
441
506
|
remove_file "app/views/layouts/mailer.html.erb"
|
@@ -455,8 +520,8 @@ module Rails
|
|
455
520
|
|
456
521
|
def delete_non_api_initializers_if_api_option
|
457
522
|
if options[:api]
|
458
|
-
remove_file "config/initializers/cookies_serializer.rb"
|
459
523
|
remove_file "config/initializers/content_security_policy.rb"
|
524
|
+
remove_file "config/initializers/permissions_policy.rb"
|
460
525
|
end
|
461
526
|
end
|
462
527
|
|
@@ -468,21 +533,21 @@ module Rails
|
|
468
533
|
|
469
534
|
def delete_new_framework_defaults
|
470
535
|
unless options[:update]
|
471
|
-
remove_file "config/initializers/
|
536
|
+
remove_file "config/initializers/new_framework_defaults_#{Rails::VERSION::MAJOR}_#{Rails::VERSION::MINOR}.rb"
|
472
537
|
end
|
473
538
|
end
|
474
539
|
|
475
|
-
def delete_bin_yarn
|
476
|
-
remove_file "bin/yarn" if options[:skip_javascript]
|
477
|
-
end
|
478
|
-
|
479
540
|
def finish_template
|
480
541
|
build(:leftovers)
|
481
542
|
end
|
482
543
|
|
483
|
-
public_task :apply_rails_template
|
484
|
-
public_task :
|
485
|
-
public_task :
|
544
|
+
public_task :apply_rails_template
|
545
|
+
public_task :run_bundle
|
546
|
+
public_task :add_bundler_platforms
|
547
|
+
public_task :generate_bundler_binstub
|
548
|
+
public_task :run_javascript
|
549
|
+
public_task :run_hotwire
|
550
|
+
public_task :run_css
|
486
551
|
|
487
552
|
def run_after_bundle_callbacks
|
488
553
|
@after_bundle_callbacks.each(&:call)
|
@@ -492,14 +557,15 @@ module Rails
|
|
492
557
|
"rails new #{arguments.map(&:usage).join(' ')} [options]"
|
493
558
|
end
|
494
559
|
|
495
|
-
|
560
|
+
# :startdoc:
|
496
561
|
|
562
|
+
private
|
497
563
|
# Define file as an alias to create_file for backwards compatibility.
|
498
564
|
def file(*args, &block)
|
499
565
|
create_file(*args, &block)
|
500
566
|
end
|
501
567
|
|
502
|
-
# Registers a callback to be executed after bundle
|
568
|
+
# Registers a callback to be executed after bundle binstubs
|
503
569
|
# have run.
|
504
570
|
#
|
505
571
|
# after_bundle do
|
@@ -534,11 +600,16 @@ module Rails
|
|
534
600
|
end
|
535
601
|
|
536
602
|
def self.default_rc_file
|
537
|
-
|
603
|
+
xdg_config_home = ENV["XDG_CONFIG_HOME"].presence || "~/.config"
|
604
|
+
xdg_railsrc = File.expand_path("rails/railsrc", xdg_config_home)
|
605
|
+
if File.exist?(xdg_railsrc)
|
606
|
+
xdg_railsrc
|
607
|
+
else
|
608
|
+
File.expand_path("~/.railsrc")
|
609
|
+
end
|
538
610
|
end
|
539
611
|
|
540
612
|
private
|
541
|
-
|
542
613
|
def handle_version_request!(argument)
|
543
614
|
if ["--version", "-v"].include?(argument)
|
544
615
|
require "rails/version"
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# syntax = docker/dockerfile:1
|
2
|
+
|
3
|
+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
4
|
+
ARG RUBY_VERSION=<%= gem_ruby_version %>
|
5
|
+
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
|
6
|
+
|
7
|
+
# Rails app lives here
|
8
|
+
WORKDIR /rails
|
9
|
+
|
10
|
+
# Set production environment
|
11
|
+
ENV RAILS_ENV="production" \
|
12
|
+
BUNDLE_DEPLOYMENT="1" \
|
13
|
+
BUNDLE_PATH="/usr/local/bundle" \
|
14
|
+
BUNDLE_WITHOUT="development"
|
15
|
+
|
16
|
+
|
17
|
+
# Throw-away build stage to reduce size of final image
|
18
|
+
FROM base as build
|
19
|
+
|
20
|
+
# Install packages needed to build gems<%= using_node? ? " and node modules" : "" %>
|
21
|
+
RUN apt-get update -qq && \
|
22
|
+
apt-get install --no-install-recommends -y <%= dockerfile_build_packages.join(" ") %>
|
23
|
+
|
24
|
+
<% if using_node? -%>
|
25
|
+
# Install JavaScript dependencies
|
26
|
+
ARG NODE_VERSION=<%= node_version %>
|
27
|
+
ARG YARN_VERSION=<%= dockerfile_yarn_version %>
|
28
|
+
ENV PATH=/usr/local/node/bin:$PATH
|
29
|
+
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
|
30
|
+
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
|
31
|
+
npm install -g yarn@$YARN_VERSION && \
|
32
|
+
rm -rf /tmp/node-build-master
|
33
|
+
|
34
|
+
<% end -%>
|
35
|
+
<% if using_bun? -%>
|
36
|
+
ENV BUN_INSTALL=/usr/local/bun
|
37
|
+
ENV PATH=/usr/local/bun/bin:$PATH
|
38
|
+
ARG BUN_VERSION=<%= dockerfile_bun_version %>
|
39
|
+
RUN curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}"
|
40
|
+
|
41
|
+
<% end -%>
|
42
|
+
# Install application gems
|
43
|
+
COPY Gemfile Gemfile.lock ./
|
44
|
+
RUN bundle install && \
|
45
|
+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git<% if depend_on_bootsnap? -%> && \
|
46
|
+
bundle exec bootsnap precompile --gemfile<% end %>
|
47
|
+
|
48
|
+
<% if using_node? -%>
|
49
|
+
# Install node modules
|
50
|
+
COPY package.json yarn.lock ./
|
51
|
+
RUN yarn install --frozen-lockfile
|
52
|
+
|
53
|
+
<% end -%>
|
54
|
+
<% if using_bun? -%>
|
55
|
+
# Install node modules
|
56
|
+
COPY package.json bun.lockb ./
|
57
|
+
RUN bun install --frozen-lockfile
|
58
|
+
|
59
|
+
<% end -%>
|
60
|
+
# Copy application code
|
61
|
+
COPY . .
|
62
|
+
|
63
|
+
<% if depend_on_bootsnap? -%>
|
64
|
+
# Precompile bootsnap code for faster boot times
|
65
|
+
RUN bundle exec bootsnap precompile app/ lib/
|
66
|
+
|
67
|
+
<% end -%>
|
68
|
+
<% unless dockerfile_binfile_fixups.empty? -%>
|
69
|
+
# Adjust binfiles to be executable on Linux
|
70
|
+
<%= "RUN " + dockerfile_binfile_fixups.join(" && \\\n ") %>
|
71
|
+
|
72
|
+
<% end -%>
|
73
|
+
<% unless options.api? || skip_asset_pipeline? -%>
|
74
|
+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
75
|
+
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
76
|
+
|
77
|
+
<% end -%>
|
78
|
+
|
79
|
+
# Final stage for app image
|
80
|
+
FROM base
|
81
|
+
|
82
|
+
<% unless dockerfile_deploy_packages.empty? -%>
|
83
|
+
# Install packages needed for deployment
|
84
|
+
RUN apt-get update -qq && \
|
85
|
+
apt-get install --no-install-recommends -y <%= dockerfile_deploy_packages.join(" ") %> && \
|
86
|
+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
87
|
+
|
88
|
+
<% end -%>
|
89
|
+
# Copy built artifacts: gems, application
|
90
|
+
COPY --from=build /usr/local/bundle /usr/local/bundle
|
91
|
+
COPY --from=build /rails /rails
|
92
|
+
|
93
|
+
# Run and own only the runtime files as a non-root user for security
|
94
|
+
RUN useradd rails --create-home --shell /bin/bash && \
|
95
|
+
chown -R rails:rails <%= dockerfile_chown_directories.join(" ") %>
|
96
|
+
USER rails:rails
|
97
|
+
|
98
|
+
# Entrypoint prepares the database.
|
99
|
+
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
100
|
+
|
101
|
+
# Start the server by default, this can be overwritten at runtime
|
102
|
+
EXPOSE 3000
|
103
|
+
CMD ["./bin/rails", "server"]
|
@@ -1,78 +1,68 @@
|
|
1
|
-
source
|
2
|
-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
1
|
+
source "https://rubygems.org"
|
3
2
|
|
4
|
-
ruby <%= "
|
5
|
-
|
6
|
-
<% unless gemfile_entries.first.comment -%>
|
3
|
+
ruby <%= "\"#{gem_ruby_version}\"" -%>
|
7
4
|
|
5
|
+
<% gemfile_entries.each do |gemfile_entry| %>
|
6
|
+
<%= gemfile_entry %>
|
8
7
|
<% end -%>
|
9
|
-
<%
|
10
|
-
<% if gem.comment -%>
|
8
|
+
<% unless options.minimal? -%>
|
11
9
|
|
12
|
-
#
|
13
|
-
|
14
|
-
<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%>
|
15
|
-
<% if gem.options.any? -%>
|
16
|
-
, <%= gem.options.map { |k,v|
|
17
|
-
"#{k}: #{v.inspect}" }.join(', ') %>
|
18
|
-
<% end -%>
|
19
|
-
<% end -%>
|
10
|
+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
11
|
+
# gem "kredis"
|
20
12
|
|
21
|
-
# Use Active Model has_secure_password
|
22
|
-
# gem
|
23
|
-
<% unless skip_active_storage? -%>
|
24
|
-
|
25
|
-
# Use Active Storage variant
|
26
|
-
# gem 'image_processing', '~> 1.2'
|
13
|
+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
14
|
+
# gem "bcrypt", "~> 3.1.7"
|
27
15
|
<% end -%>
|
28
16
|
|
17
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
18
|
+
gem "tzinfo-data", platforms: %i[ <%= bundler_windows_platforms %> jruby ]
|
29
19
|
<% if depend_on_bootsnap? -%>
|
20
|
+
|
30
21
|
# Reduces boot times through caching; required in config/boot.rb
|
31
|
-
gem
|
22
|
+
gem "bootsnap", require: false
|
23
|
+
<% end -%>
|
24
|
+
<% unless skip_active_storage? -%>
|
32
25
|
|
33
|
-
|
26
|
+
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
27
|
+
# gem "image_processing", "~> 1.2"
|
28
|
+
<% end -%>
|
34
29
|
<%- if options.api? -%>
|
35
|
-
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
|
36
|
-
# gem 'rack-cors'
|
37
30
|
|
31
|
+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
|
32
|
+
# gem "rack-cors"
|
38
33
|
<%- end -%>
|
39
|
-
<% if RUBY_ENGINE ==
|
34
|
+
<% if RUBY_ENGINE == "ruby" -%>
|
35
|
+
|
40
36
|
group :development, :test do
|
41
|
-
#
|
42
|
-
gem
|
37
|
+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
38
|
+
gem "debug", platforms: %i[ mri <%= bundler_windows_platforms %> ]
|
43
39
|
end
|
44
|
-
|
45
40
|
<% end -%>
|
41
|
+
|
46
42
|
group :development do
|
47
|
-
<%- unless options.api? -%>
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
gem
|
53
|
-
|
43
|
+
<%- unless options.api? || options.skip_dev_gems? -%>
|
44
|
+
# Use console on exceptions pages [https://github.com/rails/web-console]
|
45
|
+
gem "web-console"
|
46
|
+
|
47
|
+
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
|
48
|
+
# gem "rack-mini-profiler"
|
49
|
+
|
50
|
+
<%- end -%>
|
51
|
+
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
52
|
+
# gem "spring"
|
53
|
+
<%- if RUBY_VERSION >= "3.1" && RUBY_VERSION < "3.2" -%>
|
54
|
+
|
55
|
+
gem "error_highlight", ">= 0.4.0", platforms: [:ruby]
|
54
56
|
<%- end -%>
|
55
|
-
<% if depend_on_listen? -%>
|
56
|
-
gem 'listen', '>= 3.0.5', '< 3.2'
|
57
|
-
<% end -%>
|
58
|
-
<% if spring_install? -%>
|
59
|
-
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
60
|
-
gem 'spring'
|
61
|
-
<% if depend_on_listen? -%>
|
62
|
-
gem 'spring-watcher-listen', '~> 2.0.0'
|
63
|
-
<% end -%>
|
64
|
-
<% end -%>
|
65
57
|
end
|
66
58
|
|
67
59
|
<%- if depends_on_system_test? -%>
|
68
60
|
group :test do
|
69
|
-
#
|
70
|
-
gem
|
71
|
-
gem
|
72
|
-
|
73
|
-
gem
|
61
|
+
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
62
|
+
gem "capybara"
|
63
|
+
gem "selenium-webdriver"
|
64
|
+
<%- if RUBY_VERSION < "3.0" -%>
|
65
|
+
gem "webdrivers"
|
66
|
+
<%- end -%>
|
74
67
|
end
|
75
|
-
|
76
68
|
<%- end -%>
|
77
|
-
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
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
|
4
|
+
require_relative "config/application"
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|