Files
music_library/lib/mix/tasks/music_library/prod/helpers.ex
T
2025-02-20 15:27:01 +00:00

24 lines
642 B
Elixir

defmodule Mix.Tasks.MusicLibrary.Prod.Helpers do
def fly_ssh(command) do
if flyctl_installed?() do
System.cmd("flyctl", ["ssh", "console", "--command", command], into: IO.stream())
else
Mix.Shell.IO.error("Please install flyctl first")
System.halt(1)
end
end
def fly_sftp_get(remote_path, local_path) do
if flyctl_installed?() do
System.cmd("flyctl", ["ssh", "sftp", "get", remote_path, local_path], into: IO.stream())
else
Mix.Shell.IO.error("Please install flyctl first")
System.halt(1)
end
end
defp flyctl_installed? do
System.find_executable("flyctl")
end
end