Fix RuboCop Layout/ group offenses in docs example code

This commit is contained in:
Issy Long 2024-01-21 22:25:33 +00:00
parent 6485324b18
commit af90f0858a
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4
5 changed files with 39 additions and 39 deletions

View File

@ -242,7 +242,7 @@ Example:
1. So, the `app` stanza should include the subfolder as a relative path:
```ruby
app "Simple Floating Clock/SimpleFloatingClock.app"
app "Simple Floating Clock/SimpleFloatingClock.app"
```
### Testing and auditing the cask

View File

@ -851,7 +851,7 @@ uninstall signal: [
["INT", "fr.madrau.switchresx.daemon"],
["HUP", "fr.madrau.switchresx.daemon"],
["KILL", "fr.madrau.switchresx.daemon"],
]
]
```
Note that when multiple running processes match the given bundle ID, all matching processes will be signaled.

View File

@ -168,8 +168,8 @@ A `Hash` (e.g. `=>`) adds information to a dependency. Given a string or symbol,
* `:recommended` (not allowed in `Homebrew/homebrew-core`) generates an implicit `without-foo` option, meaning that the dependency is enabled by default and the user must pass `--without-foo` to disable this dependency. The default description can be overridden using the [`option`](https://rubydoc.brew.sh/Formula#option-class_method) syntax (in this case, the [`option` declaration](#adding-optional-steps) must precede the dependency):
```ruby
option "with-foo", "Compile with foo bindings" # This overrides the generated description if you want to
depends_on "foo" => :optional # Generated description would otherwise be "Build with foo support"
option "with-foo", "Compile with foo bindings" # This overrides the generated description if you want to
depends_on "foo" => :optional # Generated description would otherwise be "Build with foo support"
```
* `"<option-name>"` (not allowed in `Homebrew/homebrew-core`) requires a dependency to have been built with the specified option.
@ -856,25 +856,25 @@ Several other utilities for Ruby's [`Pathname`](https://rubydoc.brew.sh/Pathname
* To perform several operations within a directory, enclose them within a [`cd <path> do`](https://rubydoc.brew.sh/Pathname#cd-instance_method) block:
```ruby
cd "src" do
cd "src" do
system "./configure", "--disable-debug", "--prefix=#{prefix}"
system "make", "install"
end
end
```
* To surface one or more binaries buried in `libexec` or a macOS `.app` package, use [`write_exec_script`](https://rubydoc.brew.sh/Pathname#write_exec_script-instance_method) or [`write_jar_script`](https://rubydoc.brew.sh/Pathname#write_jar_script-instance_method):
```ruby
bin.write_exec_script (libexec/"bin").children
bin.write_exec_script prefix/"Package.app/Contents/MacOS/package"
bin.write_jar_script libexec/jar_file, "jarfile", java_version: "11"
bin.write_exec_script (libexec/"bin").children
bin.write_exec_script prefix/"Package.app/Contents/MacOS/package"
bin.write_jar_script libexec/jar_file, "jarfile", java_version: "11"
```
* For binaries that require setting one or more environment variables to function properly, use [`write_env_script`](https://rubydoc.brew.sh/Pathname#write_env_script-instance_method) or [`env_script_all_files`](https://rubydoc.brew.sh/Pathname#env_script_all_files-instance_method):
```ruby
(bin/"package").write_env_script libexec/"package", PACKAGE_ROOT: libexec
bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"])
(bin/"package").write_env_script libexec/"package", PACKAGE_ROOT: libexec
bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"])
```
### Rewriting a script shebang
@ -943,10 +943,10 @@ There are two ways to add `launchd` plists and `systemd` services to a formula,
1. If the package already provides a service file the formula can reference it by name:
```ruby
service do
service do
name macos: "custom.launchd.name",
linux: "custom.systemd.name"
end
end
```
To find the file we append `.plist` to the `launchd` service name and `.service` to the `systemd` service name internally.
@ -955,20 +955,20 @@ There are two ways to add `launchd` plists and `systemd` services to a formula,
```ruby
# 1. An individual command
service do
service do
run opt_bin/"script"
end
end
# 2. A command with arguments
service do
service do
run [opt_bin/"script", "--config", etc/"dir/config.yml"]
end
end
# 3. OS specific commands (If you omit one, the service file won't get generated for that OS.)
service do
service do
run macos: [opt_bin/"macos_script", "standalone"],
linux: var/"special_linux_script"
end
end
```
#### Service block methods

View File

@ -68,8 +68,8 @@ These expressions can be nested as needed:
license any_of: [
"MIT",
:public_domain,
all_of: ["0BSD", "Zlib", "Artistic-1.0+"],
"Apache-2.0" => { with: "LLVM-exception" },
{ all_of: ["0BSD", "Zlib", "Artistic-1.0+"],
"Apache-2.0" => { with: "LLVM-exception" } },
]
```