Commit Graph

42 Commits

Author SHA1 Message Date
Akhil G Krishnan
61090b1f3f Add rake guides:lint task to raise error on broken anchor links
Co-authored-by: zzak <zzakscott@gmail.com>
2024-05-01 17:29:35 +05:30
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
Rafael Mendonça França
2f08f9ac2c
Merge pull request #47354 from etiennebarrie/deprecate-ActiveSupport-Deprecation-usage
Deprecate ActiveSupport::Deprecation singleton usage
2023-04-06 10:20:38 -04:00
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
Étienne Barrié
e5af9c298a Deprecate ActiveSupport::Deprecation instance delegation
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.
2023-03-14 17:32:52 +01:00
Hartley McGuire
a42863f514
Add rake task to vendor guide javascript
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.
2023-02-13 00:58:58 -05: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
Rafael Mendonça França
16844af48d
Run the gem template guides for 3.1 now that 7.0.1 is out 2022-01-06 21:56:06 +00:00
Rafael Mendonça França
110eeabf5c
Only run test for gem templates in Ruby < 3.1 2022-01-06 00:48:36 +00:00
st0012
01ee369636 Remove non-existing encoding task dependency
The `encoding` task has been removed a few years ago in
510db97991
2021-11-12 17:00:33 +00:00
Yasuo Honda
f936678b99 Use Bundler.unbundled_system for bug_report_templates tests
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
2021-06-02 23:27:17 +09:00
Eugene Kenny
2f87589630 Remove references to WARNINGS environment variable [ci skip]
This has had no effect since 771a802c374ebe7b2931ba6cf8ffa3b7bf0e92e0.
2020-07-05 16:40:52 +01:00
Rafael França
ba20b7a4fd
Merge pull request #31882 from okkez/fix-encoding-error-generating-html
Fix invalid byte sequence error without `en_US.UTF-8` environment while rake guides:generate:html
2020-03-30 15:31:20 -04:00
Matthew Draper
287920ca7d Respect ENV variables when finding DBs etc for the test suite
If they're not set we'll still fall back to localhost, but this makes it
possible to run the tests against a remote Postgres / Redis / whatever.
2019-02-06 01:20:06 +10:30
Bart de Water
eb5fea40a4 Enable Start/EndWith and RegexpMatch cops
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
2018-07-28 17:37:17 -04:00
Kenji Okimoto
510db97991 Remove code that is no longer effective
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`.
2018-02-04 22:49:22 +09:00
Kenji Okimoto
efc82d6fbf Fix error invalid byte sequence without en_US.UTF-8 locale
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.
2018-02-04 22:37:17 +09:00
Koichi ITO
1f37d846a9 Use frozen string literal in guides/ 2017-08-13 22:04:09 +09:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Rafael Mendonça França
0871e5e5c1
Fix all style guides violations
Closes #28382
Closes #28651
2017-04-19 20:13:42 -04:00
Xavier Noria
37770bc8d1 force UTF-8 as external encoding in guides generation [ci skip]
See the rationale in the comment found in the patch.
2017-03-09 09:43:38 +01:00
Xavier Noria
771a802c37 refactors and fixes in guides generation [ci skip]
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.
2017-02-12 10:33:50 +01:00
Rafael Mendonça França
010e246756
Fix Rubocop violations and fix documentation visibility
Some methods were added to public API in
5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of
the public API.
2016-12-28 21:53:51 -05:00
Bian Jiaping
88792b1b2e Fix rake guides:generate:kindle error 2016-12-18 23:13:50 +08:00
Gaurav Sharma
f0bacbc2c4 update kindlerb gem
Ruby Kindle periodical-format ebook generator
2016-10-21 09:37:24 +05:30
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
1607ee299d modernizes hash syntax in guides 2016-08-06 19:39:28 +02:00
Xavier Noria
6b3719b757 applies new string literal convention in guides
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:21:59 +02:00
Jade Misenas
7fb8a7e57c Fix WARNINGS flag inside guides/Rakefile 2015-07-29 20:00:58 -04:00
Darío Hereñú
f8dabedf13 Update link (minor fix) 2015-02-28 22:39:52 -03:00
Brooks Reese
3e9c16aadb Fix grammar in Rakefile markup [ci skip] 2014-12-05 09:32:50 -06:00
Zachary Scott
fc20bfd4f1 Clarify where result goes, and supported formats of generate task.
[ci skip]
2014-11-25 16:54:30 -08:00
Łukasz Adamczak
251840f20a Improve error message for guides:generate:kindle
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.
2014-04-03 21:31:27 +02:00
Daniel Choi
e8fe1d1a20 Add periodical-style TOC and navigation to Kindle version of guides 2012-12-01 18:08:10 -05:00
Prem Sichanugrist
5e2866cc34 No more Textile guide generation support 2012-09-17 15:55:17 -04:00
Prem Sichanugrist
544f6bcb90 Start rewriting 4.0 release note into Markdown 2012-09-17 15:54:21 -04:00
Rafael Magana
15b229e8aa [guides] guides:generate:kindle is the new interface to generate .mobi file instead of using KINDLE=1 2012-05-28 16:20:10 -05:00
Rafael Magana
1b5e1c1972 [guides] get rid of any reference to the generator script since rake tasks are now the new interface 2012-05-28 16:17:00 -05:00
Rafael Magana
db57e6d123 [guides] Add rake task to show help and make it the default one 2012-05-26 15:05:52 -05:00
Rafael Magana
e6d7eeaab0 [guides] Add :guides namespace and :html and :kindle tasks to Rakefile 2012-05-26 14:29:47 -05:00
Xavier Noria
6d87cd028b moves the guides up to the root directory 2012-03-17 08:32:49 -07:00