5 Commits

Author SHA1 Message Date
Issy Long
0e27dc2564
Fix RuboCop Style/ArrayIntersect offenses 2024-01-18 14:11:43 +00:00
apainintheneck
f2adbf6613 service: change custom name DSL
After some discussion, we decided to change the DSL to get rid of
the `plist_name` and `service_name` methods which aren't meaningful
for most users.

The new DSL looks like this:

```rb
service do
  name macos: "name", linux: "name"
end
```

I also updated some specs here to reflect these changes.

There was some talk about maybe deprecating `plist_name` and `service_name`
but I think that's outside of the scope of this PR so I'm leaving
them as is for now. One benefit of this is that everything here is backwards
compatible.
2023-05-17 21:54:32 -07:00
apainintheneck
1bae81cba2 rubocops/service: add checks for custom service names
It now checks for two new edge cases.
1. Are the required methods defined in the block?
2. Is the `run` command defined if we're using methods other
   than `service_name` or `plist_name`?

It has also been updated to only get the list of method call nodes
once instead of doing it repeatedly for each cellar path check.
2023-05-13 14:53:01 -07:00
Ruoyu Zhong
254941c6f7
rubocops/service: check for more cellar paths
This is a follow-up to #15154. In addition to `bin`, the `service` block
can also reference other cellar paths like `libexec`. They don't work
with the API either, as reported in
https://github.com/orgs/Homebrew/discussions/4459.

Violations are already corrected in Homebrew/homebrew-core#129736
and Homebrew/homebrew-core#129737.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2023-04-30 07:39:25 +08:00
apainintheneck
70451ea7b1 Add cop to stop bin in service block
The preferred method is opt_bin because that works
with the API and is more portable (works between versions).

Also removed the last example from the docs of `bin/"name"`
from the service block section
2023-04-04 20:00:30 -07:00