Convert combine by: '||' to any

This commit is contained in:
Donal McBreen
2024-03-07 09:10:49 +00:00
parent 32a2ae5b2c
commit b94199415f
3 changed files with 9 additions and 2 deletions

View File

@@ -62,6 +62,10 @@ module Kamal::Commands
combine *commands, by: ">"
end
def any(*commands)
combine *commands, by: "||"
end
def xargs(command)
[ :xargs, command ].flatten
end

View File

@@ -24,7 +24,10 @@ class Kamal::Commands::Builder::Base < Kamal::Commands::Base
def validate_image
pipe \
docker(:inspect, "-f", "'{{ .Config.Labels.service }}'", config.absolute_image),
[:grep, "-x", config.service, "||", "(echo \"Image #{config.absolute_image} is missing the 'service' label\" && exit 1)"]
any(
[:grep, "-x", config.service],
"(echo \"Image #{config.absolute_image} is missing the 'service' label\" && exit 1)"
)
end

View File

@@ -39,7 +39,7 @@ class Kamal::Commands::Traefik < Kamal::Commands::Base
end
def start_or_run
combine start, run, by: "||"
any start, run
end
def info