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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6bd5ef3fd826daba56de7c93ff5b7ca0481090c6699f69a86493c32878e3bb1
4
- data.tar.gz: a2605e31ee7524c2aae5fb88f89201f22e97219fcb42f391a359a60cd1b667c3
3
+ metadata.gz: 4d9c922d487cf3c067c1a65e48220c5073060674bc98fd7d1bb8b1fd8ff9a557
4
+ data.tar.gz: 47298c50c11159f36d8f213fffc70aa1d416c114c1ee4a48d980e521ae88fb5c
5
5
  SHA512:
6
- metadata.gz: 03b9cbaa154995862acc1d1e6f2cdcf1780fea3ddb9e3f0af8586b0d4698d08869e517d2d2f61057dd316e1cc723759da66de1ae6a8d01dfff30edd8c824711d
7
- data.tar.gz: 59ccbc1582559ddc5baff3ea789bbf8e56a463100ed2d8858b852eaeb4feeb6cb0c178d4bf2e2abafce0b1e2b8145756a068d32996fd3e71ab992facb4ad646f
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
@@ -80,7 +80,7 @@ module Rails
80
80
  console.level = Rails.logger.level
81
81
 
82
82
  unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT)
83
- Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
83
+ Rails.logger.broadcast_to(console)
84
84
  end
85
85
  end
86
86
 
@@ -10,7 +10,7 @@ module Rails
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
12
  TINY = 0
13
- PRE = "beta1"
13
+ PRE = "rc2"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -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 "bun-v#{`bun --version`[/\d+\.\d+\.\d+/]}"
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
- <% end %>
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, see https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#config-autoload-lib-ignore.
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 options[:skip_action_cable] -%>
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"
@@ -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. Use this to limit dissemination of
4
- # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
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
  ]
@@ -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,5 +6,5 @@ Rails.application.routes.draw do
6
6
  get "up" => "rails/health#show", as: :rails_health_check
7
7
 
8
8
  # Defines the root path route ("/")
9
- # root "articles#index"
9
+ # root "posts#index"
10
10
  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/*
@@ -7,6 +7,10 @@
7
7
  # Ignore bundler config.
8
8
  /.bundle
9
9
 
10
+ # Ignore all environment files (except templates).
11
+ /.env*
12
+ !/.env*.erb
13
+
10
14
  # Ignore all logfiles and tempfiles.
11
15
  /log/*
12
16
  /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.beta1
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-09-13 00:00:00.000000000 Z
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.beta1
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.beta1
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.beta1
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.beta1
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.beta1
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.beta1
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.beta1/railties/CHANGELOG.md
461
- documentation_uri: https://api.rubyonrails.org/v7.1.0.beta1/
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.beta1/railties
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: