Commit Graph

822 Commits

Author SHA1 Message Date
eileencodes a8e07924d6 Fix dependency on JSON gem
Don't use `json` 2.7.0 release that has a regression.

Ref: https://github.com/flori/json/pull/554
2023-12-02 09:41:55 +01:00
Jonathan Hefner 3cac3c3397 Update SDoc to latest revision 2023-11-14 16:08:31 -06:00
Jean Boussier 7ae4a5f3b5 Automatically eager load TZInfo
On the first call it can be a bit slow because it needs to load
a bunch of data. It's also better to do it as part of boot
so that some of that data is shared via Copy-on-Write
2023-11-09 18:44:27 +01:00
Yasuo Honda 36c49b3cf5 Bump timeout to 0.4.1
This commit addresses the following CI failure
https://buildkite.com/rails/rails/builds/101658#018ba903-f8d8-4187-929c-fc7996bb17f3

- Without this fix
```
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ cd guides/bug_report_templates
$ ruby action_controller_gem.rb
... snip
/home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated timeout 0.3.1, but your Gemfile requires timeout 0.4.1. Since timeout is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports timeout as a default gem. (Gem::LoadError)
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:25:in `block in setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `map'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:66:in `block in gemfile'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/settings.rb:131:in `temporary'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:50:in `gemfile'
	from action_controller_gem.rb:5:in `<main>'
$
```
2023-11-08 11:01:58 +09:00
Rafael Mendonça França 403447d061
Use version of importmap that support loading outside of an app
We are using it in a few scripts, and we were doing workarounds
to be able to use outside an Rails application.

Now the workaround is gone.
2023-10-27 20:23:42 +00:00
Jonathan Hefner ad1e443e53 Update SDoc to latest revision 2023-10-21 16:00:16 -05:00
Hartley McGuire 5005480adf
Add racc dependency because it will be bundled
Ruby 3.3.0 is going to start warning for racc not being specififed as a
dependency, and Ruby 3.4.0 will raise if it is not specified.

This commit prevents those issues by adding racc to the Action Pack
gemspec, since `racc/parser` is a runtime dependency of the Journey
parser.
2023-10-20 12:59:18 -04:00
Jean Boussier bcdeea5da7 Drop dependency on mutex_m
It used to be stdlib but is being extracted in modern rubies.

Overall its usefulness is dubious. In all cases it is included in
Rails, it's only for the `synchronize` method, but end up exposing
a dozen other useless methods.

In the end just using a Mutex is clearer and simpler.

In some cases we can even get away with a single mutex in a constant.
2023-10-18 14:27:26 +02:00
Yasuo Honda e9106d0b20 Bump psych to 5.1.1.1
This commit addresses action_controller_gem.rb failure by updating psych as follows.
`$ bundle update psych --conservative`

Refer to https://buildkite.com/rails/rails/builds/100884#018b3a84-f1c5-4461-839c-5cfbe26ee001/1092-1125

- Without this commit
```
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ cd guides/bug_report_templates
$ ruby action_controller_gem.rb
Fetching gem metadata from https://rubygems.org/...........
... snip ...
Using rails 7.1.1
/home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated psych 5.1.0, but your Gemfile requires psych 5.1.1.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:25:in `block in setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/spec_set.rb:155:in `each'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `map'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/runtime.rb:24:in `setup'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:66:in `block in gemfile'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/settings.rb:131:in `temporary'
	from /home/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.3.22/lib/bundler/inline.rb:50:in `gemfile'
	from action_controller_gem.rb:5:in `<main>'
$
```
2023-10-17 08:44:14 +09:00
fatkodima b8829cabec Enable `Style/RedundantDoubleSplatHashBraces` rubocop cop 2023-10-11 14:55:00 +03:00
Jonathan Hefner 2533044859 Update SDoc to latest revision 2023-10-08 13:49:43 -05:00
Usman 24b99910cf No need to include error_highlight when ruby version >= 3.2 2023-09-29 09:05:06 +00:00
Rafael Mendonça França fb6c6007d0
Development of Rails 7.2 starts now
🎉
2023-09-27 03:59:11 +00:00
Rafael Mendonça França e5386cb402
Preparing for 7.1.0.rc1 release 2023-09-27 03:08:31 +00:00
zzak 5c2a112d37
Import rails-bin to internal tools/
Co-authored-by: zzak <zzakscott@gmail.com>
2023-09-13 01:57:16 +00:00
Rafael Mendonça França 699dfdb426
Preparing for 7.1.0.beta1 release 2023-09-13 00:36:01 +00:00
Mike Dalessio 64169655c7
dep: bump sqlite3 dependency
sqlite3-ruby v1.6.6 has sqlite 3.43.1 which fixes the AVG() bug
described in https://github.com/sparklemotion/sqlite3-ruby/issues/396

See related https://github.com/rails/rails/pull/49048
2023-09-12 14:18:13 -04:00
Cody Cutrer 6adfe05f9e Update mysql2 gem
So that it can find the mysql libraries with homebrew on arm64
2023-09-06 13:27:27 -06:00
Rafael Mendonça França e4d47eaecf
Revert "Lock globalid gem version to address broken CI"
This reverts commit 6440efa9ea.
2023-09-05 16:17:49 +00:00
Ryuta Kamizono 6440efa9ea Lock globalid gem version to address broken CI
Broken CI is due to https://github.com/rails/globalid/pull/163 in
globalid 1.2.0.

https://buildkite.com/rails/rails/builds/99329#018a5f01-a966-4424-9596-0a7f1deeb1ff/1178-1190
2023-09-04 16:40:19 +09:00
Rafael Mendonça França 7459392bf1
Use the released version of trilogy 2023-09-01 20:39:50 +00:00
Rafael Mendonça França 4aa1625edd
Always install sdoc from git
The EDGE environment variable isn't set when installing the gems.
Since this branch is the edge branch, we don't need this environment
variable.
2023-08-28 15:29:58 +00:00
zzak 0f580a20fe
Try to build with sqlite3 1.6.3 2023-08-27 09:29:29 +09:00
Koichi ITO a77535c74c Add bigdecimal to runtime dependency
## Motivation / Background

Follow up 1c93288f8b.

This PR adds bigdecimal to runtime dependency of Active Support to suppress the following Ruby 3.3.0dev's warning.

> /Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/bundler/gems/rails-a8871e6829e5/activesupport/lib/
> active_support/core_ext/object/json.rb:5: warning: bigdecimal will be not part of the default gems since Ruby 3.4.0.
> Add bigdecimal to your Gemfile. Also contact author of  to add bigdecimal into its gemspec.

The grep yields the following results:

```console
$ git grep 'require.*bigdecimal'
activejob/lib/active_job/arguments.rb:3:require "bigdecimal"
activejob/lib/active_job/serializers/big_decimal_serializer.rb:3:require "bigdecimal"
activejob/test/cases/argument_serialization_test.rb:3:require "bigdecimal"
activemodel/lib/active_model/type/decimal.rb:3:require "bigdecimal/util"
activemodel/lib/active_model/validations/numericality.rb:5:require "bigdecimal/util"
activemodel/test/cases/validations/numericality_validation_test.rb:8:require "bigdecimal"
activerecord/test/cases/adapters/sqlite3/quoting_test.rb:4:require "bigdecimal"
activerecord/test/cases/arel/visitors/to_sql_test.rb:4:require "bigdecimal"
activerecord/test/cases/migration_test.rb:5:require "bigdecimal/util"
activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:3:require "bigdecimal"
activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:4:require "bigdecimal/util"
activesupport/lib/active_support/core_ext/object/json.rb:5:require "bigdecimal"
activesupport/lib/active_support/message_pack/extensions.rb:3:require "bigdecimal"
activesupport/lib/active_support/xml_mini.rb:5:require "bigdecimal"
activesupport/lib/active_support/xml_mini.rb:6:require "bigdecimal/util"
activesupport/test/core_ext/hash_ext_test.rb:4:require "bigdecimal"
activesupport/test/core_ext/object/duplicable_test.rb:4:require "bigdecimal"
activesupport/test/hash_with_indifferent_access_test.rb:4:require "bigdecimal"
activesupport/test/json/encoding_test_cases.rb:3:require "bigdecimal"
```

By adding only to Active Support as a dependency, it should resolve the issue due to the dependency.

## Detail

The warning is confirmed in the following step:

```ruby
$ cat generic_main.rb
# frozen_string_literal: true

require 'bundler/inline'

gemfile(true) do
  source 'https://rubygems.org'

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails", branch: "main"
end

require 'active_support'
require 'minitest/autorun'
# These gems will be bundled gems in Ruby 3.4
require 'bigdecimal'
```

Run generic_main.rb with Ruby 3.3.0dev below.

```console
$ ruby -v
ruby 3.3.0dev (2023-08-25T17:47:04Z master 7d32011399) [x86_64-darwin22]

$ ruby generic_main.rb
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/bundler/gems/rails-a8871e6829e5/activesupport/lib/
active_support/core_ext/object/json.rb:5: warning: bigdecimal will be not part of the default gems since Ruby 3.4.0.
Add bigdecimal to your Gemfile. Also contact author of  to add bigdecimal into its gemspec.
Run options: --seed 39015

# Running:

Finished in 0.001313s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
```

## Additional information

It is essentially the same as https://github.com/rails/rails/pull/48907.
2023-08-26 03:40:25 +09:00
Hartley McGuire 2d61a206f4
Fix served_url printed when using Puma & Rack 3
This `#use_puma?` check was [introduced][1] because Rails could
potentially display the wrong server URL in development if another host
or port is configured in `config/puma.rb`.

However, in Rack 3 the the name of the server class changed from
`Rack::Handler::Puma` to `Rackup::Handler::Puma`, which means that the
served_url is being logged again.

This commit fixes the check to accept either version of the class.
Additionally, puma was updated in Gemfile.lock because Puma 6.0.x prints
a deprecation warning about Rack::Handler that's fixed in 6.1.0.

[1]: 29648ff60e
2023-08-17 20:01:19 -04:00
Yasuo Honda 3e52adf28e Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
This commit adds `drb`, `mutex_m` and `base64` to `activesupport/activesupport.gemspec`
because 3.3.0dev shows warnings if bundled gem candidates are required
like `mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.`

- Example
```
$ ruby -v ; ruby generic_main.rb
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
Fetching https://github.com/rails/rails.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/.......
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/notifications/fanout.rb:3: warning: mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/message_encryptor.rb:4: warning: base64 will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
generic_main.rb:16: warning: drb will be not part of the default gems since Ruby 3.4.0. Add it to your inline Gemfile.
$
```

- generic_main.rb
```

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails", branch: "main"
end

require "active_support"
require "minitest/autorun"
require "drb"
require "base64"
require "mutex_m"
```

These gems are chosen as follows.

- Bundled gems candidates for Ruby 3.4

```ruby
$ ruby -v ; ruby -e 'pp Gem::BUNDLED_GEMS::SINCE.select { |k,v| v == "3.4.0" }'
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
{"abbrev"=>"3.4.0",
 "observer"=>"3.4.0",
 "getoptlong"=>"3.4.0",
 "resolv-replace"=>"3.4.0",
 "rinda"=>"3.4.0",
 "nkf"=>"3.4.0",
 "syslog"=>"3.4.0",
 "drb"=>"3.4.0",
 "mutex_m"=>"3.4.0",
 "csv"=>"3.4.0",
 "base64"=>"3.4.0"}
$
```

- `drb`, `mutex_m` and `base64` are required by Rails

- "drb"

```ruby
$ git grep 'require "drb"'
activesupport/lib/active_support/testing/parallelization.rb:require "drb"
activesupport/lib/active_support/testing/parallelization/server.rb:require "drb"
```

- "mutex_m"

```ruby
$ git grep 'require "mutex_m"'
actionpack/lib/action_controller/metal/params_wrapper.rb:    require "mutex_m"
activerecord/lib/active_record/attribute_methods.rb:require "mutex_m"
activerecord/lib/active_record/relation/delegation.rb:require "mutex_m"
activesupport/lib/active_support/notifications/fanout.rb:require "mutex_m"
```

- "base64" usage

```ruby
$ git grep 'require "base64"'
actioncable/Rakefile:require "base64"
actionmailer/lib/action_mailer/inline_preview_interceptor.rb:require "base64"
actionpack/lib/action_controller/metal/http_authentication.rb:require "base64"
actionview/Rakefile:require "base64"
activerecord/lib/active_record/encryption/message_serializer.rb:require "base64"
activerecord/lib/active_record/fixture_set/render_context.rb:require "base64"
activerecord/test/cases/encryption/message_serializer_test.rb:require "base64"
activesupport/lib/active_support/message_encryptor.rb:require "base64"
activesupport/lib/active_support/message_verifier.rb:require "base64"
activesupport/lib/active_support/xml_mini.rb:require "base64"
railties/test/application/mailer_previews_test.rb:require "base64"
```

- Dependency between Rails related modules

- "drb" is only required by Active Support

- "mutex_m" is required by Action Pack, Active Record and Active Support
  Action Pack and Active Record depend on Active Support. Therefore, adding dependency to Active Support is fine.

  2942958827/actionpack/actionpack.gemspec (L36)
  2942958827/activerecord/activerecord.gemspec (L38)

- "base64" is required by Action Cable, Action Mailer, Action Pack, Action View,
  Active Record, Active Support and Raillties.
  Action Cable, Action Mailer, Action Pack, Action View and Active Record and Railties depend
  on Active Support. Therefore, adding dependency to Active Support is fine.

  2942958827/actioncable/actioncable.gemspec (L35)
  2942958827/actionmailer/actionmailer.gemspec (L36)
  2942958827/actionpack/actionpack.gemspec (L36)
  2942958827/actionview/actionview.gemspec (L36)
  2942958827/actionpack/actionpack.gemspec (L36)
  2942958827/railties/railties.gemspec (L40)

Refer to:
https://bugs.ruby-lang.org/issues/19776
https://github.com/ruby/ruby/pull/8126
https://github.com/rubygems/rubygems/pull/6840
2023-08-08 21:08:48 +09:00
Rafael Mendonça França 191ae490ed
Make trilogy tests pass on MariaDB
* `supports_json?` always return false on mariadb so the test needs to
stub.
* to_a(as: :hash) is not supported on trilogy. And we should be dealing
with ActiveRecord::Result objects anyway.
2023-08-04 03:33:13 +00:00
Mike Dalessio 8a57ba8c0e
Update Action View and Dispatch to use Rails::Dom::Testing helpers
Use the helpers introduced in rails-dom-testing 2.2.0 instead of
managing the HTML parsers as was done in #48523.

See also related #47144 / ad79ed0e
2023-08-03 11:17:38 -04:00
Jean Boussier ee3117ba8a
Merge pull request #48863 from matteeyah/main
Save screenshot path on system test failure
2023-08-03 16:35:29 +02:00
Matija Čupić a962fc3c9c
Save failure screenshot path in test metadata 2023-08-03 14:43:49 +02:00
Sean Doyle 9a53234695 Omit `webdrivers` gem from `Gemfile` template
As of Selenium 4.6, [the Selenium Manager is capable of managing Chrome
Driver installations and integrations][readme]. As of Selenium 4.11, the
Selenium Manager is capable of [capable of resolving the Chrome for
Testing installation][] path.

By omitting the `gem` declaration from the `Gemfile.tt`, newly generated
applications and applications updating their `Gemfile` in lockstep with
newer Rails versions can shed the dependency and avoid test failures
introduced by newly released Chrome versions (like, for example,
[titusfortner/webdrivers#247][]).

[readme]: 43f8ac436c (update-selenium-manager)
[titusfortner/webdrivers#247]: https://github.com/titusfortner/webdrivers/issues/247
[capable of resolving the Chrome for Testing installation]: https://github.com/rails/rails/pull/48847#issuecomment-1656756862

Co-authored-by: Titus Fortner <titusfortner@users.noreply.github.com>
2023-08-01 09:22:08 -04:00
Samuel Williams 77485b0b82
Update `rack-cache` dependency. 2023-07-19 15:36:57 +12:00
Jean Boussier 5fbaa524b9 Active Record commit transaction on `return`, `break` and `throw`
Fix: https://github.com/rails/rails/issues/45017
Ref: https://github.com/rails/rails/pull/29333
Ref: https://github.com/ruby/timeout/pull/30

Historically only raised errors would trigger a rollback, but in Ruby `2.3`, the `timeout` library
started using `throw` to interupt execution which had the adverse effect of committing open transactions.

To solve this, in Active Record 6.1 the behavior was changed to instead rollback the transaction as it was safer
than to potentially commit an incomplete transaction.

Using `return`, `break` or `throw` inside a `transaction` block was essentially deprecated from Rails 6.1 onwards.

However with the release of `timeout 0.4.0`, `Timeout.timeout` now raises an error again, and Active Record is able
to return to its original, less surprising, behavior.
2023-07-10 10:37:42 +02:00
Hartley McGuire f3027d7ffb
Upgrade rack to fix "assigned but unused variable"
Previously, using Rack::Sendfile would result in the following warning:

```
/usr/local/bundle/gems/rack-3.0.7/lib/rack/sendfile.rb:114: warning: assigned but unused variable - status
```

and this would print more than 150 times when running
test/application/configuration_test.rb in Railties. This commit fixes
the warnings by updating rack to 3.0.8 where the warning was fixed.
2023-06-13 23:28:08 -04:00
Guillermo Iguaran a96d5beb63 Upgrade rack and related dependencies in Gemfile and lockfile 2023-06-12 21:45:58 -07:00
Akira Matsuda 341db94b22
Revert "Switch to i18n master branch temporary to fix actionview test"
This reverts commit 43f4792f16.

i18n 1.14.1 is available now
2023-06-05 08:38:18 +09:00
Guillermo Iguaran 43f4792f16 Switch to i18n master branch temporary to fix actionview test
Revert this commit after i18n > 1.14.0 is released.
2023-06-03 18:49:03 -07:00
Hiroshi SHIBATA 891d5d68b3
Bump up stringio-3.0.7 2023-06-02 17:24:29 +09:00
Stan Lo 3438316e46
Don't install readline-ext 2023-06-01 17:55:27 +01:00
Mike Dalessio 500ccaaeea
Update dependency on rails-html-sanitizer to ~>1.6
for HTML5 sanitizer support
2023-05-28 14:00:35 -04:00
Hartley McGuire 3ae8f4d171
Fix chmod race condition when generating key
Encrypted keys were updated [previously][1] to restrict other users from
reading the file by default. However, there is a brief period of time
between an encrypted key being created and its permissions being set to
0600. This means that it is possible for another user to read that file
during that time.

This commit fixes that issue by setting the desired permissions when the
file is created. The ability to use the `perm` option was added in Thor
1.2.2 so the minimum version was updated in the Railties gemspec.

[1]: 4c6c3575c6
2023-05-11 16:29:26 -04:00
Yasuo Honda a6e0b0acb2 Add `readline-ext` that has been removed from Ruby 3.3.0dev
Address these Rails CI failures:
https://buildkite.com/rails/rails/builds/96301#01880117-acb1-4d77-935a-4a1de13c8609/1093-1101

Refer to
https://bugs.ruby-lang.org/issues/19616
https://github.com/ruby/ruby/pull/7781

```ruby
$ ruby -v
ruby 3.3.0dev (2023-05-09T19:40:26Z master e1c84e8ee6) [x86_64-linux]
$ cd railties
$ bin/test test/application/console_test.rb
... snip ...

.F

Failure:
FullStackConsoleTest#test_environment_option_and_irb_option [/home/yahonda/src/github.com/rails/rails/railties/test/application/console_test.rb:133]:
"> " expected, but got:

Loading test environment (Rails 7.1.0.alpha)
Switch to inspect mode.
▽.
Expected # encoding: ASCII-8BIT
"Loading test environment (Rails 7.1.0.alpha)\r\nSwitch to inspect mode.\r\n\e[1G\xE2\x96\xBD\e[6n" to include "> ".

bin/test test/application/console_test.rb:167

^[[30;2RF

Failure:
FullStackConsoleTest#test_sandbox [/home/yahonda/src/github.com/rails/rails/railties/test/application/console_test.rb:133]:
"> " expected, but got:

Loading development environment in sandbox (Rails 7.1.0.alpha)
Any modifications you make will be rolled back on exit
▽.
Expected # encoding: ASCII-8BIT
"Loading development environment in sandbox (Rails 7.1.0.alpha)\r\nAny modifications you make will be rolled back on exit\r\n\e[1G\xE2\x96\xBD\e[6n" to include "> ".

bin/test test/application/console_test.rb:139

^[[30;2R......

Finished in 66.153595s, 0.1360 runs/s, 0.2872 assertions/s.
9 runs, 19 assertions, 2 failures, 0 errors, 0 skips
$
```
2023-05-10 08:33:13 +09:00
Jean Boussier 1794bc3437 Update pg gem to 1.5.3
Ref: https://github.com/ged/ruby-pg/issues/530

Fix segfault witnessed in https://buildkite.com/rails/rails/builds/96048#0187c9f9-fafa-4795-a52f-163071126d61
2023-05-03 09:16:51 +02:00
Wojciech Wnętrzak f05de69c17
Fix pg 1.5 deprecation warning
Closes #48046
2023-04-25 08:39:23 +02:00
eileencodes 14f22758cc
Bump trilogy to fix connection error translation
Until we do a new release we need to run against main on trilogy to get
the latest changes from https://github.com/github/trilogy/pull/69
2023-04-21 17:33:25 -04:00
Eileen M. Uchitelle f7a40229e3
Merge pull request #47880 from adrianna-chang-shopify/ac-trilogy-adapter
Introduce adapter for Trilogy, a MySQL-compatible DB client
2023-04-17 14:56:49 -04:00
Jonathan Hefner a2a6331451 Add ActiveSupport::MessagePack
`ActiveSupport::MessagePack` is a serializer that integrates with the
`msgpack` gem to serialize a variety of Ruby objects.  `AS::MessagePack`
supports several types beyond the base types that `msgpack` supports,
including `Time` and `Range`, as well as Active Support types such as
`AS::TimeWithZone` and `AS::HashWithIndifferentAccess`.

Compared to `JSON` and `Marshal`, `AS::MessagePack` can provide a
performance improvement and message size reduction.  For example, when
used with `MessageVerifier`:

  ```ruby
  # frozen_string_literal: true

  require "benchmark/ips"
  require "active_support/all"
  require "active_support/message_pack"

  marshal_verifier = ActiveSupport::MessageVerifier.new("secret", serializer: Marshal)
  json_verifier = ActiveSupport::MessageVerifier.new("secret", serializer: JSON)
  asjson_verifier = ActiveSupport::MessageVerifier.new("secret", serializer: ActiveSupport::JSON)
  msgpack_verifier = ActiveSupport::MessageVerifier.new("secret", serializer: ActiveSupport::MessagePack)

  ActiveSupport::Messages::Metadata.use_message_serializer_for_metadata = true
  expiry = 1.year.from_now
  data = { bool: true, num: 123456789, string: "x" * 50 }

  Benchmark.ips do |x|
    x.report("Marshal") do
      marshal_verifier.verify(marshal_verifier.generate(data, expires_at: expiry))
    end

    x.report("JSON") do
      json_verifier.verify(json_verifier.generate(data, expires_at: expiry))
    end

    x.report("AS::JSON") do
      asjson_verifier.verify(asjson_verifier.generate(data, expires_at: expiry))
    end

    x.report("MessagePack") do
      msgpack_verifier.verify(msgpack_verifier.generate(data, expires_at: expiry))
    end

    x.compare!
  end

  puts "Marshal size: #{marshal_verifier.generate(data, expires_at: expiry).bytesize}"
  puts "JSON size: #{json_verifier.generate(data, expires_at: expiry).bytesize}"
  puts "MessagePack size: #{msgpack_verifier.generate(data, expires_at: expiry).bytesize}"
  ```

  ```
  Warming up --------------------------------------
               Marshal     1.206k i/100ms
                  JSON     1.165k i/100ms
              AS::JSON   790.000  i/100ms
           MessagePack     1.798k i/100ms
  Calculating -------------------------------------
               Marshal     11.748k (± 1.3%) i/s -     59.094k in   5.031071s
                  JSON     11.498k (± 1.4%) i/s -     58.250k in   5.066957s
              AS::JSON      7.867k (± 2.4%) i/s -     39.500k in   5.024055s
           MessagePack     17.865k (± 0.8%) i/s -     89.900k in   5.032592s

  Comparison:
           MessagePack:    17864.9 i/s
               Marshal:    11747.8 i/s - 1.52x  (± 0.00) slower
                  JSON:    11498.4 i/s - 1.55x  (± 0.00) slower
              AS::JSON:     7866.9 i/s - 2.27x  (± 0.00) slower

  Marshal size: 254
  JSON size: 234
  MessagePack size: 194
  ```

Additionally, `ActiveSupport::MessagePack::CacheSerializer` is a
serializer that is suitable for use as an `ActiveSupport::Cache` coder.
`AS::MessagePack::CacheSerializer` can serialize `ActiveRecord::Base`
instances, including loaded associations.  Like `AS::MessagePack`, it
provides a performance improvement and payload size reduction:

  ```ruby
  # frozen_string_literal: true

  require "benchmark/ips"
  require "active_support/message_pack"

  ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")

  ActiveRecord::Schema.define do
    create_table :posts, force: true do |t|
      t.string :body
      t.timestamps
    end

    create_table :comments, force: true do |t|
      t.integer :post_id
      t.string :body
      t.timestamps
    end
  end

  class Post < ActiveRecord::Base
    has_many :comments
  end

  class Comment < ActiveRecord::Base
    belongs_to :post
  end

  post = Post.create!(body: "x" * 100)
  2.times { post.comments.create!(body: "x" * 100) }
  post.comments.load
  cache_entry = ActiveSupport::Cache::Entry.new(post)

  Rails70Coder = ActiveSupport::Cache::Coders::Rails70Coder
  CacheSerializer = ActiveSupport::MessagePack::CacheSerializer

  Benchmark.ips do |x|
    x.report("Rails70Coder") do
      Rails70Coder.load(Rails70Coder.dump(cache_entry))
    end

    x.report("CacheSerializer") do
      CacheSerializer.load(CacheSerializer.dump(cache_entry))
    end

    x.compare!
  end

  puts "Rails70Coder size: #{Rails70Coder.dump(cache_entry).bytesize}"
  puts "CacheSerializer size: #{CacheSerializer.dump(cache_entry).bytesize}"
  ```

  ```
  Warming up --------------------------------------
          Rails70Coder   329.000  i/100ms
       CacheSerializer   492.000  i/100ms
  Calculating -------------------------------------
          Rails70Coder      3.285k (± 1.7%) i/s -     16.450k in   5.008447s
       CacheSerializer      4.895k (± 2.4%) i/s -     24.600k in   5.028803s

  Comparison:
       CacheSerializer:     4894.7 i/s
          Rails70Coder:     3285.4 i/s - 1.49x  slower

  Rails70Coder size: 808
  CacheSerializer size: 593
  ```

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-04-17 11:56:06 -05:00
Adrianna Chang 5ed3f60df6
Introduce adapter for Trilogy, a MySQL-compatible DB client
The [Trilogy database client][trilogy-client] and corresponding
[Active Record adapter][ar-adapter] were both open sourced by GitHub last year.

Shopify has recently taken the plunge and successfully adopted Trilogy in their Rails monolith.
With two major Rails applications running Trilogy successfully, we'd like to propose upstreaming the adapter
to Rails as a MySQL-compatible alternative to Mysql2Adapter.

[trilogy-client]: https://github.com/github/trilogy
[ar-adapter]: https://github.com/github/activerecord-trilogy-adapter

Co-authored-by: Aaron Patterson <tenderlove@github.com>
Co-authored-by: Adam Roben <adam@roben.org>
Co-authored-by: Ali Ibrahim <aibrahim2k2@gmail.com>
Co-authored-by: Aman Gupta <aman@tmm1.net>
Co-authored-by: Arthur Nogueira Neves <github@arthurnn.com>
Co-authored-by: Arthur Schreiber <arthurschreiber@github.com>
Co-authored-by: Ashe Connor <kivikakk@github.com>
Co-authored-by: Brandon Keepers <brandon@opensoul.org>
Co-authored-by: Brian Lopez <seniorlopez@gmail.com>
Co-authored-by: Brooke Kuhlmann <brooke@testdouble.com>
Co-authored-by: Bryana Knight <bryanaknight@github.com>
Co-authored-by: Carl Brasic <brasic@github.com>
Co-authored-by: Chris Bloom <chrisbloom7@github.com>
Co-authored-by: Cliff Pruitt <cliff.pruitt@cliffpruitt.com>
Co-authored-by: Daniel Colson <composerinteralia@github.com>
Co-authored-by: David Calavera <david.calavera@gmail.com>
Co-authored-by: David Celis <davidcelis@github.com>
Co-authored-by: David Ratajczak <david@mockra.com>
Co-authored-by: Dirkjan Bussink <d.bussink@gmail.com>
Co-authored-by: Eileen Uchitelle <eileencodes@gmail.com>
Co-authored-by: Enrique Gonzalez <enriikke@gmail.com>
Co-authored-by: Garrett Bjerkhoel <garrett@github.com>
Co-authored-by: Georgi Knox <georgicodes@github.com>
Co-authored-by: HParker <HParker@github.com>
Co-authored-by: Hailey Somerville <hailey@hailey.lol>
Co-authored-by: James Dennes <jdennes@gmail.com>
Co-authored-by: Jane Sternbach <janester@github.com>
Co-authored-by: Jess Bees <toomanybees@github.com>
Co-authored-by: Jesse Toth <jesse.toth@github.com>
Co-authored-by: Joel Hawksley <joelhawksley@github.com>
Co-authored-by: John Barnette <jbarnette@github.com>
Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
Co-authored-by: John Hawthorn <john@hawthorn.email>
Co-authored-by: John Nunemaker <nunemaker@gmail.com>
Co-authored-by: Jonathan Hoyt <hoyt@github.com>
Co-authored-by: Katrina Owen <kytrinyx@github.com>
Co-authored-by: Keeran Raj Hawoldar <keeran@gmail.com>
Co-authored-by: Kevin Solorio <soloriok@gmail.com>
Co-authored-by: Leo Correa <lcorr005@gmail.com>
Co-authored-by: Lizz Hale <lizzhale@github.com>
Co-authored-by: Lorin Thwaits <lorint@gmail.com>
Co-authored-by: Matt Jones <al2o3cr@gmail.com>
Co-authored-by: Matthew Draper <matthewd@github.com>
Co-authored-by: Max Veytsman <mveytsman@github.com>
Co-authored-by: Nathan Witmer <nathan@zerowidth.com>
Co-authored-by: Nick Holden <nick.r.holden@gmail.com>
Co-authored-by: Paarth Madan <paarth.madan@shopify.com>
Co-authored-by: Patrick Reynolds <patrick.reynolds@github.com>
Co-authored-by: Rob Sanheim <rsanheim@gmail.com>
Co-authored-by: Rocio Delgado <rocio@github.com>
Co-authored-by: Sam Lambert <sam.lambert@github.com>
Co-authored-by: Shay Frendt <shay@github.com>
Co-authored-by: Shlomi Noach <shlomi-noach@github.com>
Co-authored-by: Sophie Haskins <sophaskins@github.com>
Co-authored-by: Thomas Maurer <tma@github.com>
Co-authored-by: Tim Pease <tim.pease@gmail.com>
Co-authored-by: Yossef Mendelssohn <ymendel@pobox.com>
Co-authored-by: Zack Koppert <zkoppert@github.com>
Co-authored-by: Zhongying Qiao <cryptoque@users.noreply.github.com>
2023-04-17 11:49:07 -04:00
Rafael Mendonça França 4d171a4bde
Merge pull request #47779 from zzak/mdl
Introduce markdownlint for guides
2023-03-29 15:33:41 -04:00
Vipul A M 6733e51a94 Fix Gemfile resolution on parser gem 2023-03-29 15:52:14 +05:30
Vipul A M 3d414f3986 Remove mini_mime usage in favour of marcel
We are using two libraries to do the same job. This commit removes the usage of mini_mime in favour of Marcel instead.

Changes are as follows:
- Replace MiniMime lookup by extension with Marcel Mimetype for lookup with extension
- Replaces usage of MiniMime lookup by content type to fetch extension with usage of Marcel Magic lookup. Marcel has multiple extentions being returned, we pick the first one. MiniMime always returns just one
- Removes specs which we specifically checking failing identification issue of MiniMine on jpeg images
- Removes mini_mime from gemspec
2023-03-27 23:24:43 +05:30
zzak c3f2b545f8
Introduce markdownlint for guides
This is a follow up to rails#47186, this time for all markdown content.

[markdownlint](https://github.com/markdownlint/markdownlint) is an excellent tool, and I've found it very useful for finding issues in the guides.

Many of the rules are common style issues I'm correcting on PRs, so it will be nice to have that automated.

We should also be able to use the same config with our editors, so that errors show up in real-time 🙏 and will update the contributing docs once this gets merged with how to debug and use mdl appropriately.
2023-03-27 12:14:18 +09:00
zzak dadf46de36
Add rubocop-md for linting guides snippets 2023-03-15 10:48:19 +09:00
Stan Lo 4fefed4239
Add irb to railties' dependencies
- Firstly, including irb as a dependency allows users with older versions
  of Ruby to benefit from the latest version of irb, instead of being
  limited to the version bundled with their Ruby installation.

- Additionally, there is an [ongoing discussion](https://bugs.ruby-lang.org/issues/19351) to move irb to bundled gems.
  If this change is implemented, users may need to declare irb in their
  Gemfile in order to use it for Rails console. By adding irb as a dependency,
  users can avoid the extra effort of manually specifying irb in their Gemfile.
2023-03-06 14:55:22 +08:00
Lázaro Nixon bde99e52ad
Install dartsass-rails when generating app with sass (#47545) 2023-03-01 06:51:29 +01:00
zzak 9bfa5eaa25
Bump timeout gem to 0.3.2 and fix CI 2023-02-16 12:59:21 +09:00
Jean Boussier 3635d2d9cf YAMLColumn: use `YAML.safe_dump` if available
One particularly annoying thing with YAMLColumn type restriction
is that it is only checked on load.

Which means if your code insert data with unsupported types, the
insert will work, but now you'll be unable to read the record, which
makes it hard to fix etc.

That's the reason why I implemented `YAML.safe_dump` (https://github.com/ruby/psych/pull/495).

It applies exactly the same restrictions than `safe_load`, which means
if you attempt to store non-permitted fields, it will fail on insertion
and not on further reads, so you won't create an invalid record in your
database.
2023-02-13 14:39:43 +01:00
zzak 68df3f2a3a
Bump SDoc to use zzak/sdoc#194 2023-02-07 18:57:04 +09:00
Eileen M. Uchitelle 36d8a1ce52
Merge pull request #47262 from koic/bump_rubocop_performance_to_1_16_0
Use RuboCop Performance 1.16.0
2023-02-06 09:21:43 -05:00
zzak 263d9ea626 Bump RDoc dependency
While we depend on rdoc through the sdoc gem, it only requires a minimum version.

This may be the cause for #47261 broke edgeapi.rubyonrails.org, those docs are generated with Ruby 2.6 or 2.7.

I'd also like to investigate increasing the Ruby version on the doc server, but I feel that has bigger impact.
2023-02-06 16:28:56 +09:00
Koichi ITO 5726b1d1d7 Use RuboCop Performance 1.16.0
## Summary

This PR bumps RuboCop Performance to 1.16.0 and suppresses the following new offenses:

```console
% bundle exec rubocop
(snip)

Offenses:

actionpack/lib/action_dispatch/routing/mapper.rb:309:16:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
            if /#/.match?(to)
               ^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/routing/mapper.rb:1643:18:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
              if /#/.match?(to)
                 ^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/routing/route_set.rb:887:67:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        path = Journey::Router::Utils.normalize_path(path) unless %r{://}.match?(path)
                                                                  ^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/testing/assertions/routing.rb:86:12:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        if %r{://}.match?(expected_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/testing/assertions/routing.rb:205:14:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
          if %r{://}.match?(path)
             ^^^^^^^^^^^^^^^^^^^^
actionpack/lib/action_dispatch/testing/integration.rb:235:12:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        if %r{://}.match?(path)
           ^^^^^^^^^^^^^^^^^^^^
actiontext/bin/webpack:18:6:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
  if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
actiontext/bin/webpack-dev-server:18:6:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
  if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb:120:64:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
          elsif column.type == :uuid && value.is_a?(String) && /\(\)/.match?(value)
                                                               ^^^^^^^^^^^^^^^^^^^^
railties/lib/rails/commands/secrets/secrets_command.rb:28:12:
C: [Correctable] Performance/StringInclude: Use String#include? instead of a regex match with literal-only pattern.
        if /secrets\.yml\.enc/.match?(error.message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

3088 files inspected, 10 offenses detected, 10 offenses autocorrectable
```

## Additional Information

This behavior change is based on:
https://github.com/rubocop/rubocop-performance/pull/332
2023-02-06 13:06:31 +09:00
zzak 9ff1a0496d Bump rubocop from 1.43.0 to 1.44.1 and fix offenses 2023-02-02 12:52:05 +09:00
Hartley McGuire 106692fb6c
Remove unused sequel gem from Gemfile
It was originally added in 175ba66664
as the database driver for Que in the Active Job integration tests.

However, the gem is now unused since the Que adapter and its integration
tests were removed in cb22eb2b36
2023-01-31 19:13:22 -05:00
Sean Doyle ad79ed0e6b `ActionDispatch::Testing::TestResponse#parsed_body` parse HTML with Nokogiri
Prior to this commit, the only out-of-the-box parsing that
`ActionDispatch::Testing::TestResponse#parsed_body` supported was for
`application/json` requests. This meant that `response.body ==
response.parsed_body` for HTML requests.

```ruby
get "/posts"
response.content_type         # => "text/html; charset=utf-8"
response.parsed_body.class    # => Nokogiri::HTML5::Document
response.parsed_body.to_html  # => "<!DOCTYPE html>\n<html>\n..."
```

Using `parsed_body` for JSON requests supports `Hash#fetch`, `Hash#dig`,
and Ruby 3.2 destructuring assignment and pattern matching.

The introduction of [Nokogiri support for pattern
matching][nokogiri-pattern-matching] poses an opportunity to make assertions
about the structure of the HTML response.

On top of that, there is ongoing work to [introduce pattern matching
support in MiniTest][minitest-pattern-matching].

[nokogiri-pattern-matching]: https://github.com/sparklemotion/nokogiri/pull/2523
[minitest-pattern-matching]: https://github.com/minitest/minitest/pull/936
2023-01-27 23:52:21 -05:00
Rafael Mendonça França 1b44989521
Merge PR #46594 2023-01-25 20:13:18 +00:00
Rafael Mendonça França 859b526c5b
Remove upper bound of rack
Allow users to install any version and try to see if Rails is compatible.
2023-01-25 15:25:49 +00:00
Samuel Williams 4c58755862
Add `rack-session` and `rackup` gems.
Rack 2 includes this code, but in Rack 3 it was extracted into gems. These
gems include a v1 release compatible with Rack 2, and a v2 release
compatible with Rack v3+.
2023-01-21 06:03:41 +13:00
Rafael Mendonça França 7333f9396a
Upgrade mail to fixed version
mail 2.8.0 had file permissions problems.
2023-01-12 20:07:02 +00:00
Rafael Mendonça França b8abf7e04d
Update all the development gems
Also fix permission in the devcontainer in the bundler folder.
2023-01-11 22:59:03 +00:00
Rafael Mendonça França 20c86755a3
Merge pull request #46960 from olefriis/update-nokogiri-to-get-rid-of-arch-specific-versions
Get rid of platform-specific versions of nokogiri in Gemfile.lock
2023-01-11 17:57:57 -05:00
Ole Friis 7eea325824 Remove platform-specific nokogiri versions from Gemfile.lock 2023-01-11 14:52:36 +00:00
Petrik 34b920e776 Upgrade sdoc to support Ruby 3.2
Add support for Ruby 3.2 as File.exists? has been removed
2023-01-11 12:46:46 +01:00
Yasuo Honda 91b02d832d Use Ruby 3.2 for RuboCop workflow
Also bumped rubocop, rubocop-minitest, rubocop-performance and rubocop-rails
because RuboCop workflow uses Gemfile.lock unlike Rails CI that removes it.
2023-01-05 10:43:08 +09:00
Hartley McGuire 0d339411e1
Remove sprockets-export from Gemfile
Its usage was removed in 7d116c9 but I forgot to remove it

The other changes come from running bundle install, it looks like they
were supposed to be removed in d9e79ce
2023-01-03 22:56:28 -05:00
Aaron Patterson 18b2964dea
Merge pull request #46206 from lsylvester/karma-ujs
use Karma as the test runner for the UJS tests
2023-01-03 17:45:52 -08:00
Lachlan Sylvester d9e79ce7f4 use Karma as the test runner for the UJS tests 2022-12-31 23:03:09 +11:00
Haroon Ahmed 7662fd653c Update capybara gem to version 3.38. This version supports puma 6 2022-12-27 22:00:36 +00:00
Kaíque Kandy Koga d1ba709b09 Update libxml-ruby
from 3.2.1 to 3.2.4
2022-12-22 01:01:19 -03:00
Petrik e17457bae2 Update sdoc to 2.5.0 to support better code highlighting 2022-12-19 15:44:34 +01:00
Yasuo Honda 425d60c97d
Revert "Lock sqlite3 gem to 1.4 to run Rails CI using rubylang/ruby:master-nightly-focal" 2022-12-16 08:47:32 +09:00
Akira Matsuda c73eafa634
Bump Rake version to 13 or higher for Ruby 3.2 compat
Rake 12 seems not to play nice with Ruby 3.2 because it does not include
baa23cc8a8
and thus cannot handle kwargs properly on Ruby 3.2.
2022-12-15 16:14:22 +09:00
Yasuo Honda 727d2b438b Lock sqlite3 gem to 1.4 to run Rails CI using rubylang/ruby:master-nightly-focal
Managed to reproduce https://buildkite.com/rails/rails/builds/90045#01839e89-85d4-4ef5-a443-6b2993f08f36

- Steps to reproduce

Install Docker
```
git clone https://github.com/rails/rails
cd rails
git clone https://github.com/rails/buildkite-config .buildkite/
RUBY_IMAGE=rubylang/ruby:master-nightly-focal docker-compose -f .buildkite/docker-compose.yml build base
```

- Actual behavior without this change

It gets `Gem::Ext::BuildError: ERROR: Failed to build gem native extension.`

The entire error message can be seen via
https://buildkite.com/rails/rails/builds/90045#01839e89-85d4-4ef5-a443-6b2993f08f36

- Why sqlite gem version is locked to 1.4?

The last successful build installed `sqlite3 1.5.1`. however now it
cannot install 1.5.1, 1.5.0 anymore.
https://buildkite.com/rails/rails/builds/90006#01839032-3ccd-4aca-ad58-2c08beb4351f/142-862

I still have not found the actual reason why. I've just found a related
issue https://bugs.ruby-lang.org/issues/19189
2022-12-13 20:14:04 +09:00
Jean Boussier 2c503ae8b2
Merge pull request #46650 from andynu/mail-2-8-0-sendmail-options
Change sendmail default options to match Mail 2.8.x arguments format.
2022-12-08 11:13:21 +01:00
Andy 0398459e9a Change sendmail default options to match Mail 2.8.x arguments format.
The Mail gem changed format of the delivery method arguments for
sendmail from a string to an array of strings in this commit
7e1196bd29

As the settings are now a sendmail delivery method produces the
following error:
```
.../mail-2.8.0/lib/mail/network/delivery_methods/sendmail.rb:53:in `initialize': :arguments expected to be an Array of individual string args (ArgumentError)
```

This also updates the mail dependency since the new default won't work
with the older versions.
2022-12-06 20:41:09 -05:00
Carl Brasic effe47c445 Replace `method_source` gem with Ripper
The `method_source` gem was added in
https://github.com/rails/rails/pull/19216. It was used to determine the
last line number of a given test method to support running tests by line
number.

But this is not something that requires an external dependency:
Ripper can do this easily, and it has the added advantage of not using
`eval` calls in a loop to do it as method_source does.

It gets a bit trickier when dealing with declarative `test "some test"`
style methods, but ripper can still handle those in a similar way.

This is a second try at a PR (https://github.com/rails/rails/pull/45904)
that got rolled back because the previous effort didn't handle the
declarative test style.
2022-12-05 13:51:56 -06:00
Jean Boussier 7d307797df Bump timeout gem to fix CI 2022-12-05 16:58:12 +01:00
Yasuo Honda 2794d5761f Use cgi 0.3.6 or higher to address CookieStoreTest#test_session_store_with_all_domains
This commit addresses the following error by using cgi 0.3.6 that
includes https://github.com/ruby/cgi/pull/29

```ruby
$ ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
$ gem info cgi

*** LOCAL GEMS ***

cgi (0.3.5)
    Author: Yukihiro Matsumoto
    Homepage: https://github.com/ruby/cgi
    Licenses: Ruby, BSD-2-Clause
    Installed at (default): /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0

    Support for the Common Gateway Interface protocol.
$
```

```
$ cd actionpack
$ bin/test test/dispatch/session/cookie_store_test.rb -n test_session_store_with_all_domains
Running 27 tests in a single process (parallelization threshold is 50)
Run options: -n test_session_store_with_all_domains --seed 24288

E

Error:
CookieStoreTest#test_session_store_with_all_domains:
ArgumentError: invalid domain: ".example.com"
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/3.1.0/cgi/cookie.rb:128:in `domain='
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/3.1.0/cgi/cookie.rb:95:in `initialize'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/mock.rb:239:in `new'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/mock.rb:239:in `block in parse_cookies_from_header'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/mock.rb:236:in `each'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/mock.rb:236:in `parse_cookies_from_header'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/mock.rb:187:in `initialize'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-test-2.0.2/lib/rack/test.rb:360:in `new'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-test-2.0.2/lib/rack/test.rb:360:in `process_request'
    /home/yahonda/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/rack-test-2.0.2/lib/rack/test.rb:155:in `request'
    /home/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/testing/integration.rb:285:in `process'
    /home/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/testing/integration.rb:16:in `get'
    /home/yahonda/src/github.com/rails/rails/actionpack/lib/action_dispatch/testing/integration.rb:376:in `get'
    /home/yahonda/src/github.com/rails/rails/actionpack/test/dispatch/session/cookie_store_test.rb:420:in `get'
    /home/yahonda/src/github.com/rails/rails/actionpack/test/dispatch/session/cookie_store_test.rb:379:in `block in test_session_store_with_all_domains'
    /home/yahonda/src/github.com/rails/rails/actionpack/test/dispatch/session/cookie_store_test.rb:438:in `block in with_test_route_set'
    /home/yahonda/src/github.com/rails/rails/actionpack/test/abstract_unit.rb:157:in `with_routing'
    /home/yahonda/src/github.com/rails/rails/actionpack/test/dispatch/session/cookie_store_test.rb:424:in `with_test_route_set'
    /home/yahonda/src/github.com/rails/rails/actionpack/test/dispatch/session/cookie_store_test.rb:378:in `test_session_store_with_all_domains'

bin/test test/dispatch/session/cookie_store_test.rb:377

Finished in 0.079807s, 12.5303 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
$
```

Related to
https://github.com/ruby/cgi/pull/29
https://github.com/rails/rails/issues/46578
2022-11-28 13:57:46 +09:00
Yasuo Honda db94278b15
Merge pull request #46496 from yahonda/error_highlight_051
Bump error_highlight 0.5.1 or higher
2022-11-14 22:36:48 +09:00
Koichi ITO d0ef331087 Enable `Lint/DuplicateMagicComment` cop
This PR enables `Lint/DuplicateMagicComment` cop to resolve
the background of https://github.com/rubocop/rubocop/issues/11043.

And this PR bumps RuboCop version because the cop was introduced in RuboCop 1.37.0:
https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md#1370-2022-10-20
2022-11-14 16:04:25 +09:00
Yasuo Honda e95051c734 Bump error_highlight 0.5.1 or higher
error_highlight 0.5.1 only changes ArgumentError#detailed_message
via https://github.com/ruby/error_highlight/pull/29

Therefore we can revert #46442 and bump the error_highlight version of
Gemfile.lock to the latest one.
2022-11-14 16:00:18 +09:00
Yasuo Honda 415fae9b2d Lock error_highlight version to 0.4.0
This commit locks error_highlight gem to 0.4.0
until https://github.com/ruby/error_highlight/issues/28 is resolved.

It should workaround CI failures like:
https://buildkite.com/rails/rails/builds/90833#0184571b-307d-4e94-8a2d-3c8a2669a12c/1052-1078
2022-11-08 23:33:35 +09:00
Jonathan Hefner 545a9908e8 Bump Puma to v6.0.0
The `Gemfile` was updated in #46106 to allow Puma 6.  Puma v6.0.0 was
released on 2022-10-14.  This commit updates `Gemfile.lock` to reflect
the new version.

This commit also updates the Puma version constraint used in generated
apps to allow Puma 6.
2022-10-16 15:43:37 -05:00
Jonathan Hefner 21f1199448 Always run `rails app:update` in app update tests
Prior to this commit, several tests in `AppGeneratorTest` were testing
app update behavior without actually running `rails app:update`.  This
meant the logic in `Rails::AppUpdater#generator_options` that detects
which frameworks and components are installed was not being tested.

Additionally, because `ENV["BUNDLE_GEMFILE"]` is set when tests are run
(by `require "bundler/setup"` in `tools/test.rb`), any tests which did
run `rails app:update` used the Rails repo Gemfile, instead of the
generated app Gemfile.  The difference becomes obvious when running
`rails app:update` after generating an app without Sprockets (as in
`test_app_update_does_not_generate_manifest_config_when_propshaft_is_used`),
because `rails app:update` will load the Sprockets railtie (due to
`Bundler.require` using the Rails repo Gemfile), and then exit with a
`Sprockets::Railtie::ManifestNeededError`.  However, if
`rails app:update` is run within a `quietly` block, such an error will
be swallowed.

This commit changes all such tests to run `rails app:update` via a
`run_app_update` helper that: (1) overrides the `BUNDLE_GEMFILE`
environment variable to point to the generated app Gemfile, (2) points
the `rails` gem in the generated app Gemfile to the Rails repo
(otherwise the `rails` gem version cannot be resolved), and (3) sets
`exception: true` so that the `system` call will raise an error if
`rails app:update` exits with an error code.

This commit also adds `jbuilder` and `web-console` to the Rails repo
Gemfile to ensure they are already installed when evaluating the
generated app Gemfile.

These changes do add a couple dozen seconds to the test suite run time,
but the thorough test coverage seems worth it.
2022-10-04 12:33:26 -05:00
Jonathan Hefner 6a0ec0e54e Fix tests for selenium-webdriver v4.5.0
`selenium-webdriver` v4.5.0 adds more entries ("acceptInsecureCerts" and
"moz:debuggerAddress") to the `as_json` output for
`Selenium::WebDriver::Firefox::Options`, causing an exact comparison of
the Hash to fail.

See SeleniumHQ/selenium@58f5833ba0.
2022-09-29 11:13:06 -05:00
MSP-Greg 6c674e4425
Updates for Puma 6 2022-09-22 12:40:54 -05:00
Yasuo Honda 349a66ebed Drop Rubinius code
Rubinius has not been maintained since May 2020 and based on the
discussion at https://github.com/rails/rails/pull/44984 ,
I think we can remove Rubinius specific code from Rails.
2022-09-15 23:43:51 +09:00
Rafael Mendonça França e6d4ac0e50
Merge pull request #46009 from johnnyshields/bundler-use-windows-platform
Bundler should use platform :windows instead of :mingw, etc.
2022-09-14 22:35:59 -04:00
johnnyshields b7e809a96e Bundler should use platform :windows instead of :mingw, :mswin, :x64_mingw, :mswin64. This is a recently added feature to bundler/rubygems in v3.3.22. 2022-09-13 16:45:59 +09:00
Yasuo Honda cb22eb2b36 Remove QueAdapter from Active Job
Que and Rails (Active Job QueAdapter) have applied changes each other
to support Ruby 3 keyword arguments and options provided as top level keywords, etc
via these commits:

https://github.com/rails/rails/pull/44734
https://github.com/rails/rails/pull/44248
d9244b9074 via https://github.com/que-rb/que/pull/319

Finally, we've found it is quite difficult to maintain them.
Going forward Active Job Que adapter can be included in the future version of que gem itself.
Refer to https://github.com/rails/rails/issues/45899 the background for this change.

Active Job Que adapter can be included in the future version of que gem itself.
2022-09-12 22:31:10 +09:00
Josef Šimánek b0fdca4fbc Rescue Rack::QueryParser::ParamsTooDeepError in HTTP request.
- render HTTP 400
- needs Rack 2.2.4+
2022-09-11 01:40:28 +02:00