railties 7.1.0.beta1 → 7.1.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -1
- data/lib/rails/application/bootstrap.rb +4 -0
- data/lib/rails/commands/server/server_command.rb +1 -1
- data/lib/rails/gem_version.rb +1 -1
- data/lib/rails/generators/app_base.rb +5 -1
- data/lib/rails/generators/database.rb +20 -0
- data/lib/rails/generators/generated_attribute.rb +10 -0
- data/lib/rails/generators/rails/app/USAGE +7 -0
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +2 -6
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +1 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +4 -4
- data/lib/rails/generators/rails/app/templates/gitignore.tt +4 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +27 -0
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d9c922d487cf3c067c1a65e48220c5073060674bc98fd7d1bb8b1fd8ff9a557
|
4
|
+
data.tar.gz: 47298c50c11159f36d8f213fffc70aa1d416c114c1ee4a48d980e521ae88fb5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1479a364eb0e3afd7b3f8824819fe96a6145b7e144ffef4956d1f9083e932ff555432622897d6f845f7848d2b90e67868ad376fefc1bb56d7ba5789fa34975a5
|
7
|
+
data.tar.gz: 96ee0b4198d8b5d725ab27dd2caae58958fad652c11d4823c4c3107f39a89620b70e4ea05587100c862c5982d2108e05c7acdd803b7f4b3604022994f31f26dd
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,48 @@
|
|
1
|
+
## Rails 7.1.0.rc2 (October 01, 2023) ##
|
2
|
+
|
3
|
+
* Always set the Rails logger to be an instance of `ActiveSupport::BroadcastLogger`.
|
4
|
+
|
5
|
+
*Edouard Chin*
|
6
|
+
|
7
|
+
|
8
|
+
## Rails 7.1.0.rc1 (September 27, 2023) ##
|
9
|
+
|
10
|
+
* Require `concurrent-ruby` in `config/puma.rb` so that Puma can boot in
|
11
|
+
production when `WEB_CONCURRENCY` is not explicitly specified.
|
12
|
+
|
13
|
+
Fixes #49323.
|
14
|
+
|
15
|
+
*Matt Brictson*
|
16
|
+
|
17
|
+
* Raise error when generating attribute with dangerous name.
|
18
|
+
|
19
|
+
The following will now raise an error as `save` and `hash` are already
|
20
|
+
defined by Active Record.
|
21
|
+
|
22
|
+
```bash
|
23
|
+
$ bin/rails generate model Post save
|
24
|
+
$ bin/rails generate model Post hash
|
25
|
+
```
|
26
|
+
|
27
|
+
*Petrik de Heus*
|
28
|
+
|
29
|
+
|
1
30
|
## Rails 7.1.0.beta1 (September 13, 2023) ##
|
2
31
|
|
32
|
+
* Add ability to show slow tests to the test runner
|
33
|
+
|
34
|
+
```bash
|
35
|
+
$ bin/test --profile # additionally prints 10 (default) slowest tests
|
36
|
+
# or
|
37
|
+
$ bin/test --profile 20 # prints 20 slowest tests
|
38
|
+
```
|
39
|
+
|
40
|
+
*fatkodima*
|
41
|
+
|
3
42
|
* `rails new --javascript` generator now supports Bun
|
4
43
|
|
5
44
|
```bash
|
6
|
-
rails new my_new_app --javascript=bun
|
45
|
+
$ rails new my_new_app --javascript=bun
|
7
46
|
```
|
8
47
|
|
9
48
|
*Jason Meller*
|
@@ -56,6 +56,10 @@ module Rails
|
|
56
56
|
end
|
57
57
|
Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
|
58
58
|
|
59
|
+
broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
|
60
|
+
broadcast_logger.formatter = Rails.logger.formatter
|
61
|
+
Rails.logger = broadcast_logger
|
62
|
+
|
59
63
|
unless config.consider_all_requests_local
|
60
64
|
Rails.error.logger = Rails.logger
|
61
65
|
end
|
data/lib/rails/gem_version.rb
CHANGED
@@ -345,6 +345,10 @@ module Rails
|
|
345
345
|
options[:skip_active_storage]
|
346
346
|
end
|
347
347
|
|
348
|
+
def skip_action_cable? # :doc:
|
349
|
+
options[:skip_action_cable]
|
350
|
+
end
|
351
|
+
|
348
352
|
def skip_action_mailer? # :doc:
|
349
353
|
options[:skip_action_mailer]
|
350
354
|
end
|
@@ -497,7 +501,7 @@ module Rails
|
|
497
501
|
end
|
498
502
|
|
499
503
|
def dockerfile_bun_version
|
500
|
-
using_bun? and
|
504
|
+
using_bun? and `bun --version`[/\d+\.\d+\.\d+/]
|
501
505
|
rescue
|
502
506
|
BUN_VERSION
|
503
507
|
end
|
@@ -27,6 +27,26 @@ module Rails
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
def docker_for_database_build(database = options[:database])
|
31
|
+
case database
|
32
|
+
when "mysql" then "build-essential default-libmysqlclient-dev git"
|
33
|
+
when "trilogy" then "build-essential default-libmysqlclient-dev git"
|
34
|
+
when "postgresql" then "build-essential git libpq-dev"
|
35
|
+
when "sqlite3" then "build-essential git"
|
36
|
+
else nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def docker_for_database_deploy(database = options[:database])
|
41
|
+
case database
|
42
|
+
when "mysql" then "curl default-mysql-client libvips"
|
43
|
+
when "trilogy" then "curl default-mysql-client libvips"
|
44
|
+
when "postgresql" then "curl libvips postgresql-client"
|
45
|
+
when "sqlite3" then "curl libsqlite3-0 libvips"
|
46
|
+
else nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
30
50
|
def convert_database_option_for_jruby
|
31
51
|
if defined?(JRUBY_VERSION)
|
32
52
|
opt = options.dup
|
@@ -43,6 +43,10 @@ module Rails
|
|
43
43
|
type, attr_options = *parse_type_and_options(type)
|
44
44
|
type = type.to_sym if type
|
45
45
|
|
46
|
+
if dangerous_name?(name)
|
47
|
+
raise Error, "Could not generate field '#{name}', as it is already defined by Active Record."
|
48
|
+
end
|
49
|
+
|
46
50
|
if type && !valid_type?(type)
|
47
51
|
raise Error, "Could not generate field '#{name}' with unknown type '#{type}'."
|
48
52
|
end
|
@@ -60,8 +64,14 @@ module Rails
|
|
60
64
|
new(name, type, index_type, attr_options)
|
61
65
|
end
|
62
66
|
|
67
|
+
def dangerous_name?(name)
|
68
|
+
defined?(ActiveRecord::Base) &&
|
69
|
+
ActiveRecord::Base.dangerous_attribute_method?(name)
|
70
|
+
end
|
71
|
+
|
63
72
|
def valid_type?(type)
|
64
73
|
DEFAULT_TYPES.include?(type.to_s) ||
|
74
|
+
!defined?(ActiveRecord::Base) ||
|
65
75
|
ActiveRecord::Base.connection.valid_type?(type)
|
66
76
|
end
|
67
77
|
|
@@ -9,11 +9,18 @@ Description:
|
|
9
9
|
Note that the arguments specified in the .railsrc file don't affect the
|
10
10
|
default values shown above in this help message.
|
11
11
|
|
12
|
+
You can specify which version to use when creating a new rails application
|
13
|
+
using `rails _<version>_ new`.
|
14
|
+
|
12
15
|
Examples:
|
13
16
|
`rails new ~/Code/Ruby/weblog`
|
14
17
|
|
15
18
|
This generates a new Rails app in ~/Code/Ruby/weblog.
|
16
19
|
|
20
|
+
`rails _<version>_ new weblog`
|
21
|
+
|
22
|
+
This generates a new Rails app with the provided version in ./weblog.
|
23
|
+
|
17
24
|
`rails new weblog --api`
|
18
25
|
|
19
26
|
This generates a new Rails app in API mode in ./weblog.
|
@@ -32,21 +32,18 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
|
|
32
32
|
rm -rf /tmp/node-build-master
|
33
33
|
|
34
34
|
<% end -%>
|
35
|
-
|
36
35
|
<% if using_bun? -%>
|
37
36
|
ENV BUN_INSTALL=/usr/local/bun
|
38
37
|
ENV PATH=/usr/local/bun/bin:$PATH
|
39
38
|
ARG BUN_VERSION=<%= dockerfile_bun_version %>
|
40
|
-
RUN curl -fsSL https://bun.sh/install | bash -s -- "${BUN_VERSION}"
|
39
|
+
RUN curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}"
|
41
40
|
|
42
41
|
<% end -%>
|
43
|
-
|
44
42
|
# Install application gems
|
45
43
|
COPY Gemfile Gemfile.lock ./
|
46
44
|
RUN bundle install && \
|
47
45
|
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git<% if depend_on_bootsnap? -%> && \
|
48
|
-
bundle exec bootsnap precompile --gemfile
|
49
|
-
<% end %>
|
46
|
+
bundle exec bootsnap precompile --gemfile<% end %>
|
50
47
|
|
51
48
|
<% if using_node? -%>
|
52
49
|
# Install node modules
|
@@ -54,7 +51,6 @@ COPY package.json yarn.lock ./
|
|
54
51
|
RUN yarn install --frozen-lockfile
|
55
52
|
|
56
53
|
<% end -%>
|
57
|
-
|
58
54
|
<% if using_bun? -%>
|
59
55
|
# Install node modules
|
60
56
|
COPY package.json bun.lockb ./
|
@@ -51,7 +51,7 @@ group :development do
|
|
51
51
|
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
52
52
|
# gem "spring"
|
53
53
|
|
54
|
-
<%- if RUBY_VERSION >= "3.1" -%>
|
54
|
+
<%- if RUBY_VERSION >= "3.1" && RUBY_VERSION < "3.2" -%>
|
55
55
|
gem "error_highlight", ">= 0.4.0", platforms: [:ruby]
|
56
56
|
<%- end -%>
|
57
57
|
end
|
@@ -63,6 +63,6 @@ group :test do
|
|
63
63
|
gem "selenium-webdriver"
|
64
64
|
<%- if RUBY_VERSION < "3.0" -%>
|
65
65
|
gem "webdrivers"
|
66
|
-
|
66
|
+
<%- end -%>
|
67
67
|
end
|
68
68
|
<%- end -%>
|
@@ -15,7 +15,9 @@ module <%= app_const_base %>
|
|
15
15
|
config.load_defaults Rails::VERSION::STRING.to_f
|
16
16
|
<%- end -%>
|
17
17
|
|
18
|
-
# Please,
|
18
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
19
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
20
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
19
21
|
config.autoload_lib(ignore: %w(assets tasks))
|
20
22
|
|
21
23
|
# Configuration for the application, engines, and railties goes here.
|
@@ -80,9 +80,11 @@ Rails.application.configure do
|
|
80
80
|
# Annotate rendered view with file names.
|
81
81
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
82
82
|
|
83
|
+
<%- unless skip_action_cable? -%>
|
83
84
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
84
85
|
# config.action_cable.disable_request_forgery_protection = true
|
85
86
|
|
87
|
+
<%- end -%>
|
86
88
|
# Raise error when a before_action's only/except options reference missing actions
|
87
89
|
config.action_controller.raise_on_missing_callback_actions = true
|
88
90
|
end
|
@@ -45,7 +45,7 @@ Rails.application.configure do
|
|
45
45
|
config.active_storage.service = :local
|
46
46
|
|
47
47
|
<%- end -%>
|
48
|
-
<%- unless
|
48
|
+
<%- unless skip_action_cable? -%>
|
49
49
|
# Mount Action Cable outside main process or domain.
|
50
50
|
# config.action_cable.mount_path = nil
|
51
51
|
# config.action_cable.url = "wss://example.com/cable"
|
data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
# Configure parameters to be filtered from the log file.
|
4
|
-
#
|
5
|
-
# notations and behaviors.
|
3
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
4
|
+
# Use this to limit dissemination of sensitive information.
|
5
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
6
6
|
Rails.application.config.filter_parameters += [
|
7
7
|
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
8
8
|
]
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
# No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able
|
13
13
|
# to manually require files that are managed by the autoloader, which you shouldn't do anyway.
|
14
|
-
# This reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
|
14
|
+
# This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
|
15
15
|
# of the bootsnap cache if you use it.
|
16
16
|
# Rails.application.config.add_autoload_paths_to_load_path = false
|
17
17
|
|
@@ -13,6 +13,7 @@ threads min_threads_count, max_threads_count
|
|
13
13
|
|
14
14
|
# Specifies that the worker count should equal the number of processors in production.
|
15
15
|
if ENV["RAILS_ENV"] == "production"
|
16
|
+
require "concurrent-ruby"
|
16
17
|
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
|
17
18
|
workers worker_count if worker_count > 1
|
18
19
|
end
|
@@ -6,14 +6,14 @@
|
|
6
6
|
# Ignore bundler config.
|
7
7
|
/.bundle
|
8
8
|
|
9
|
+
# Ignore all environment files (except templates).
|
10
|
+
/.env*
|
11
|
+
!/.env*.erb
|
12
|
+
|
9
13
|
# Ignore all default key files.
|
10
14
|
/config/master.key
|
11
15
|
/config/credentials/*.key
|
12
16
|
|
13
|
-
# Ignore all environment files.
|
14
|
-
/.env*
|
15
|
-
!/.env.example
|
16
|
-
|
17
17
|
# Ignore all logfiles and tempfiles.
|
18
18
|
/log/*
|
19
19
|
/tmp/*
|
@@ -40,16 +40,43 @@ module Rails
|
|
40
40
|
gsub_file("Gemfile", gem_entry_regex_for(name), gem_entry_for(name, *version))
|
41
41
|
end
|
42
42
|
|
43
|
+
def edit_dockerfile
|
44
|
+
build_name = docker_for_database_build
|
45
|
+
deploy_name = docker_for_database_deploy
|
46
|
+
if build_name
|
47
|
+
gsub_file("Dockerfile", all_docker_builds_regex, build_name)
|
48
|
+
end
|
49
|
+
if deploy_name
|
50
|
+
gsub_file("Dockerfile", all_docker_deploys_regex, deploy_name)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
43
54
|
private
|
44
55
|
def all_database_gems
|
45
56
|
DATABASES.map { |database| gem_for_database(database) }
|
46
57
|
end
|
47
58
|
|
59
|
+
def all_docker_builds
|
60
|
+
DATABASES.map { |database| docker_for_database_build(database).nil? ? nil : docker_for_database_build(database) }.compact!
|
61
|
+
end
|
62
|
+
|
63
|
+
def all_docker_deploys
|
64
|
+
DATABASES.map { |database| docker_for_database_deploy(database).nil? ? nil : docker_for_database_deploy(database) }.compact!
|
65
|
+
end
|
66
|
+
|
48
67
|
def all_database_gems_regex
|
49
68
|
all_database_gem_names = all_database_gems.map(&:first)
|
50
69
|
/(\b#{all_database_gem_names.join('\b|\b')}\b)/
|
51
70
|
end
|
52
71
|
|
72
|
+
def all_docker_builds_regex
|
73
|
+
/(\b#{all_docker_builds.join('\b|\b')}\b)/
|
74
|
+
end
|
75
|
+
|
76
|
+
def all_docker_deploys_regex
|
77
|
+
/(\b#{all_docker_deploys.join('\b|\b')}\b)/
|
78
|
+
end
|
79
|
+
|
53
80
|
def gem_entry_regex_for(gem_name)
|
54
81
|
/^gem.*\b#{gem_name}\b.*/
|
55
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.0.
|
4
|
+
version: 7.1.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.1.0.
|
19
|
+
version: 7.1.0.rc2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.1.0.
|
26
|
+
version: 7.1.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 7.1.0.
|
33
|
+
version: 7.1.0.rc2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 7.1.0.
|
40
|
+
version: 7.1.0.rc2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rackup
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,14 +120,14 @@ dependencies:
|
|
120
120
|
requirements:
|
121
121
|
- - '='
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: 7.1.0.
|
123
|
+
version: 7.1.0.rc2
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - '='
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: 7.1.0.
|
130
|
+
version: 7.1.0.rc2
|
131
131
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
132
132
|
email: david@loudthinking.com
|
133
133
|
executables:
|
@@ -457,10 +457,10 @@ licenses:
|
|
457
457
|
- MIT
|
458
458
|
metadata:
|
459
459
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
460
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.1.0.
|
461
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.0.
|
460
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.0.rc2/railties/CHANGELOG.md
|
461
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.0.rc2/
|
462
462
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
463
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.0.
|
463
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.0.rc2/railties
|
464
464
|
rubygems_mfa_required: 'true'
|
465
465
|
post_install_message:
|
466
466
|
rdoc_options:
|