This script generates the guides. It can be invoked via the guides:generate rake task within the guides directory.
Guides are taken from the source directory, and the resulting HTML goes into the output directory. Assets are stored under files, and copied to output/files as part of the generation process.
Some arguments may be passed via environment variables:
WARNINGS
If you are writing a guide, please work always with WARNINGS=1. Users can
generate the guides, and thus this flag is off by default.
Internal links (anchors) are checked. If a reference is broken levenshtein
distance is used to suggest an existing one. This is useful since IDs are
generated by Markdown from headers and thus edits alter them.
Also detects duplicated IDs. They happen if there are headers with the same
text. Please do resolve them, if any, so guides are valid XHTML.
ALL
Set to "1" to force the generation of all guides.
ONLY
Use ONLY if you want to generate only one or a set of guides. Prefixes are
enough:
# generates only association_basics.html
ONLY=assoc ruby rails_guides.rb
Separate many using commas:
# generates only association_basics.html and migrations.html
ONLY=assoc,migrations ruby rails_guides.rb
Note that if you are working on a guide generation will by default process
only that one, so ONLY is rarely used nowadays.
GUIDES_LANGUAGE
Use GUIDES_LANGUAGE when you want to generate translated guides in
<tt>source/<GUIDES_LANGUAGE></tt> folder (such as <tt>source/es</tt>).
Ignore it when generating English guides.
EDGE
Set to "1" to indicate generated guides should be marked as edge. This
inserts a badge and changes the preamble of the home page.
Required Files
- set
- fileutils
- active_support/core_ext/string/output_safety
- active_support/core_ext/object/blank
- action_controller
- action_view
- rails_guides/indexer
- rails_guides/helpers
- rails_guides/levenshtein
- rails_guides/kindle
Namespace
- MODULE ActionView
- MODULE Mime
- MODULE RailsGuides
- CLASS RailsGuides::Generator