Skip to content

Commit

Permalink
Use bash code fences and prompts for shell code [ci skip]
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonathanhefner committed Jun 14, 2020
1 parent ed1d583 commit 481035f
Show file tree
Hide file tree
Showing 22 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion guides/assets/stylesheets/main.css
Expand Up @@ -728,7 +728,7 @@ div.important p, div.caution p, div.warning p, div.note p, div.info p {
margin-bottom: 1em;
}

/* Prevent shell prompt from being selectable when selecting commands*/
/* When triple-clicking shell code, select only the command, not the prompt */
code.language-shell-session span.token.command {
display: inline-flex;
}
Expand Down
4 changes: 2 additions & 2 deletions guides/source/2_2_release_notes.md
Expand Up @@ -51,8 +51,8 @@ All told, the Guides provide tens of thousands of words of guidance for beginnin

If you want to generate these guides locally, inside your application:

```
rake doc:guides
```bash
$ rake doc:guides
```

This will put the guides inside `Rails.root/doc/guides` and you may start surfing straight away by opening `Rails.root/doc/guides/index.html` in your favourite browser.
Expand Down
4 changes: 2 additions & 2 deletions guides/source/2_3_release_notes.md
Expand Up @@ -561,8 +561,8 @@ Rails Metal is a new mechanism that provides superfast endpoints inside of your

Rails 2.3 incorporates Jeremy McAnally's [rg](https://github.com/jm/rg) application generator. What this means is that we now have template-based application generation built right into Rails; if you have a set of plugins you include in every application (among many other use cases), you can just set up a template once and use it over and over again when you run the `rails` command. There's also a rake task to apply a template to an existing application:

```
rake rails:template LOCATION=~/template.rb
```bash
$ rake rails:template LOCATION=~/template.rb
```

This will layer the changes from the template on top of whatever code the project already contains.
Expand Down
8 changes: 4 additions & 4 deletions guides/source/4_0_release_notes.md
Expand Up @@ -26,8 +26,8 @@ If you're upgrading an existing application, it's a great idea to have good test
Creating a Rails 4.0 application
--------------------------------

```
You should have the 'rails' RubyGem installed
```bash
# You should have the 'rails' RubyGem installed
$ rails new myapp
$ cd myapp
```
Expand All @@ -42,13 +42,13 @@ More information: [Bundler homepage](https://bundler.io)

`Bundler` and `Gemfile` makes freezing your Rails application easy as pie with the new dedicated `bundle` command. If you want to bundle straight from the Git repository, you can pass the `--edge` flag:

```
```bash
$ rails new myapp --edge
```

If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the `--dev` flag:

```
```bash
$ ruby /path/to/rails/railties/bin/rails new myapp --dev
```

Expand Down
10 changes: 5 additions & 5 deletions guides/source/4_1_release_notes.md
Expand Up @@ -44,19 +44,19 @@ spring environments.

**Running rake tasks:**

```
bin/rake test:models
```bash
$ bin/rake test:models
```

**Running a Rails command:**

```
bin/rails console
```bash
$ bin/rails console
```

**Spring introspection:**

```
```bash
$ bin/spring status
Spring is running:

Expand Down
2 changes: 1 addition & 1 deletion guides/source/action_controller_overview.md
Expand Up @@ -1012,7 +1012,7 @@ NOTE: Configuration files are not reloaded on each request, so you have to resta

Now the user can request to get a PDF version of a client just by adding ".pdf" to the URL:

```bash
```
GET /clients/1.pdf
```

Expand Down
10 changes: 5 additions & 5 deletions guides/source/action_mailbox_basics.md
Expand Up @@ -69,8 +69,8 @@ providing the `URL` of the relay ingress and the `INGRESS_PASSWORD` you
previously generated. If your application lived at `https://example.com`, the
full command would look like this:

```shell
bin/rails action_mailbox:ingress:exim URL=https://example.com/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=...
```bash
$ bin/rails action_mailbox:ingress:exim URL=https://example.com/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=...
```

### Mailgun
Expand Down Expand Up @@ -159,7 +159,7 @@ the `URL` of the Postfix ingress and the `INGRESS_PASSWORD` you previously
generated. If your application lived at `https://example.com`, the full command
would look like this:

```shell
```bash
$ bin/rails action_mailbox:ingress:postfix URL=https://example.com/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=...
```

Expand Down Expand Up @@ -225,8 +225,8 @@ providing the `URL` of the relay ingress and the `INGRESS_PASSWORD` you
previously generated. If your application lived at `https://example.com`, the
full command would look like this:

```shell
bin/rails action_mailbox:ingress:qmail URL=https://example.com/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=...
```bash
$ bin/rails action_mailbox:ingress:qmail URL=https://example.com/rails/action_mailbox/relay/inbound_emails INGRESS_PASSWORD=...
```

### SendGrid
Expand Down
4 changes: 2 additions & 2 deletions guides/source/active_record_migrations.md
Expand Up @@ -834,7 +834,7 @@ $ bin/rails db:migrate RAILS_ENV=test
By default migrations tell you exactly what they're doing and how long it took.
A migration creating a table and adding an index might produce output like this

```bash
```
== CreateProducts: migrating =================================================
-- create_table(:products)
-> 0.0028s
Expand Down Expand Up @@ -877,7 +877,7 @@ end

generates the following output

```bash
```
== CreateProducts: migrating =================================================
-- Created a table
-> and an index!
Expand Down
2 changes: 1 addition & 1 deletion guides/source/active_record_querying.md
Expand Up @@ -678,7 +678,7 @@ SELECT viewable_by, locked FROM clients

Be careful because this also means you're initializing a model object with only the fields that you've selected. If you attempt to access a field that is not in the initialized record you'll receive:

```bash
```
ActiveModel::MissingAttributeError: missing attribute: <attribute>
```

Expand Down
2 changes: 1 addition & 1 deletion guides/source/api_documentation_guidelines.md
Expand Up @@ -20,7 +20,7 @@ The [Rails API documentation](https://api.rubyonrails.org) is generated with
in the rails root directory, run `bundle install` and execute:

```bash
bundle exec rake rdoc
$ bundle exec rake rdoc
```

Resulting HTML files can be found in the ./doc/rdoc directory.
Expand Down
4 changes: 2 additions & 2 deletions guides/source/command_line.md
Expand Up @@ -370,7 +370,7 @@ Inside the `bin/rails console` you have access to the `app` and `helper` instanc
With the `app` method you can access named route helpers, as well as do requests.
```bash
```ruby
>> app.root_path
=> "/"
Expand All @@ -381,7 +381,7 @@ Started GET "/" for 127.0.0.1 at 2014-06-19 10:41:57 -0300
With the `helper` method it is possible to access Rails and your application's helpers.
```bash
```ruby
>> helper.time_ago_in_words 30.days.ago
=> "about 1 month"
Expand Down
4 changes: 2 additions & 2 deletions guides/source/contributing_to_ruby_on_rails.md
Expand Up @@ -418,8 +418,8 @@ $ bundle exec rake test:sqlite3
You can now run the tests as you did for `sqlite3`. The tasks are respectively:

```bash
test:mysql2
test:postgresql
$ bundle exec rake test:mysql2
$ bundle exec rake test:postgresql
```

Finally,
Expand Down
4 changes: 2 additions & 2 deletions guides/source/debugging_rails_applications.md
Expand Up @@ -353,7 +353,7 @@ processing the entire request.

For example:

```bash
```
=> Booting Puma
=> Rails 6.0.0 application starting in development
=> Run `bin/rails server --help` for more startup options
Expand Down Expand Up @@ -876,7 +876,7 @@ will be stopped and you will have to start it again.
TIP: You can save these settings in an `.byebugrc` file in your home directory.
The debugger reads these global settings when it starts. For example:

```bash
```
set callstyle short
set listsize 25
```
Expand Down
4 changes: 2 additions & 2 deletions guides/source/engines.md
Expand Up @@ -240,7 +240,7 @@ applications into engines.

NOTE: Because of the way that Ruby does constant lookup you may run into a situation
where your engine controller is inheriting from the main application controller and
not your engine's application controller. Ruby is able to resolve the `ApplicationController` constant, and therefore the autoloading mechanism is not triggered. See the section [When Constants Aren't Missed](autoloading_and_reloading_constants_classic_mode.html#when-constants-aren-t-missed).
not your engine's application controller. Ruby is able to resolve the `ApplicationController` constant, and therefore the autoloading mechanism is not triggered. See the section [When Constants Aren't Missed](autoloading_and_reloading_constants_classic_mode.html#when-constants-aren-t-missed).
The best way to prevent this from happening is to use `require_dependency` to ensure that the engine's application
controller is loaded. For example:

Expand Down Expand Up @@ -730,7 +730,7 @@ from the engine. When run the next time, it will only copy over migrations that
haven't been copied over already. The first run for this command will output
something such as this:

```bash
```
Copied migration [timestamp_1]_create_blorgh_articles.blorgh.rb from blorgh
Copied migration [timestamp_2]_create_blorgh_comments.blorgh.rb from blorgh
```
Expand Down
2 changes: 1 addition & 1 deletion guides/source/generators.md
Expand Up @@ -149,7 +149,7 @@ Generators Lookup

When you run `bin/rails generate initializer core_extensions` Rails requires these files in turn until one is found:

```bash
```
rails/generators/initializer/initializer_generator.rb
generators/initializer/initializer_generator.rb
rails/generators/initializer_generator.rb
Expand Down
6 changes: 3 additions & 3 deletions guides/source/getting_started.md
Expand Up @@ -316,7 +316,7 @@ $ bin/rails generate controller articles index

Rails will create several files and a route for you.

```bash
```
create app/controllers/articles_controller.rb
route get 'articles/index'
invoke erb
Expand Down Expand Up @@ -790,7 +790,7 @@ $ bin/rails db:migrate
Rails will execute this migration command and tell you it created the Articles
table.

```bash
```
== CreateArticles: migrating ==================================================
-- create_table(:articles)
-> 0.0019s
Expand Down Expand Up @@ -1664,7 +1664,7 @@ $ bin/rails db:migrate
Rails is smart enough to only execute the migrations that have not already been
run against the current database, so in this case you will just see:

```bash
```
== CreateComments: migrating =================================================
-- create_table(:comments)
-> 0.0115s
Expand Down
18 changes: 9 additions & 9 deletions guides/source/plugins.md
Expand Up @@ -58,7 +58,7 @@ You can navigate to the directory that contains the plugin, run the `bundle inst

You should see:

```bash
```
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
```

Expand All @@ -85,7 +85,7 @@ end

Run `bin/test` to run the test. This test should fail because we haven't implemented the `to_squawk` method:

```bash
```
E
Error:
Expand Down Expand Up @@ -131,7 +131,7 @@ end

To test that your method does what it says it does, run the unit tests with `bin/test` from your plugin directory.

```bash
```
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
```

Expand Down Expand Up @@ -353,7 +353,7 @@ end

When you run `bin/test`, you should see the tests all pass:

```bash
```
4 runs, 4 assertions, 0 failures, 0 errors, 0 skips
```

Expand Down Expand Up @@ -458,16 +458,16 @@ When the gem is ready to be shared as a formal release, it can be published to [

Alternatively, you can benefit from Bundler's Rake tasks. You can see a full list with the following:

```
bundle exec rake -T
```bash
$ bundle exec rake -T

bundle exec rake build
$ bundle exec rake build
# Build yaffle-0.1.0.gem into the pkg directory

bundle exec rake install
$ bundle exec rake install
# Build and install yaffle-0.1.0.gem into system gems

bundle exec rake release
$ bundle exec rake release
# Create tag v0.1.0 and build and push yaffle-0.1.0.gem to Rubygems
```

Expand Down
2 changes: 1 addition & 1 deletion guides/source/rails_application_templates.md
Expand Up @@ -63,7 +63,7 @@ gem "nokogiri"
Please note that this will NOT install the gems for you and you will have to run `bundle install` to do that.

```bash
bundle install
$ bundle install
```

### gem_group(*names, &block)
Expand Down
6 changes: 3 additions & 3 deletions guides/source/routing.md
Expand Up @@ -1229,7 +1229,7 @@ edit_user GET /users/:id/edit(.:format) users#edit

You can also use the `--expanded` option to turn on the expanded table formatting mode.

```
```bash
$ bin/rails routes --expanded

--[ Route 1 ]----------------------------------------------------
Expand All @@ -1256,15 +1256,15 @@ Controller#Action | users#edit

You can search through your routes with the grep option: -g. This outputs any routes that partially match the URL helper method name, the HTTP verb, or the URL path.

```
```bash
$ bin/rails routes -g new_comment
$ bin/rails routes -g POST
$ bin/rails routes -g admin
```

If you only want to see the routes that map to a specific controller, there's the -c option.

```
```bash
$ bin/rails routes -c users
$ bin/rails routes -c admin/users
$ bin/rails routes -c Comments
Expand Down

0 comments on commit 481035f

Please sign in to comment.