Extract executions into separate concern

This commit is contained in:
David Heinemeier Hansson
2023-02-03 16:39:26 +01:00
parent a3fe8856c9
commit 8848335fbc
5 changed files with 71 additions and 45 deletions

View File

@@ -0,0 +1,27 @@
module Mrsk::Commands::Concerns::Executions
def execute_in_existing_container(*command, interactive: false)
docker :exec,
("-it" if interactive),
config.service_with_version,
*command
end
def execute_in_new_container(*command, interactive: false)
docker :run,
("-it" if interactive),
"--rm",
*rails_master_key_arg,
*config.env_args,
*config.volume_args,
config.absolute_image,
*command
end
def execute_in_existing_container_over_ssh(*command, host:)
run_over_ssh execute_in_existing_container(*command, interactive: true).join(" "), host: host
end
def execute_in_new_container_over_ssh(*command, host:)
run_over_ssh execute_in_new_container(*command, interactive: true).join(" "), host: host
end
end