44 Commits

Author SHA1 Message Date
apainintheneck
3c503cdf56
Normalize service serialization method names 2024-02-04 13:50:57 +01:00
apainintheneck
215419daa5 service: provide backwards compatibility for socket strings
The previous PR changed how sockets were represented in the JSON
API for formulae and that would cause problems when trying to install
packages with service sockets. This provides backwards compatibility
until all users have upgraded to versions of homebrew that can deserialize
sockets hashes (maybe a couple weeks). Essentially, we store the
socket string when serializing sockets that were originally defined with
only the string parameter otherwise we serialize it to a hash.
2023-10-07 14:22:38 -07:00
Kevin
043aca2df4
Revert "Revert "service: support multiple sockets in DSL"" 2023-09-29 19:10:13 -07:00
Kevin
653f333d73
Revert "service: support multiple sockets in DSL" 2023-09-28 09:58:03 -07:00
apainintheneck
5fb9f90457 service: prefer symbols over strings in DSL
This is more in keeping with the other DSL methods and Ruby
convention along with the fact that these socket names are
just used internally by launchd.
2023-09-27 22:30:30 -07:00
apainintheneck
afeef33bc1 Add tests for multiple service sockets 2023-09-24 11:58:11 -07:00
apainintheneck
ae5e9387b9 service: support multiple sockets in DSL
This adds support for multiple named sockets to the service DSL.
It also retains backwards compatibility with the previous DSL
where you can declare one socket and it is always just named
Listener by default.
2023-09-23 19:29:21 -07:00
Markus Reiter
c12ea0bc56
Also expand paths in command. 2023-05-18 20:00:46 +02:00
Markus Reiter
3484fa319b
Add tests. 2023-05-18 19:59:32 +02: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
Douglas Eichelberger
9075cbae62 brew style --fix 2023-04-21 09:58:50 -07:00
Douglas Eichelberger
ac1e6ded9a git grep -l '# typed: false' | xargs gsed -i 's|# typed: false||g' 2023-04-21 09:57:47 -07:00
apainintheneck
39092fa629 service: handle string run cmd
This was not handled at all during deserialization.
The string argument gets turned into an array internally
but we skip that to preserve all args in the @run_params
variable. That means that we have to handle strings when
deserializing too.
2023-03-31 20:33:21 -07:00
apainintheneck
801ee5e474 Address feedback
- style nits
- better comments for tests that are not idempotent
- moved appdir placeholder constant to global.rb
2023-03-22 19:43:49 -07:00
apainintheneck
e83a2562bb Update service and formulary specs 2023-03-22 00:01:58 -07:00
apainintheneck
501730df5d Add service serialization specs 2023-03-19 00:09:16 -07:00
Issy Long
3a83b5492c
rubocop: Clean up Style/BlockDelimiters excludes and autofix offenses
- The defaults of using "do ... end" for multi-line blocks everywhere is
  good, better than switching everything to braces everywhere.
2023-03-08 23:54:22 +00:00
DenizUgur
46aefe776f fix tests 2023-02-23 11:08:39 -08:00
DenizUgur
026709962d update tests 2023-02-23 11:02:20 -08:00
Dawid Dziurla
0d0c98de29
Allow defining service run command per platform 2023-01-19 11:36:37 +01:00
Mike McQuaid
77c0d38c35
brew style --fix 2022-12-13 11:37:06 +00:00
Sean Molenaar
d477d1663a
Service: add method to define a root requirement 2022-11-06 13:52:53 +01:00
Dawid Dziurla
38026e6d8d
test: update for default.target 2022-10-07 20:22:13 +02:00
Bo Anderson
15280ba107
test: avoid improper, late usage of formula DSL 2022-08-31 20:40:39 +01:00
GottemHams
956b457f77 Updated expected plist strings to pass the tests 2022-07-03 16:25:19 +02:00
Sean Molenaar
3d5d12e8b9
service: add sockets and keepalive variants 2022-04-12 12:17:27 +02:00
apainintheneck
62de156c40 Added Service#keep_alive? method 2022-03-11 12:42:41 -08:00
Issy Long
72e48024f0
Fix (auto-correct) RuboCop Rspec/BeEq offenses 2022-03-01 00:10:14 +00:00
NickHackman
53d37cc84c service(systemd): launch_only_once test 2022-02-12 17:26:21 -05:00
NickHackman
9f4949c8c6 service: LaunchOnlyOnce plist test 2022-02-11 14:46:47 -06:00
Sean Molenaar
302975829d
service: add basic cron support 2021-11-30 14:29:22 +01:00
Sean Molenaar
4cb8afeeef
service: add timer support for systemd 2021-11-30 11:05:11 +01:00
Sean Molenaar
25bc1d8860
Service: add interval support 2021-11-06 13:18:58 +01:00
valrus
698f4a8f69 Add process_type to service DSL
This enables mpd to be run with the "Interactive" value, which avoids
performance issues such as skipping when playing music. See this PR,
where this was done previously:
https://github.com/Homebrew/homebrew-core/pull/19410

The ProcessType plist key was lost in the conversion to the service DSL:
483ad1fdfa
2021-09-09 17:37:49 -07:00
Dawid Dziurla
9657303ed2
Merge pull request #11492 from SMillerDev/fix/service/add_linux_target
service: add install block to unit
2021-06-08 02:14:01 +02:00
Sean Molenaar
8250f73383
service: add install block to unit 2021-06-05 17:59:17 +02:00
Sean Molenaar
3ce5737425
service: ensure environment variables are strings 2021-05-25 20:52:51 +02:00
Sean Molenaar
ef9c49c5b2
service: ensure environment variables are prefixed in command 2021-05-25 11:47:44 +02:00
Sean Molenaar
fceaa2bb74
Service: add additional options 2021-05-22 18:17:36 +02:00
Sean Molenaar
d4197835bb
services: fix array being flattened 2021-04-29 09:43:39 +02:00
Sean Molenaar
2ec4125178
Audit: make sure service commands exist 2021-04-27 09:36:36 +02:00
Sean Molenaar
0e93f728a6
Service: generate systemd unit file 2021-04-16 08:58:49 +02:00
Sean Molenaar
b927ecfd85
Fix formulae method loading
Co-authored-by: nandahkrishna <me@nandahkrishna.com>
2021-04-08 10:16:57 +02:00
Sean Molenaar
4427fa283f
formula: allow plists to be generated 2021-04-08 10:16:57 +02:00