Commit Graph

822 Commits

Author SHA1 Message Date
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
Rafael Mendonça França ff9739217d
Revert "Replace `method_source` gem with stdlib equivalent" 2022-09-08 16:58:52 -04:00
Koichi ITO eeeb0b1b7a Enable `Minitest/AssertRaisesWithRegexpArgument` cop
This PR enables `Minitest/AssertRaisesWithRegexpArgument` cop
and it suppresses the new warning below.

```console
% bundle exec rubocop
(snip)

Offenses:

activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb:111:9: C: Minitest/AssertRaisesWithRegexpArgument:
Do not pass regular expression literals to assert_raises. Test the resulting exception.
assert_raises(ActiveRecord::StatementInvalid, /TypeError/) do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb:628:9: C: Minitest/AssertRaisesWithRegexpArgument:
Do not pass regular expression literals to assert_raises. Test the resulting exception.
assert_raises(ActiveRecord::StatementInvalid, /SQLite3::ReadOnlyException/) do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
railties/test/application/rake/multi_dbs_test.rb:307:13: C: Minitest/AssertRaisesWithRegexpArgument:
Do not pass regular expression literals to assert_raises. Test the resulting exception.
assert_raises RuntimeError, /You're using a multiple database application/ do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
railties/test/application/rake/multi_dbs_test.rb:311:13: C: Minitest/AssertRaisesWithRegexpArgument:
Do not pass regular expression literals to assert_raises. Test the resulting exception.
assert_raises RuntimeError, /You're using a multiple database application/ do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
railties/test/application/rake/multi_dbs_test.rb:336:13: C: Minitest/AssertRaisesWithRegexpArgument:
Do not pass regular expression literals to assert_raises. Test the resulting exception.
assert_raises RuntimeError, /You're using a multiple database application/ do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
railties/test/application/rake/multi_dbs_test.rb:361:13: C: Minitest/AssertRaisesWithRegexpArgument:
Do not pass regular expression literals to assert_raises. Test the resulting exception.
assert_raises RuntimeError, /You're using a multiple database application/ do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

The last argument of `assert_raises` is a custom message string to help explain failures.
So, it's not the argument that `exception.message` is compared to.
`assert_raises` returns a raised exception and can be used to match against a regular expression.

And it updates the dependency version of rubocop-minitest in the Gemfile.
Because `Minitest/AssertRaisesWithRegexpArgument` cop was introduced in minitest 0.22.
https://github.com/rubocop/rubocop-minitest/releases/tag/v0.22.0
2022-09-08 17:44:40 +09:00
Jean Boussier 545482650b Update redis and resque
Fix: https://github.com/rails/rails/issues/45913
2022-09-07 15:10:43 +02:00
John Hawthorn 44dced857f Update stackprof 2022-09-01 11:43:55 -07:00
Yasuo Honda e29db960b2 Lock redis version to v4 until #45913 is resolved
Refer to https://github.com/rails/rails/issues/45913
https://github.com/redis/redis-rb/issues/1142
2022-08-31 15:42:21 +09:00
Carl Brasic 7690290068 Replace `method_source` gem with stdlib equivalent
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
repeated calls to `eval` to do it.

Drop `method_source` and replace it with a simple handler for Ripper's
`on_def` parser event.

I don't believe that there are any mainstream rubies at this point that
can run Rails and don't support Ripper but correct me if I'm wrong.
2022-08-30 08:52:11 -05:00
Yasuo Honda a4c4ee1b11 Lock que version to v1 until #45899 is resolved
Refer to https://github.com/rails/rails/issues/45899

https://github.com/rails/rails/issues/45899
2022-08-29 14:49:12 +09:00
Yusuke Endoh 3beb2aff3b Use error_highlight gem to locate the columns where an error was raised
This change incorporates to Rails a feature called error_highlight that
has been available since Ruby 3.1. This allow Rails' error report screen
to display the fine-grained location where an error occurred (not only a
line number but also beginning and end column numbers of the code
fragment).

For ErrorHighlight, see https://bugs.ruby-lang.org/issues/17930 in
detail.

To use error_highlight, ExceptionWrapper now prefers
`Exception#backtrace_locations` (since Ruby 2.1), which returns an array
of `Thread::Backtrace::Location`s, instead of `Exception#backtrace`.
This is because error_highlight requires `Thread::Backtrace::Location`
to locate the column where an error was raised.

Co-Authored-By: John Hawthorn <john@hawthorn.email>
Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
2022-08-24 00:28:50 +09:00
Jean Boussier f2ab66da73 Stop testing hiredis
The driver being used is an implementation detail of `redis-rb`.
If somehow something break on one driver but not the other, it should
be reported to redis-rb and fixed there.

Also `redis-rb` `5.0` has a totally new client and hiredis binding
so all this code no longer works with redis-rb 5.0.
2022-08-22 09:01:27 +02:00
John Hawthorn 85db5be358 Fix "unmarshalable" test for minitest 5.16.3 2022-08-18 09:47:50 -07:00
Eileen M. Uchitelle 914ac17156
Merge pull request #45539 from geongeorge/feature/updates-guide-generation-epub
Feature/updates guide generation - EPUB
2022-08-04 15:03:56 -04:00
Geon George 56e96d9344 Replaces mobi guide with epub for docs because of discontinued support
Removes kindlerb logic

Adds template for epub generator

Renames the kindle dir to /epub

Adds epub module to generator and replaces kindle

Fixes mimetype

Creates basic epub book

Deletes old kindle module

Adds zip package

Updates rubyzip gem name

Removes now unused gepub gem

Adds the required container file for epubs

Fixes media type

Adds new epub generation logic

Removes all buttons from output html

Refactors and generates valid epub files

Removes frontmatter logic used for kindlegen

Filters out epub files in zip

Updates link to kindle doc on sidebar

Fixes rubocop issues

Adds deprecation warning for the old kindle task

Refactors and cleans up epub module

Cleans up epub code

Cleans up private internal method code style

Removes unnecessary imagemagick check
2022-08-05 00:18:20 +05:30
Jean Boussier 476aeda794 Avoid explictly freezing literals strings when possible
Ref: https://github.com/jeremyevans/erubi/pull/33

If the template is compiled with `frozen_string_literals: true`,
then explicitly freezing string is slightly wasteful as it will be
compiled as `opt_str_freeze` instead of a simple `putobject`.

The former has to check wether `String#freeze` was redefined every
time, which while fast is useless extra work.
2022-08-03 11:15:36 +02:00
Yasuo Honda 2e8381c8b2 Bump strscan to 3.0.4
This commit addresses bug_report_templates/action_controller_gem.rb failures.

```
% ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin22]
% cd guides/bug_report_templates
% ruby action_controller_gem.rb
Fetching gem metadata from https://rubygems.org/...........
... snip ...
Using rails 7.0.3.1
/Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated strscan 3.0.2, but your Gemfile requires strscan 3.0.4. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/runtime.rb:25:in `block in setup'
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/spec_set.rb:138:in `each'
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/spec_set.rb:138:in `each'
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/runtime.rb:24:in `map'
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/runtime.rb:24:in `setup'
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/inline.rb:71:in `block in gemfile'
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/settings.rb:131:in `temporary'
	from /Users/yahonda/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.14/lib/bundler/inline.rb:55:in `gemfile'
	from action_controller_gem.rb:5:in `<main>'
%
```

strscan 3.0.4 has been released on July 23, 2022.
https://rubygems.org/gems/strscan/versions/3.0.4

Refer to https://github.com/rails/rails/pull/45052 for the similar change.
https://github.com/rubygems/rubygems/pull/5529
https://github.com/rubygems/rubygems/pull/5535
2022-07-25 17:41:00 +09:00
Étienne Barrié 889886d6ad Allow rack-test >= 2 2022-07-06 14:54:39 +02:00
Yasuo Honda 767c8391f7 Lock rack-test version to v1 until #45467 is resolved
Action Pack CI has been failing since rack-test v2.0.0.
Refer to https://github.com/rails/rails/pull/45177
2022-06-28 09:46:39 +09:00
Rafael Mendonça França fb9e9ef5d7
Upgrade sqlite3 to fix broken ext compilation
See https://github.com/sparklemotion/sqlite3-ruby/pull/324
2022-06-26 17:10:50 +00:00
eileencodes 9766eb4a83
Fix tests for minitest 5.16
In minitest/minitest@6e06ac9 minitest changed such that it now accepts
`kwargs` instead of requiring kwargs to be shoved into the args array.
This is a good change but required some updates to our test code to get
the new version of minitest passing.

Changes are as follows:

1) Lock minitest to 5.15 for Ruby 2.7. We don't love this change but
it's pretty difficult to get 2.7 and 3.0 to play nicely together with
the new kwargs changes. Dropping 2.7 support isn't an option right
now for Rails. This is safe because all of the code changes here are
internal methods to Rails like assert_called_with. Applications
shouldn't be consuming them as they are no-doc'd.
2) Update the `assert_called_with` method to take any kwargs but also
the returns kwarg.
3) Update callers of `assert_called_with` to move the kwargs outside the
args array.
4) Update the message from marshaled exceptions. In 5.16 the exception
message is "result not reported" instead of "Wrapped undumpable
exception".

Co-authored-by: Matthew Draper <matthew@trebex.net>
2022-06-23 08:32:11 -04:00
eileencodes 7f93661551
Lock minitest for now
CI runs bundle update so minitest got updated and my PR started failing
due to this change 6e06ac9d3e

I will relax the minitest requirement once the failing specs can be
fixed, but I don't want that to block this. It wasn't immediately
obvious to me what needs to change in our tests to get them passing.
There is also an open issue here
https://github.com/minitest/minitest/issues/912 regarding this change.
2022-06-15 12:24:41 -04:00
fatkodima 21a6dbd313 Enable strict strings mode for `SQLite3Adapter`
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2022-06-14 23:59:17 +03:00
Xavier Noria 3bcd48f6d8 Require Zeitwerk 2.6 2022-06-13 23:43:42 +02:00
fatkodima 799b5c1df4 Enable connection pooling by default for MemCacheStore and `RedisCacheStore` 2022-06-07 11:40:17 +03:00
Jonathan Hefner 48c9b48284 Bump `timeout` gem to 0.3.0
This fixes the build for `guides/bug_report_templates/*_gem.rb` files.

Example failure: https://buildkite.com/rails/rails/builds/86750#0180fae4-9e78-4f61-9d12-630c7e1519f9/1158-1267

This is similar to #45052.  Eventually, this should be fixed permanently
by either https://github.com/rubygems/rubygems/pull/5529 or
https://github.com/rubygems/rubygems/pull/5535.
2022-05-25 16:10:57 -05:00
Rafael Mendonça França 804a861162
Upgrade bundler version 2022-05-18 22:11:16 +00:00
Yasuo Honda 133fe10083 Use queue_classic 4.0.0
Refer to https://github.com/QueueClassic/queue_classic/pull/339
2022-05-18 14:04:43 +09:00
Ryuta Kamizono 3b4e476221
Merge pull request #45052 from yahonda/strscan_302
Bump strscan to 3.0.2 to address bug_report_templates/action_controller_gem.rb
2022-05-11 07:11:23 +09:00
Petrik 55073ac10f Use the CSS badge for the API docs as well
Sdoc 2.4.0 supports a CSS badge that can be set by passing the version
as the HORO_BADGE_VERSION env variable.

The old badge image can be removed, as it no longer needs to be copied
by the docs server: https://github.com/rails/rails-docs-server/pull/28
2022-05-10 21:05:59 +02:00
Yasuo Honda 76ac6e9a98 Bump strscan to 3.0.2 to address bug_report_templates/action_controller_gem.rb
This commit addresses the following error.

```
% ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin21]
% cd guides/bug_report_templates
% ruby action_controller_gem.rb
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
... snip ...
Fetching strscan 3.0.2
Installing strscan 3.0.2 with native extensions
Traceback (most recent call last):
	9: from action_controller_gem.rb:5:in `<main>'
	8: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/inline.rb:54:in `gemfile'
	7: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/settings.rb:124:in `temporary'
	6: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/inline.rb:70:in `block in gemfile'
	5: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/runtime.rb:26:in `setup'
	4: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/runtime.rb:26:in `map'
	3: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/spec_set.rb:147:in `each'
	2: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/spec_set.rb:147:in `each'
	1: from /Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/runtime.rb:31:in `block in setup'
/Users/yahonda/.rbenv/versions/2.7.6/lib/ruby/2.7.0/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated strscan 3.0.1, but your Gemfile requires strscan 3.0.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
%
```

Background:
- It has been failing since this build
https://buildkite.com/rails/rails/builds/86305#9be4d24a-2944-4660-b5f0-03aac7992131

- strscan  3.0.2 has been released on May 9, 2022
https://rubygems.org/gems/strscan/versions/3.0.2
2022-05-10 08:47:26 +09:00
Jean Boussier d7ac149f5f Use mysql2 0.5.4 2022-05-04 13:21:24 +02:00
Petrik dc9c7cf1fa Update sdoc to 2.3.2 to support latest rdoc 2022-04-22 10:04:34 +02:00
Yasuo Honda 75d104fbb0 Use blade 0.7.3 to support Ruby 3.2
blade 0.7.3 includes https://github.com/javan/blade/pull/12

Related to https://github.com/rails/rails/pull/44152
18e3226c9b
2022-04-13 08:31:38 +09:00
Yasuo Honda dae605c764 Address bug_report_templates/action_controller_gem.rb
This commit addresses the following error.

```ruby
$ ruby -v
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]
$ cd guides/bug_report_templates
$ ruby action_controller_gem.rb
Fetching gem metadata from https://rubygems.org/...........
... snip ...
Fetching net-protocol 0.1.3
... snip ...
/home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated net-protocol 0.1.2, but your Gemfile requires net-protocol 0.1.3. Since net-protocol is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports net-protocol as a default gem. (Gem::LoadError)
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/runtime.rb:25:in `block in setup'
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/spec_set.rb:136:in `each'
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/spec_set.rb:136:in `each'
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/runtime.rb:24:in `map'
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/runtime.rb:24:in `setup'
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/inline.rb:71:in `block in gemfile'
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/settings.rb:131:in `temporary'
	from /home/yahonda/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/inline.rb:55:in `gemfile'
	from action_controller_gem.rb:5:in `<main>'
$
```

Background:

- This test fails since net-protocol 0.1.3 has been released on Apr 1, 2022
https://rubygems.org/gems/net-protocol/versions/0.1.3

- Gemfile.lock specifies `net-protocol` 0.1.2, I assume it means "You
  have already activated net-protocol 0.1.2,".

  https://buildkite.com/rails/rails/builds/85716#dec4bf21-ae22-41db-8cf6-b91ab93b31b5/140-734
  ```ruby
    net-protocol (0.1.2)
  ```

- Actually, I do not know why this `action_controller_gem.rb` only fails with Ruby
  3.0 or higher, Ruby 2.7 works fine.
2022-04-02 00:27:45 +09:00
Damir Zekić 637616153c Upgrade que to 1.3.1
The point of this commit is to ensure no deprecation warnings related to
`job_options` show up when running ActiveJob integration tests.
2022-03-21 13:27:59 +01:00
Xavier Noria b7ae3cba6d Load with Zeitwerk 2022-03-05 08:19:49 +01:00
Yasuo Honda c689263e2b Bump jsbindling-rails and cssbundling-rails
When both jsbundling-rails v1.0.1 and cssbundling-rails v1.1.0
are used at the same time, thor shows the prompt to replace `bin/dev` or
not.

jsbundling-rails v1.0.2 addresses this issue.
https://github.com/rails/jsbundling-rails/releases/tag/v1.0.2
https://github.com/rails/jsbundling-rails/pull/95
2022-03-01 15:18:59 +09:00
Edouard CHIN 7253cac513 Bump Nokogiri to 1.13.3, previous version don't support Ruby 3.1:
- I was trying to work on Rails using Ruby 3.1 but the locked
  bundler dependencies didn't resolve. The previously locked
  version of Nokogiri (v1.12.5) has a constraint on Ruby
  `[">= 2.5".freeze, "< 3.1.dev".freeze]`.

  Things works correctly on CI now because the Gemfile.lock get
  deleted ed61405b4b/Dockerfile (L134)

  Bumping to 1.13.3 as that's what CI uses anyway
2022-02-28 20:00:22 +01:00
Matthew Draper e0edc1aa1d Switch from fork to queue_classic beta release 2022-02-27 22:55:41 +10:30
Ghouse Mohamed 715f117ac9 Bumps rubocop version to 1.25.1 2022-02-23 21:18:33 +05:30
Petrik 569d4ed196 Upgrade to sdoc 2.3.1
Fixes the following error in Firefox/Linux:

    Ctrl-C broken (Uncaught TypeError: $.browser is undefined)
2022-02-14 19:36:22 +01:00
Yasuo Honda 65f350e176 Released version of rbtree 0.4.5 supports Ruby 3.2.0dev
https://github.com/mame/rbtree is mirror of rbtree gem
and rbtree 0.4.5 has been released to support Ruby 3.2.0dev.
https://rubygems.org/gems/rbtree/versions/0.4.5

Related to https://github.com/rails/rails/pull/44152
2022-02-07 13:00:58 +09:00
Hartley McGuire f83f5c81af fix Que integration tests for Active Job
Replace Que.* settings that were removed in Que 1.0 with options passed
to Que::Locker. The Locker class creates its own thread for managing
work distribution, so the Thread created in the QueJobsManager was also
removed.
2022-01-27 16:24:16 -05:00
Yasuo Honda cc86e13fc9 Use released version of pg 1.3
pg 1.3.0 which supports Ruby 3.2.0dev has been released.
https://rubygems.org/gems/pg/versions/1.3.0

Follow up #44007
2022-01-25 21:15:48 +09:00
Azzen Abidi 3f13828392
[ci skip] Added a note about Github Codespaces' warning (#44148)
* Added a note about Github Codespaces warning

Related discussion: https://discuss.rubyonrails.org/t/issues-with-github-codespaces-setup-to-contribute-to-rails/79731

* updated docs to omit Codespace's warning 

[Original answer](https://github.com/rails/rails/pull/44148#issuecomment-1015022184)

* updated gems delayed_job to 4.1.10 && delayed_job_active record to 4.1.7

[Azzen Abidi + Rafael Mendonça França]
2022-01-21 09:08:50 -05:00
Jean Boussier 18e3226c9b Point blade to the official repository 2022-01-12 14:52:41 +01:00
Jean Boussier c2da0add54 Fork rbtree and blade to fix ruby-head CI
They both need very minor fixes.
2022-01-12 11:07:28 +01:00
Yasuo Honda f1f3ef5f90 Use `pg` gem 1.3.0.rc1 to support Ruby 3.2
Ruby 3.2.0dev removed `rb_cData`, `pg` gem cannot be installed with Ruby 3.2.0dev.

Refer Rails CI build failure at:
https://buildkite.com/rails/rails/builds/83631#fbe41b47-08d3-4b4a-8f17-692da1ab1ddf

This fix has been released as `1.3.0.rc1`

Refer:
https://github.com/ged/ruby-pg/issues/413
7c738ce5e6
2022-01-06 14:53:38 +09:00
Rafael Mendonça França b65a3054e6
Merge pull request #44083 from rails/rm-temporary-mail-fix
Temporarily add net-gems as dependencies of frameworks that use mail
2022-01-05 18:42:47 -05:00
Petrik 199b66027b Update sdoc to 2.3.0
With the migration of SDoc to a frameless layout, the URLs to assets
were made absolute instead of relative because of Turbolinks asset
tracking.  But absolute URLs fail when we have multiple versions of the
docs in subdirectories like: https://api.rubyonrails.org/v6.1/

This version of sdoc restores relative URLs by disabling the Turbolinks
asset tracking.

Fixes #44042
2022-01-05 22:55:21 +01:00
Rafael Mendonça França 5dd292f551
Temporarily add net-gems as dependencies of frameworks that use mail
In Ruby 3.1 those gems were dropped from the stdlib, so they need to be
explicitly installed. Mail should be doing this for us, but since it
cares about Ruby < 2.6, and those gems can't be installed there, they
can't add them to the gemspec without dropping support to old rubies.

Since we don't care about Ruby < 2.7, we can just require them in all
frameworks that use mail.
2022-01-05 17:42:40 +00:00
Rafael Mendonça França 55765121ad
Update development dependencies 2022-01-04 23:48:41 +00:00
Rafael Mendonça França 0afa65723a
Make sure test pass with minitest 5.15 2021-12-15 21:20:38 +00:00
Rafael Mendonça França 1d08b63e5b
Upgrade capybara to work with Ruby 3.1 and earlier 2021-12-08 21:44:11 +00:00
Rafael Mendonça França 83d85b2207
Start Rails 7.1 development 2021-12-07 15:52:30 +00:00
Rafael Mendonça França 5fa7049856
Use `ActiveRecord::FixtureSet.signed_global_id` defined by the globalid gem
Also make explicit that actiontext depends on the globalid gem.
2021-11-24 22:34:37 +00:00
Xavier Noria bcb2a112c7 Relax dependency on Zeitwerk 2.5 2021-10-21 20:30:36 +02:00
Ryuta Kamizono dd855fd0b4 Rails 7.0 requires selenium-webdriver >= 4.0.0
New Rails 7.0 generator produces a Gemfile with "selenium-webdriver",
">= 4.0.0" to support Ruby 3.0 (#43270), and latest webdrivers 5.0.0
requires selenium-webdriver ~ 4.0.

https://rubygems.org/gems/webdrivers/versions/5.0.0

It is time to drop selenium-webdriver 3.x support for Rails 7.0.
2021-10-20 22:48:05 +09:00
Xavier Noria 8f6f4407ea Depend on Zeitwerk 2.5 2021-10-20 14:21:24 +02:00
Yasuo Honda 6261c42a74 No need to specify webdrivers version to support selenium-webdriver 4.0.0
`webdrivers` 4.7.0 has been released including https://github.com/titusfortner/webdrivers/pull/218
which supports selenium-webdriver 4.0.0

Refer
https://github.com/titusfortner/webdrivers/blob/main/CHANGELOG.md#470-2021-10-14

Related to #43456
2021-10-15 08:45:31 +09:00
Rafael Mendonça França 0535f85aff
Require Dalli 3 in our test suite
The code itself still works with Dailli 2, but we are now only testing
against Dalli 3.
2021-10-14 17:49:49 +00:00
Yasuo Honda 4797c15665 Bump dalli from 2.7.11 to 3.0.1 in Gemfile.lock 2021-10-14 17:49:26 +00:00
Xavier Noria 6baa6d2ca9 Depend on Zeitwerk 2.5.0.beta6 2021-10-14 11:12:20 +02:00
Yasuo Honda d2033eb03a Use webdriver 4.6.1 or higher to support selenium-webdriver 4.0.0
This pull request forces bundler to use webdriver 4.6.1 or higher
to workaround #43455 until titusfortner/webdrivers#218 is merged and
released.

Fix #43455
https://github.com/titusfortner/webdrivers/pull/218
2021-10-14 13:59:00 +09:00
Rafael Mendonça França 0bba05100d
Fix the development container to set the right permissions to bundler 2021-10-12 22:16:38 +00:00
David Heinemeier Hansson fb1ab3460a
Make Sprockets more optional, offer Propshaft as alternative (#43261)
* Make Sprockets more optional, offer Propshaft as alternative

* Whups, local reference

* No longer used

* Spacing

* Need explicit sprockets-rails inclusion now

* Manually require the sprockets railtie

* Don't need these changes right now

* Kick off another build

* Fix tests

* DRY up test

* Require railtie when using sprockets

* Introduce option to skip asset pipeline

* No longer relevant

* Always have to return

* Gone

* Add helper for skip_sprockets?

* Fix guard statement

* Use latest gems

* Include propshaft

* fix tests for #43261 (#43277)

* help fix tests for #43261

skip_sprockets? should not be called on options

:skip_sprockets is no longer a value in the option hash, so
skip_sprockets? should not be called on it

move --asset-pipeline to shared generator

skip_sprockets? is defined on app_base, and used in the plugin
generator to determine whether to add the engine's assets to the dummy
sprockets manifest, so I believe it makes sense to include in both
generators

Because of this change, I also changed the shared test back to testing
against non-sprockets

add skip_sprockets to Gemfile template vars

Mocking skip_sprockets? in app_base generator

fix more generator tests

* use skip_sprockets? everywhere

* Use latest propshaft

* Update `AssetUrlHelper` docs to list both asset pipeline gems (#43328)

* Update to latest Propshaft

* Bump Propshaft again

* Ask for latest

* Use latest propshaft

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
Co-authored-by: Richard Macklin <1863540+rmacklin@users.noreply.github.com>
2021-10-09 17:03:05 +02:00
John Hawthorn e47a49ffdf Use queue_classic branch which works on psql 14
This fixes the failing CI for ActiveJob.

This uses my fork, we can switch back when the following PR is merged:

    https://github.com/QueueClassic/queue_classic/pull/334
2021-10-04 14:38:56 -07:00
Xavier Noria d59e729fbf Depend on Zeitwerk 2.5.0.beta5 2021-09-29 09:25:40 +02:00
Xavier Noria e44ce53f78 Depend on Zeitwerk 2.5.0.beta4 2021-09-22 08:47:21 +02:00
Rafael Mendonça França 50d60e4f7c
Allow Marcel to be released following semver 2021-09-20 17:19:57 -04:00
David Heinemeier Hansson 780753f571 Use debug 1.1+ for the debugger + log quieting 2021-09-20 15:18:30 +02:00
Rafael Mendonça França d177551c30
Preparing for 7.0.0.alpha2 release 2021-09-15 18:22:51 -04:00
Rafael Mendonça França 9b7be48212
Preparing for 7.0.0.alpha1 release 2021-09-15 17:55:08 -04:00
Xavier Noria 7ffe204a08 Upgrade debug to 1.0.0 2021-09-08 20:33:22 +02:00
Xavier Noria 89801b2a43 Depend on ruby/debug, replacing Byebug
ruby/debug is a new debugger that is going to ship with CRuby.

It makes sense for Rails to switch to this one because that is
where the language is heading, and because Byebug is not fully
compatible with Zeitwerk. See

    https://github.com/deivid-rodriguez/byebug/issues/564

While ruby/debug has not been heavily tested with Zeitwerk,
casual usage seems to suggest it works without issues, including
explicit namespaces, which is where Byebug and Zeitwerk conflict.

Byebug is terrific, thanks a lot for all these years. ❤️
2021-09-08 17:35:41 +02:00
David Heinemeier Hansson 83808166e6
Add --css app generator option (#43177)
* Add --css to preconfigure a CSS bundler/processor

* Simpler conditional

* Add CSS gems

* Test CSS options
2021-09-07 17:48:13 +02:00
David Heinemeier Hansson 7595c922a6
Use the combined jsbundling-rails gem instead of individual js bundler gems (#43172)
* Use the combined jsbundling-rails gem instead of individual js bundler gems

* Remove Webpacker remnants

* Replace webpacker with jsbundling-rails
2021-09-06 16:44:44 +02:00
David Heinemeier Hansson 82e4432058
Javascript generator option with choices (#43160)
* Switch to a single controller option for choosing JavaScript approach

* Remove remnants of webpacker specific work within Rails

* No longer used

* Missing space

* Raise if unknown option is passed

* Style

* Use latest versions

* Make channels setup generic to all node setups

* Make Action Text installer work with any node package manager

* Explaining variables are not useless

* Rubocop pleasing

* Don't rely on Rails.root

Tests don't like it!

* Rubocopping

* Assume importmap

* No longer relevant

* Another cop

* Style

* Correct installation notice

* Add dependencies for action cable when adding a channel

* Fix paths to be relative to generator

* Just go straight to yarn, forget about binstub

* Fix tests

* Fixup installer, only yarn once

* Test generically with run

* Style

* Fix reference and reversibility

* Style

* Fix test

* Test pinning dependencies

* Remove extra space

* Add more tests

* Use latest dependencies

* Relegated this to controllers

* Refactor ChannelGenerator + more tests

Use a uniform level of abstraction
2021-09-04 11:53:57 +02:00
Xavier Noria 174ee7bb60 Depends on Zeitwerk 2.5.0.beta3 2021-09-01 15:31:04 +02:00
David Heinemeier Hansson d5b9618da1
Remove default reliance on Sass and CSS generators (#43110)
* No benefit to having actiontext css as scss

* Update test

* Update docs

* No more css assets to be generated

New world, new CSS frameworks, new needs.

* SCSS is becoming optional

* Remove Sass as a default-on setting

But continue to make it easy to add.

* Update docs

* No longer used

* Update tests

* Update docs

* Update docs

* No longer used

* No longer by default

* Fix tests

* Promote Tailwind CSS as an alternative to Sass

* Fix test and copy task

* Update railties/lib/rails/generators/rails/app/templates/Gemfile.tt

Co-authored-by: Kevin Newton <kddnewton@gmail.com>

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2021-08-26 13:40:25 +02:00
David Heinemeier Hansson af7428c4ac
Replace webpack with importmapped Hotwire as default js (#42999)
* Turbolinks is being replaced with Hotwire

* Make --webpack opt-in

* Don't use specific webpacker installers any more in preparation for next Webpacker

* Update railties/lib/rails/app_updater.rb

Co-authored-by: Alex Ghiculescu <alex@tanda.co>

* Trailing whitespace

* Convert to Turbo data attribute for tracking

* Default is no webpack, no hotwire

* Swap out turbolinks references for hotwire

* Drop explicit return

* Only generate package.json if using webpack

* Only create package.json in webpack mode

* Only create app/javascript in webpack mode

* Generate correct style/js links based on js mode

* Fix tests from changed output format

Not sure why these are showing up in this PR, though.

* Rubocopping

* Stick with webpack for the test app for now

* Adjust tests

* Replace minitest-reporters with minitest-ci (#43016)

minitest-reporters is used to create junit xml reports on CI.

But when it loads before rails minitest plugin makes
`Rails::TestUnitReporter` not being added as a reporter.

minitest-ci is now only loaded at ci and does not interferes with
rails minitest plugins. And keeps junit reports workings

* Too heavy handed to actually run bundle

Just like we don't auto-migrate

* Pin js frameworks in importmap

Instead of having importmap preconfigure it.

* Match updated app/javascript path

* No need for the explaining comment

* Fixes test cases for replace webpack with importmapped Hotwire as default js (#42999)

* Fix rubocop issues

* Fix more railities test cases

* Fix plugin generator railties shared test cases

* Fix Action Text install generator asset pipeline spec

* They're modules, not files

* Let dev use the latest release as well

So we don't have to replace unexisting dev releases with latest release

* Make Webpack responsible for generating all the JS files it needs

Webpacker 6 has already moved from app/javascript to app/packs.

* Don't add rails/ujs by default any longer

All the ajax/form functionality has been superseded by Turbo. The rest lives in a weird inbetween land we need to address through other means.

* Use new importmap location

* Switch to using turbo-rails and stimulus-rails directly

The hotwire-rails gem does not offer enough value for its indirection

* Use latest Webpacker

* Prevent version resolution requests from getting swallowed

* Use ESM syntax for imports

* Move management of yarn, package.json, etc to Webpacker 6

* Update for Webpacker 6

* Move bin/setup addition to Webpacker as well

* Remove dead tests

* Bump to Webpacker 6.0.0.rc.2

* No longer relevant given the new default is no webpacker

* Rely on Webpacker 6

* No longer relevant

* No longer relevant

* Make cable channel generator work for both webpacker and importmap setups

* Fix tests

* For tests testing importmap way

* Use Webpacker 6 dummy

* RuboCopping

* One more bump to fix webpack-dev-server

* Another bump. Hopefully the last one!

* Also enough to not want turbo tracking on

* Fix tests

* Latest

* Fix tests

* Fix more tests

* Fix tests

Co-authored-by: Alex Ghiculescu <alex@tanda.co>
Co-authored-by: André Luis Leal Cardoso Junior <andrehjr@gmail.com>
Co-authored-by: Abhay Nikam <nikam.abhay1@gmail.com>
Co-authored-by: Guillermo Iguaran <guilleiguaran@gmail.com>
2021-08-26 10:39:36 +02:00
Petrik 0920b02c1d Upgrade azure-storage-blob to use at least 2.0.0
azure-storage-blob 1.1.0 supports ruby 1.9.3 to 2.5:
https://github.com/Azure/azure-storage-ruby/blob/v1.1.0-common/common/README.md

azure-storage-blob 2.0.0 supports ruby 2.3 to 2.7:
https://github.com/Azure/azure-storage-ruby/blob/v2.0.0-blob/common/README.md
2021-08-23 22:03:15 +02:00
Xavier Noria c192feb3eb Update Gemfile.lock 2021-08-21 10:35:03 +02:00
Koichi ITO 65af100ddd Tweak unreachable assertion tests in the block of `assert_raises`
I found an unexpected use of assertion in the block of `assert_raise`
when I implemented https://github.com/rubocop/rubocop-minitest/pull/137.
It is expected to be asserted after an exception is raised in
`assert_raise` block, but in actually it is not asserted after an
exception is raised. Therefore, this PR removes or updates assertions
that have not been asserted after an exception has raised.

This PR will add `rubocop-minitest` and enable
`Minitest/UnreachableAssertion` cop to able similar auto-detection,
but will remove `rubocop-minitest` from this PR if you don't like it.
2021-08-17 20:33:08 +09:00
Ryuta Kamizono b669e87071 Enforce standardizing nodoc comments by rubocop
Follow up to 18707ab1, b87d8e51.

rubocop 1.19.0 includes https://github.com/rubocop/rubocop/pull/9964.
2021-08-12 20:01:37 +09:00
David Heinemeier Hansson e34300a921
Stop trying to configure listen by default on compatible platforms (#42985)
* Stop trying to configure listen by default on compatible platforms

Modern computers with SSDs don't see much/any benefit from having an evented file update watcher. Remove complexity by taking this spinning-drive concession out.

* Actually need listen for testing the opt-in

* Test no longer relevant
2021-08-11 15:18:43 +02:00
Xavier Noria 6068639775 Upgrades Zeitwerk to 2.5.0.beta 2021-08-04 09:43:06 +02:00
Jean Boussier bbaf40bd7f Update globalid to 0.5.1 for ruby-head compatibility
https://github.com/ruby/uri/pull/26 was recently pulled
in ruby-head, and it breaks globalid < 0.5.
2021-07-27 23:23:13 +02:00
Ryuta Kamizono d7fce6c996 Fix odd closing parenthesis by enabling the `Layout/ClosingParenthesisIndentation` cop 2021-07-02 18:01:50 +09:00
Hartley McGuire bcb300dccb Replace uglifier with terser in dummy applications
Terser is more up to date with modern javascript features, and the
uglifier gem repository recommends using it for minifying ES6+.

Followup for 955041b
2021-06-28 00:48:56 -04:00
Rafael França ee99c89f90
Merge pull request #42513 from ghiculescu/ci-ujs-tests
Output UJs test failures in CI
2021-06-23 14:56:45 -04:00
Alex Ghiculescu 2934c54dfd Output UJs test failures in CI 2021-06-17 16:51:37 -05:00
Rafael Mendonça França 882750b0be
Upgrade development gems 2021-06-17 20:27:14 +00:00
Rafael Mendonça França 115d4a3994
Simplify the implementation by only calling the checks in the right places 2021-06-17 15:09:54 +00:00
Jean Boussier 48141031a6 Add x86_64-darwin-20 platform to the Gemfile
Otherwise people developping on Big Sur will have to rebundle
2021-06-10 15:33:12 +02:00
Rafael Mendonça França c13b28072f
Update development gems 2021-06-08 23:27:47 +00:00
John Hawthorn 14688b5578 Bump rack to remove ssl? override
Rack 2.2+ already understands "wss" as being "ssl", so bumping the
requirement lets us remove this override and call to super.
2021-06-01 11:15:14 -07:00
Ryuta Kamizono 153a78dee0 Revert "Lock benchmark-ips version "< 2.9.0""
This reverts commit b63e1477ea.
2021-05-25 06:13:09 +09:00
Ryuta Kamizono b63e1477ea Lock benchmark-ips version "< 2.9.0"
Accidentally benchmark-ips 2.9.0 doesn't contain
"lib/benchmark/ips/noop_suite.rb".

https://buildkite.com/rails/rails/builds/77608#ba2b5c32-d02c-4dc4-9c48-f731b513f883/2031-2080
2021-05-23 06:03:04 +09:00
Petrik b00c38cc41 Upgrade sdoc to 2.2.0
Sdoc 2.2.0 has improved accessibility and bug fixes.

Changelog:

* #161 Add 'skip to content' link and improve shortcut keys
* #170 Fix link hovers in headings
* #169 Fix clearing search results
* #167 Update Merge script to work with sdoc v2
* #160 Remove outline from reset stylesheet
* #159 Remove TAB override in panel
* #157 Move to GitHub action for tests
* #155 Fix Ctrl+C copying Jan Schär
2021-05-21 10:06:22 +02:00
bogdanvlviv 34c53bab6c
Update Gemfile.lock
Executing `bundle install` makes git-diff in the file on my VM.
It reverts changes that were made in bbbc861f71
to the file.

Sorry for this noise. I just want to figure out whether it is something unique
with my VM's environment or those changes were made accidentally?
/cc @kamipo
2021-05-04 15:14:26 +00:00
Yasuo Honda 06d5997b78 Revert "Merge pull request #42088 from yahonda/use_beaneater10"
This reverts commit 0184a01935, reversing
changes made to ed8667df5c.
2021-04-28 11:47:51 +09:00