Ensure flyctl is installed before running Mix tasks
This commit is contained in:
@@ -1,9 +1,23 @@
|
|||||||
defmodule Mix.Tasks.MusicLibrary.Prod.Helpers do
|
defmodule Mix.Tasks.MusicLibrary.Prod.Helpers do
|
||||||
def fly_ssh(command) do
|
def fly_ssh(command) do
|
||||||
System.cmd("flyctl", ["ssh", "console", "--command", command], into: IO.stream())
|
if flyctl_installed?() do
|
||||||
|
System.cmd("flyctl", ["ssh", "console", "--command", command], into: IO.stream())
|
||||||
|
else
|
||||||
|
IO.puts("Please install flyctl first")
|
||||||
|
System.halt(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fly_sftp_get(remote_path, local_path) do
|
def fly_sftp_get(remote_path, local_path) do
|
||||||
System.cmd("flyctl", ["ssh", "sftp", "get", remote_path, local_path], into: IO.stream())
|
if flyctl_installed?() do
|
||||||
|
System.cmd("flyctl", ["ssh", "sftp", "get", remote_path, local_path], into: IO.stream())
|
||||||
|
else
|
||||||
|
IO.puts("Please install flyctl first")
|
||||||
|
System.halt(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp flyctl_installed?() do
|
||||||
|
System.find_executable("flyctl")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user