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.
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>
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.
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
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.
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/5529https://github.com/rubygems/rubygems/pull/5535
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>
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.
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
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
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.
- 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
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.
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
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.