railties 6.0.3.3 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +234 -370
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +1 -1
- data/lib/minitest/rails_plugin.rb +16 -1
- data/lib/rails.rb +5 -8
- data/lib/rails/application.rb +49 -83
- data/lib/rails/application/bootstrap.rb +5 -5
- data/lib/rails/application/configuration.rb +71 -21
- data/lib/rails/application/default_middleware_stack.rb +5 -3
- data/lib/rails/application/finisher.rb +15 -2
- data/lib/rails/application/routes_reloader.rb +9 -2
- data/lib/rails/backtrace_cleaner.rb +12 -7
- data/lib/rails/code_statistics.rb +3 -3
- data/lib/rails/code_statistics_calculator.rb +6 -6
- data/lib/rails/command.rb +7 -1
- data/lib/rails/command/base.rb +1 -1
- data/lib/rails/command/behavior.rb +1 -1
- data/lib/rails/command/environment_argument.rb +1 -1
- data/lib/rails/commands/credentials/USAGE +17 -2
- data/lib/rails/commands/credentials/credentials_command.rb +28 -4
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +41 -0
- data/lib/rails/commands/db/system/change/change_command.rb +6 -1
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +61 -58
- data/lib/rails/commands/encrypted/encrypted_command.rb +4 -4
- data/lib/rails/commands/generate/generate_command.rb +1 -1
- data/lib/rails/commands/notes/notes_command.rb +1 -11
- data/lib/rails/commands/rake/rake_command.rb +9 -8
- data/lib/rails/commands/secrets/USAGE +9 -3
- data/lib/rails/commands/server/server_command.rb +14 -41
- data/lib/rails/commands/test/test_command.rb +2 -2
- data/lib/rails/configuration.rb +40 -10
- data/lib/rails/engine.rb +35 -32
- data/lib/rails/engine/configuration.rb +1 -0
- data/lib/rails/engine/updater.rb +1 -1
- data/lib/rails/gem_version.rb +3 -3
- data/lib/rails/generators.rb +29 -15
- data/lib/rails/generators/actions.rb +50 -29
- data/lib/rails/generators/actions/create_migration.rb +5 -0
- data/lib/rails/generators/app_base.rb +38 -21
- data/lib/rails/generators/base.rb +14 -11
- data/lib/rails/generators/database.rb +3 -4
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +3 -3
- data/lib/rails/generators/generated_attribute.rb +3 -9
- data/lib/rails/generators/migration.rb +2 -1
- data/lib/rails/generators/model_helpers.rb +26 -2
- data/lib/rails/generators/named_base.rb +1 -1
- data/lib/rails/generators/rails/app/USAGE +2 -1
- data/lib/rails/generators/rails/app/app_generator.rb +89 -15
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +11 -11
- data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +1 -1
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +11 -11
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +2 -1
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +4 -4
- data/lib/rails/generators/rails/app/templates/bin/spring.tt +13 -0
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +9 -3
- data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +14 -7
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +3 -4
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +10 -9
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +10 -9
- 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 +17 -3
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +15 -5
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +12 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +4 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +67 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +6 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +14 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +0 -1
- data/lib/rails/generators/rails/app/templates/package.json.tt +1 -1
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +5 -5
- data/lib/rails/generators/rails/assets/USAGE +2 -3
- data/lib/rails/generators/rails/benchmark/USAGE +19 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +29 -0
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
- data/lib/rails/generators/rails/controller/USAGE +2 -2
- data/lib/rails/generators/rails/controller/controller_generator.rb +2 -40
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +1 -1
- data/lib/rails/generators/rails/generator/USAGE +2 -2
- 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 +4 -4
- data/lib/rails/generators/rails/model/USAGE +15 -16
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +25 -23
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +10 -19
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +3 -10
- 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/bin/rails.tt +3 -3
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +13 -11
- 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 +1 -1
- 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 +0 -3
- data/lib/rails/generators/rails/resource/USAGE +4 -4
- 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_controller/USAGE +2 -2
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +6 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -1
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/rails/system_test/USAGE +2 -2
- data/lib/rails/generators/rails/task/USAGE +3 -3
- data/lib/rails/generators/test_case.rb +1 -1
- 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/templates/generator_test.rb.tt +2 -2
- 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 +1 -1
- 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/templates/api_functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/testing/assertions.rb +2 -2
- data/lib/rails/generators/testing/behaviour.rb +1 -1
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +1 -1
- data/lib/rails/mailers_controller.rb +1 -0
- data/lib/rails/paths.rb +14 -6
- data/lib/rails/rack/logger.rb +1 -1
- data/lib/rails/railtie.rb +32 -10
- data/lib/rails/railtie/configuration.rb +3 -2
- data/lib/rails/source_annotation_extractor.rb +1 -15
- data/lib/rails/tasks.rb +0 -4
- data/lib/rails/tasks/engine.rake +1 -4
- data/lib/rails/tasks/framework.rake +7 -1
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/statistics.rake +1 -1
- data/lib/rails/tasks/yarn.rake +14 -2
- data/lib/rails/templates/rails/mailers/email.html.erb +1 -0
- data/lib/rails/templates/rails/welcome/index.html.erb +1 -1
- data/lib/rails/test_unit/reporter.rb +2 -1
- data/lib/rails/test_unit/runner.rb +20 -3
- data/lib/rails/test_unit/testing.rake +6 -0
- metadata +27 -33
- 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/new_framework_defaults_6_0.rb.tt +0 -45
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
- 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/routes.rake +0 -9
@@ -30,20 +30,21 @@ test:
|
|
30
30
|
# like your database password, in your source code. If your source code is
|
31
31
|
# ever seen by anyone, they now have access to your database.
|
32
32
|
#
|
33
|
-
# Instead, provide the password
|
34
|
-
# the app.
|
35
|
-
# for a full rundown on how to provide these environment variables in a
|
36
|
-
# production deployment.
|
37
|
-
#
|
38
|
-
# On Heroku and other platform providers, you may have a full connection URL
|
39
|
-
# available as an environment variable. For example:
|
33
|
+
# Instead, provide the password or a full connection URL as an environment
|
34
|
+
# variable when you boot the app. For example:
|
40
35
|
#
|
41
36
|
# DATABASE_URL="sqlserver://myuser:mypass@localhost/somedatabase"
|
42
37
|
#
|
43
|
-
#
|
38
|
+
# If the connection URL is provided in the special DATABASE_URL environment
|
39
|
+
# variable, Rails will automatically merge its configuration values on top of
|
40
|
+
# the values provided in this file. Alternatively, you can specify a connection
|
41
|
+
# URL environment variable explicitly:
|
44
42
|
#
|
45
43
|
# production:
|
46
|
-
# url: <%%= ENV['
|
44
|
+
# url: <%%= ENV['MY_APP_DATABASE_URL'] %>
|
45
|
+
#
|
46
|
+
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
47
|
+
# for a full overview on how database connection configuration can be specified.
|
47
48
|
#
|
48
49
|
production:
|
49
50
|
<<: *default
|
@@ -1,8 +1,10 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
1
3
|
Rails.application.configure do
|
2
4
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
5
|
|
4
|
-
# In the development environment your application's code is reloaded
|
5
|
-
#
|
6
|
+
# In the development environment your application's code is reloaded any time
|
7
|
+
# it changes. This slows down response time but is perfect for development
|
6
8
|
# since you don't have to restart the web server when you make code changes.
|
7
9
|
config.cache_classes = false
|
8
10
|
|
@@ -45,6 +47,12 @@ Rails.application.configure do
|
|
45
47
|
# Print deprecation notices to the Rails logger.
|
46
48
|
config.active_support.deprecation = :log
|
47
49
|
|
50
|
+
# Raise exceptions for disallowed deprecations.
|
51
|
+
config.active_support.disallowed_deprecation = :raise
|
52
|
+
|
53
|
+
# Tell Active Support which deprecation messages to disallow.
|
54
|
+
config.active_support.disallowed_deprecation_warnings = []
|
55
|
+
|
48
56
|
<%- unless options.skip_active_record? -%>
|
49
57
|
# Raise an error on page load if there are pending migrations.
|
50
58
|
config.active_record.migration_error = :page_load
|
@@ -64,9 +72,15 @@ Rails.application.configure do
|
|
64
72
|
<%- end -%>
|
65
73
|
|
66
74
|
# Raises error for missing translations.
|
67
|
-
# config.
|
75
|
+
# config.i18n.raise_on_missing_translations = true
|
76
|
+
|
77
|
+
# Annotate rendered view with file names.
|
78
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
68
79
|
|
69
80
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
70
81
|
# routes, locales, etc. This feature depends on the listen gem.
|
71
82
|
<%= '# ' unless depend_on_listen? %>config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
83
|
+
|
84
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
85
|
+
# config.action_cable.disable_request_forgery_protection = true
|
72
86
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
1
3
|
Rails.application.configure do
|
2
4
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
5
|
|
@@ -33,7 +35,7 @@ Rails.application.configure do
|
|
33
35
|
|
34
36
|
<%- end -%>
|
35
37
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
36
|
-
# config.
|
38
|
+
# config.asset_host = 'http://assets.example.com'
|
37
39
|
|
38
40
|
# Specifies the header that your server uses for sending files.
|
39
41
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
@@ -54,9 +56,9 @@ Rails.application.configure do
|
|
54
56
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
55
57
|
# config.force_ssl = true
|
56
58
|
|
57
|
-
#
|
58
|
-
#
|
59
|
-
config.log_level = :
|
59
|
+
# Include generic and useful information about system operation, but avoid logging too much
|
60
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
61
|
+
config.log_level = :info
|
60
62
|
|
61
63
|
# Prepend all log lines with the following tags.
|
62
64
|
config.log_tags = [ :request_id ]
|
@@ -64,9 +66,11 @@ Rails.application.configure do
|
|
64
66
|
# Use a different cache store in production.
|
65
67
|
# config.cache_store = :mem_cache_store
|
66
68
|
|
69
|
+
<%- unless options[:skip_active_job] -%>
|
67
70
|
# Use a real queuing backend for Active Job (and separate queues per environment).
|
68
71
|
# config.active_job.queue_adapter = :resque
|
69
72
|
# config.active_job.queue_name_prefix = "<%= app_name %>_production"
|
73
|
+
<%- end -%>
|
70
74
|
|
71
75
|
<%- unless options.skip_action_mailer? -%>
|
72
76
|
config.action_mailer.perform_caching = false
|
@@ -83,11 +87,17 @@ Rails.application.configure do
|
|
83
87
|
# Send deprecation notices to registered listeners.
|
84
88
|
config.active_support.deprecation = :notify
|
85
89
|
|
90
|
+
# Log disallowed deprecations.
|
91
|
+
config.active_support.disallowed_deprecation = :log
|
92
|
+
|
93
|
+
# Tell Active Support which deprecation messages to disallow.
|
94
|
+
config.active_support.disallowed_deprecation_warnings = []
|
95
|
+
|
86
96
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
87
97
|
config.log_formatter = ::Logger::Formatter.new
|
88
98
|
|
89
99
|
# Use a different logger for distributed setups.
|
90
|
-
# require
|
100
|
+
# require "syslog/logger"
|
91
101
|
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
92
102
|
|
93
103
|
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
1
3
|
# The test environment is used exclusively to run your application's
|
2
4
|
# test suite. You never need to work with it otherwise. Remember that
|
3
5
|
# your test database is "scratch space" for the test suite and is wiped
|
@@ -53,6 +55,15 @@ Rails.application.configure do
|
|
53
55
|
# Print deprecation notices to the stderr.
|
54
56
|
config.active_support.deprecation = :stderr
|
55
57
|
|
58
|
+
# Raise exceptions for disallowed deprecations.
|
59
|
+
config.active_support.disallowed_deprecation = :raise
|
60
|
+
|
61
|
+
# Tell Active Support which deprecation messages to disallow.
|
62
|
+
config.active_support.disallowed_deprecation_warnings = []
|
63
|
+
|
56
64
|
# Raises error for missing translations.
|
57
|
-
# config.
|
65
|
+
# config.i18n.raise_on_missing_translations = true
|
66
|
+
|
67
|
+
# Annotate rendered view with file names.
|
68
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
58
69
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
3
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line|
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
|
5
5
|
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
|
7
|
-
#
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
|
7
|
+
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
|
8
|
+
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
|
data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
3
|
# Configure sensitive parameters which will be filtered from the log file.
|
4
|
-
Rails.application.config.filter_parameters += [
|
4
|
+
Rails.application.config.filter_parameters += [
|
5
|
+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
6
|
+
]
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains migration options to ease your Rails 6.1 upgrade.
|
4
|
+
#
|
5
|
+
# Once upgraded flip defaults one by one to migrate to the new default.
|
6
|
+
#
|
7
|
+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
8
|
+
|
9
|
+
# Support for inversing belongs_to -> has_many Active Record associations.
|
10
|
+
# Rails.application.config.active_record.has_many_inversing = true
|
11
|
+
|
12
|
+
# Track Active Storage variants in the database.
|
13
|
+
# Rails.application.config.active_storage.track_variants = true
|
14
|
+
|
15
|
+
# Apply random variation to the delay when retrying failed jobs.
|
16
|
+
# Rails.application.config.active_job.retry_jitter = 0.15
|
17
|
+
|
18
|
+
# Stop executing `after_enqueue`/`after_perform` callbacks if
|
19
|
+
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
|
20
|
+
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
|
21
|
+
|
22
|
+
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
|
23
|
+
#
|
24
|
+
# This change is not backwards compatible with earlier Rails versions.
|
25
|
+
# It's best enabled when your entire app is migrated and stable on 6.1.
|
26
|
+
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
|
27
|
+
|
28
|
+
# Generate CSRF tokens that are encoded in URL-safe Base64.
|
29
|
+
#
|
30
|
+
# This change is not backwards compatible with earlier Rails versions.
|
31
|
+
# It's best enabled when your entire app is migrated and stable on 6.1.
|
32
|
+
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
|
33
|
+
|
34
|
+
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
|
35
|
+
# UTC offset or a UTC time.
|
36
|
+
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
|
37
|
+
|
38
|
+
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
|
39
|
+
# requests to HTTPS in `ActionDispatch::SSL` middleware.
|
40
|
+
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
|
41
|
+
|
42
|
+
# Use new connection handling API. For most applications this won't have any
|
43
|
+
# effect. For applications using multiple databases, this new API provides
|
44
|
+
# support for granular connection swapping.
|
45
|
+
# Rails.application.config.active_record.legacy_connection_handling = false
|
46
|
+
|
47
|
+
# Make `form_with` generate non-remote forms by default.
|
48
|
+
# Rails.application.config.action_view.form_with_generates_remote_forms = false
|
49
|
+
|
50
|
+
# Set the default queue name for the analysis job to the queue adapter default.
|
51
|
+
# Rails.application.config.active_storage.queues.analysis = nil
|
52
|
+
|
53
|
+
# Set the default queue name for the purge job to the queue adapter default.
|
54
|
+
# Rails.application.config.active_storage.queues.purge = nil
|
55
|
+
|
56
|
+
# Set the default queue name for the incineration job to the queue adapter default.
|
57
|
+
# Rails.application.config.action_mailbox.queues.incineration = nil
|
58
|
+
|
59
|
+
# Set the default queue name for the routing job to the queue adapter default.
|
60
|
+
# Rails.application.config.action_mailbox.queues.routing = nil
|
61
|
+
|
62
|
+
# Set the default queue name for the mail deliver job to the queue adapter default.
|
63
|
+
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
|
64
|
+
|
65
|
+
# Generate a `Link` header that gives a hint to modern browsers about
|
66
|
+
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
|
67
|
+
# Rails.application.config.action_view.preload_links_header = true
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Define an application-wide HTTP permissions policy. For further
|
2
|
+
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
3
|
+
#
|
4
|
+
# Rails.application.config.permissions_policy do |f|
|
5
|
+
# f.camera :none
|
6
|
+
# f.gyroscope :none
|
7
|
+
# f.microphone :none
|
8
|
+
# f.usb :none
|
9
|
+
# f.fullscreen :self
|
10
|
+
# f.payment :self, "https://secure.example.com"
|
11
|
+
# end
|
@@ -8,9 +8,14 @@ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
|
8
8
|
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
9
9
|
threads min_threads_count, max_threads_count
|
10
10
|
|
11
|
+
# Specifies the `worker_timeout` threshold that Puma will use to wait before
|
12
|
+
# terminating a worker in development environments.
|
13
|
+
#
|
14
|
+
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
|
15
|
+
|
11
16
|
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
12
17
|
#
|
13
|
-
port
|
18
|
+
port ENV.fetch("PORT") { 3000 }
|
14
19
|
|
15
20
|
# Specifies the `environment` that Puma will run in.
|
16
21
|
#
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
2
|
+
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
3
3
|
#
|
4
4
|
# Examples:
|
5
5
|
#
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
|
2
|
+
|
3
|
+
<% unless options[:skip_active_record] -%>
|
4
|
+
# Mark the database schema as having been generated.
|
5
|
+
db/schema.rb linguist-generated
|
6
|
+
<% end -%>
|
7
|
+
|
8
|
+
<% unless options[:skip_javascript] -%>
|
9
|
+
# Mark the yarn lockfile as having been generated.
|
10
|
+
yarn.lock linguist-generated
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
# Mark any vendored files as having been vendored.
|
14
|
+
vendor/* linguist-vendored
|
@@ -1,13 +1,13 @@
|
|
1
1
|
ENV['RAILS_ENV'] ||= 'test'
|
2
|
-
require_relative
|
3
|
-
require
|
2
|
+
require_relative "../config/environment"
|
3
|
+
require "rails/test_help"
|
4
4
|
|
5
5
|
class ActiveSupport::TestCase
|
6
6
|
# Run tests in parallel with specified workers
|
7
|
-
<% if
|
8
|
-
parallelize(workers: :number_of_processors, with: :threads)
|
9
|
-
<%- else -%>
|
7
|
+
<% if Process.respond_to?(:fork) && !Gem.win_platform? -%>
|
10
8
|
parallelize(workers: :number_of_processors)
|
9
|
+
<%- else -%>
|
10
|
+
parallelize(workers: :number_of_processors, with: :threads)
|
11
11
|
<% end -%>
|
12
12
|
|
13
13
|
<% unless options[:skip_active_record] -%>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Generates new asset placeholders. Pass the asset name, either CamelCased
|
3
3
|
or under_scored.
|
4
4
|
|
5
5
|
To create an asset within a folder, specify the asset's name as a
|
@@ -10,8 +10,7 @@ Description:
|
|
10
10
|
If Sass 3 is available, stylesheets will be generated with the .scss extension.
|
11
11
|
|
12
12
|
Example:
|
13
|
-
`rails generate assets posts`
|
13
|
+
`bin/rails generate assets posts`
|
14
14
|
|
15
15
|
Posts assets.
|
16
16
|
Stylesheet: app/assets/stylesheets/posts.css
|
17
|
-
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Description:
|
2
|
+
Generate benchmarks to compare performance optimizations.
|
3
|
+
|
4
|
+
Makes use of the `benchmark-ips` gem as it provides a number of benefits like:
|
5
|
+
- Simple significance test
|
6
|
+
- Automatic warmup
|
7
|
+
- No need to specify the number of iterations
|
8
|
+
|
9
|
+
Example:
|
10
|
+
`bin/rails generate benchmark opt_compare`
|
11
|
+
|
12
|
+
This will create:
|
13
|
+
script/benchmarks/opt_compare.rb
|
14
|
+
|
15
|
+
You can run the generated benchmark file using:
|
16
|
+
`ruby script/benchmarks/opt_compare.rb`
|
17
|
+
|
18
|
+
You can specify different reports:
|
19
|
+
`bin/rails generate benchmark opt_compare patch1 patch2 patch3`
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/named_base"
|
4
|
+
|
5
|
+
module Rails
|
6
|
+
module Generators
|
7
|
+
class BenchmarkGenerator < NamedBase
|
8
|
+
IPS_GEM_NAME = "benchmark-ips"
|
9
|
+
|
10
|
+
argument :reports, type: :array, default: ["before", "after"]
|
11
|
+
|
12
|
+
def generate_layout
|
13
|
+
add_ips_to_gemfile unless ips_installed?
|
14
|
+
template("benchmark.rb.tt", "script/benchmarks/#{file_name}.rb")
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def add_ips_to_gemfile
|
19
|
+
gem(IPS_GEM_NAME, group: [:development, :test])
|
20
|
+
end
|
21
|
+
|
22
|
+
def ips_installed?
|
23
|
+
in_root do
|
24
|
+
return File.read("Gemfile").match?(/gem.*\b#{IPS_GEM_NAME}\b.*/)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../config/environment"
|
4
|
+
|
5
|
+
# Any benchmarking setup goes here...
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
Benchmark.ips do |x|
|
10
|
+
<%- reports.each do |report| -%>
|
11
|
+
x.report("<%= report %>") { }
|
12
|
+
<%- end -%>
|
13
|
+
|
14
|
+
x.compare!
|
15
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Generates a new controller and its views. Pass the controller name, either
|
3
3
|
CamelCased or under_scored, and a list of views as arguments.
|
4
4
|
|
5
5
|
To create a controller within a module, specify the controller name as a
|
@@ -9,7 +9,7 @@ Description:
|
|
9
9
|
template engine, assets, and test framework generators.
|
10
10
|
|
11
11
|
Example:
|
12
|
-
`rails generate controller CreditCards open debit credit close`
|
12
|
+
`bin/rails generate controller CreditCards open debit credit close`
|
13
13
|
|
14
14
|
CreditCards controller with URLs like /credit_cards/debit.
|
15
15
|
Controller: app/controllers/credit_cards_controller.rb
|
@@ -17,7 +17,8 @@ module Rails
|
|
17
17
|
def add_routes
|
18
18
|
return if options[:skip_routes]
|
19
19
|
return if actions.empty?
|
20
|
-
|
20
|
+
routing_code = actions.map { |action| "get '#{file_name}/#{action}'" }.join("\n")
|
21
|
+
route routing_code, namespace: regular_class_path
|
21
22
|
end
|
22
23
|
|
23
24
|
hook_for :template_engine, :test_framework, :helper, :assets do |generator|
|
@@ -32,45 +33,6 @@ module Rails
|
|
32
33
|
def remove_possible_suffix(name)
|
33
34
|
name.sub(/_?controller$/i, "")
|
34
35
|
end
|
35
|
-
|
36
|
-
# This method creates nested route entry for namespaced resources.
|
37
|
-
# For eg. rails g controller foo/bar/baz index show
|
38
|
-
# Will generate -
|
39
|
-
# namespace :foo do
|
40
|
-
# namespace :bar do
|
41
|
-
# get 'baz/index'
|
42
|
-
# get 'baz/show'
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
def generate_routing_code
|
46
|
-
depth = 0
|
47
|
-
lines = []
|
48
|
-
|
49
|
-
# Create 'namespace' ladder
|
50
|
-
# namespace :foo do
|
51
|
-
# namespace :bar do
|
52
|
-
regular_class_path.each do |ns|
|
53
|
-
lines << indent("namespace :#{ns} do\n", depth * 2)
|
54
|
-
depth += 1
|
55
|
-
end
|
56
|
-
|
57
|
-
# Create route
|
58
|
-
# get 'baz/index'
|
59
|
-
# get 'baz/show'
|
60
|
-
actions.each do |action|
|
61
|
-
lines << indent(%{get '#{file_name}/#{action}'\n}, depth * 2)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Create `end` ladder
|
65
|
-
# end
|
66
|
-
# end
|
67
|
-
until depth.zero?
|
68
|
-
depth -= 1
|
69
|
-
lines << indent("end\n", depth * 2)
|
70
|
-
end
|
71
|
-
|
72
|
-
lines.join
|
73
|
-
end
|
74
36
|
end
|
75
37
|
end
|
76
38
|
end
|