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.
All methods called on ActiveSupport::Deprecation are delegated to the
singleton instance, but now that each framework has its own Deprecation
instance, it's no longer necessary for internal deprecations.
For external code, instead of using ActiveSupport::Deprecation.warn,
they should create their own instance of the class and call warn on it.
The Rails guides were migrated from Turbolinks to Turbo in
0f6575a5344246d385d1a724e8b0bb3544ab6478
The PR discussion explains that the file was grabbed from unpkg, and a
decision was made to not run it through a minifier.
This commit adds a rake task to automate the process of grabbing the
turbo js file using Importmap::Packager, which is what importmap-rails
uses for `bin/importmap pin --download`.
The extra Importmap module definition is necessary because the
Importmap::Packager file uses the shorthand module syntax, meaning that
an error is thrown if the Importmap module is not previously defined.
`require "importmap-rails"` would normally define this module, but one
of its dependent requires will not load outside of a Rails application.
The turbo.css file was removed as it appears to be leftover from
Turbolinks and Turbo does not provide any css files in its dist.
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
This commit removes the bundler deprecation warning below.
Since bug_report_templates test expect to use thier own gems inside of each file, not Rails's repository `Gemfile`.
Then using `Bundler.unbundled_system` should be right way.
* Deprecation warning without this commit
```
$ bundle exec rake test
--- Running bug_report_templates/generic_gem.rb
[DEPRECATED] `Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` (called at /home/yahonda/src/github.com/rails/rails/guides/Rakefile:81)
```
* Steps to reproduce
```
git clone https://github.com/rails/rails
cd rails/guides
bundle install
bundle exec rake test
```
* Environment
```
$ ruby -v
ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux]
$ bundler -v
Bundler version 2.1.4
```
* Note
This bundler deprecation warning has been introduced since 2.2.0.rc.1 by this commit below.
https://github.com/rubygems/rubygems/commit/90741bef9e7
In previous change, we set external encoding and internal encoding
explicitly. So we can remove the code that set environment variables
`LANG, LANGUAGE, LC_ALL`.
Because Ruby does not set `Encoding.default_external` with
non-existent locale such as `en_US.UTF-8`. Original code expects that
`en_US.UTF-8` is available locale implicitly. However, it shouldn't be
assumed.
In this case, we can use `-Eutf-8:utf-8` to specify external encoding
and internal encoding.
This commit is not precisely atomic, but the changes have evolved, summary:
* The ENV-based interface has been moved upwards, the generator has now a conventional
initializer.
* RAILS_VERSION is now assumed to be a Git tag. A blank RAILS_VERSION means edge guides.
* In consequence, the EDGE env variable is gone.
* The "local" version is also gone, the current SHA1 is computed for edge guides.
* Assumes guides are generated from a repo checkout (time ago users could
generate them from gems.)
* The WARNINGS flag is gone in consequence, you cannot disable warnings.
* The `api_link` Markdown helper is fixed.
* Docs about usage have one single place: rake guides:help.
* Links in guides have been revised.
With `kindlegen` missing from the PATH, the task
keeps suggesting to `gem install kindlerb`.
This change provides a more meaningful error
message for guides:generate:kindle.