All other command usage uses two lines for "Usage: rails command".
This updates the usage of generators to do the same.
It also changes the command to `bin/rails`.
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.
[This blog post](https://dev.to/youngbloodcyb/rake-junior-rails-review-13cc) is about the confusion between `bin/rake` and `bin/rails` commands. The two have mostly [been aliases since Rails 5](3d252a02ae (diff-f5ff9aa07f44111a79d56c09ec37d774b462d97aff68f32490c2e56e74c95783R162)), but this means there's all sorts of advice floating around the internet about which command to use. Is `rake db:migrate` the same as `bin/rails db:migrate`? I know that it is, but I can see why it's confusing for a first timer.
The blog post's suggestion was to have a section in the guides that introduces rake and talks about this distinction. I'm not sure about this. I think if we take up too much space too early in the guide discussing this, it risks confusing people even earlier. But if the advice is hidden away too much, nobody will find it.
Something I think we should do, though, is mention `rake` as little as possible in the guides. Mentions in upgrade guides and release notes are fine, but elsewhere we should avoid using it in places where `bin/rails` does an equivalent job. This PR removes a few `rake` mentions from the guides. Before doing this, I was expecting there to be a lot more, so this PR turned out to be a bit smaller than expected. Still, every little bit helps I think.
All the common rails commands and some extended commands use the
infinitive form for the verb in the description. This changes the
remaining tasks to use the infinitive form verb as well, for
consistency.
__Before__
```console
$ bin/rails --help
...
action_mailbox:install Installs Action Mailbox and its dependencies
...
app:template Applies the template supplied by LOCATION=(/path/to/template) or URL
...
credentials:diff Enrolls/disenrolls in decrypted diffs of credentials using git
credentials:edit Opens the decrypted credentials in `$EDITOR` for editing
credentials:show Shows the decrypted credentials
db:create Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use...
db:drop Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use d...
...
db:fixtures:load Loads fixtures into the current environment's database
db:migrate Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
db:migrate:down Runs the "down" for a given migration VERSION
db:migrate:redo Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)
db:migrate:up Runs the "up" for a given migration VERSION
db:prepare Runs setup if database does not exist, or runs migrations if it does
db:reset Drops and recreates all databases from their schema for the current environment and loads th...
db:rollback Rolls the schema back to the previous version (specify steps w/ STEP=n)
db:schema:cache:clear Clears a db/schema_cache.yml file
db:schema:cache:dump Creates a db/schema_cache.yml file
db:schema:dump Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['...
db:schema:load Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SC...
db:seed Loads the seed data from db/seeds.rb
db:seed:replant Truncates tables of each database for current environment and loads the seeds
db:setup Creates all databases, loads all schemas, and initializes with the seed data (use db:reset t...
db:system:change Changes `config/database.yml` and your database gem to the target database
db:version Retrieves the current schema version number
destroy Removes code generated by `bin/rails generate`
dev:cache Toggles development mode caching on/off
encrypted:edit Opens the decrypted file in `$EDITOR` for editing
encrypted:show Shows the decrypted contents of the file
...
log:clear Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test...
middleware Prints out your Rack middleware stack
notes Shows comments in your code annotated with FIXME, OPTIMIZE, and TODO
...
routes Lists all the defined routes
runner Runs Ruby code in the context of your application
...
secrets:edit Opens the secrets in `$EDITOR` for editing
secrets:show Shows the decrypted secrets
...
tmp:create Creates tmp directories for cache, sockets, and pids
version Shows the Rails version
...
zeitwerk:check Checks project structure for Zeitwerk compatibility
```
__After__
```console
$ bin/rails --help
...
action_mailbox:install Install Action Mailbox and its dependencies
...
app:template Apply the template supplied by LOCATION=(/path/to/template) or URL
...
credentials:diff Enrolls/disenrolls in decrypted diffs of credentials using git
credentials:edit Opens the decrypted credentials in `$EDITOR` for editing
credentials:show Shows the decrypted credentials
db:create Create the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use ...
db:drop Drop the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db...
...
db:fixtures:load Load fixtures into the current environment's database
db:migrate Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
db:migrate:down Run the "down" for a given migration VERSION
db:migrate:redo Roll back the database one migration and re-migrate up (options: STEP=x, VERSION=x)
db:migrate:status Display status of migrations
db:migrate:up Run the "up" for a given migration VERSION
db:prepare Run setup if database does not exist, or run migrations if it does
db:reset Drop and recreate all databases from their schema for the current environment and load the s...
db:rollback Roll the schema back to the previous version (specify steps w/ STEP=n)
db:schema:cache:clear Clear a db/schema_cache.yml file
db:schema:cache:dump Create a db/schema_cache.yml file
db:schema:dump Create a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['S...
db:schema:load Load a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCH...
db:seed Load the seed data from db/seeds.rb
db:seed:replant Truncate tables of each database for current environment and load the seeds
db:setup Create all databases, load all schemas, and initialize with the seed data (use db:reset to a...
db:system:change Change `config/database.yml` and your database gem to the target database
db:version Retrieve the current schema version number
destroy Remove code generated by `bin/rails generate`
dev:cache Toggle development mode caching on/off
encrypted:edit Open the decrypted file in `$EDITOR` for editing
encrypted:show Show the decrypted contents of the file
...
log:clear Truncate all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test...
middleware Print out your Rack middleware stack
notes Show comments in your code annotated with FIXME, OPTIMIZE, and TODO
...
routes List all the defined routes
runner Run Ruby code in the context of your application
...
secrets:edit Open the secrets in `$EDITOR` for editing
secrets:show Show the decrypted secrets
...
tmp:create Create tmp directories for cache, sockets, and pids
version Show the Rails version
...
zeitwerk:check Check project structure for Zeitwerk compatibility
```
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
In 2a5c116f12c7716399f5da3fe788f7e23ae67c4c the `Usage:\n rails COMMAND`
was removed from the help USAGE file. The original PR
https://github.com/rails/rails/pull/27601 doesn't mention why this was
done, so I'm not sure if this was done by accident.
Most commands have help usages of the form:
```console
Usage:
bin/rails notes [options]
....
```
...so it is more consistent to use this for help as well.
This also allows differentiating between `rails` outside application
directories and `bin/rails` inside application directories.
This changes a `bash` code fence with `cat` output to a `yaml` code
fence for proper YAML syntax highlighting. This also fixes a typo in
the YAML content.
The current Command Line guide has an advanced section describing
specifying git as SCM and PostgreSQL as the database. This section is
easily overlooked: https://github.com/rails/rails/issues/44325
By moving whole "advanced" section under the `rails new` section, it's
easier to find. Also specifying the database is pretty common I guess
and not an "advanced" topic.
All mentions of the SCM option have been removed, as it seems to no
longer be an option and we always initialize with Git only.
We were planning to remove this middleware because we thought it could
make easier to attacker to do a Time Attack. However, while
Rack::Runtime can indeed be used to know how long a request took, and
compare with other requests, it doesn't provide any information that
can't be found in the total time of the request as well.
Instead of removing the middleware, we decided to keep it, and direct
users to instead of removing it, use its information to uncover actions
that are vulnerable to Time Attack.
This reverts commit 127dd06df66552dd272eea7832f8bb205cf6fd01, reversing
changes made to 4354e3ae492e95934a6da4101556a05d20b9f897.
* 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>
* Remove spring as a default installation option
Faster computers have meant that most apps won't see a big benefit from Spring on small to moderate size apps. Thus the pain of dealing with the occasional spring issue is no longer warranted by default.
* Errant end
* No longer an option
* Additional spring removals
* Pointer to docs is enough
* 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
Previous discussion: #38412, #38325, 37423e4, 24f9c03
- Rack::Runtime is replaced by FakeRuntime, which is a dummy middleware
that just passes requests on and cannot be used in middleware operations
- Using Rack::Runtime in middleware operations (relative inserts, moves,
etc.) throws a deprecation warning and uses FakeRuntime instead
- if an application adds Rack::Runtime explicitly (use, unshift, etc.),
then the deprecation warning does not happen and FakeRuntime is
ignored
- docs are updated to no longer reference Rack::Runtime
Follow-up to #39594, which added CSS in order to select shell commands
sans prompts on triple-click.
This commit adds several bash code fences and prompts where they were
missing, and removes a few where they were inappropriate.
Generators generate things, but what is meant by 'Stubbing out' might
confuse beginners and non-native English speakers.
While generated tests are stubs that should have an implementation, a
generated model is a valid model that doesn't require any changes.