Current section
Files
Jump to
Current section
Files
lib/mix/tasks/can_deploy.ex
defmodule Mix.Tasks.Deployment.CanDeploy do
use Mix.Task
@moduledoc "
If the local release's `relup` (generated by relx)
correctly transtions from the remote version to the local version,
prints 'yes' and exits normally,
otherwise prints 'no' and exits with a non-zero exit code.
"
@shortdoc "Indicates if the latest relase can be deployed"
def run([stage]) do
{:ok, remote_version} = Exdm.Remote.get_version(String.to_atom(stage))
handle_can_transition_from(Exdm.Local.can_transition_from(remote_version))
end
defp handle_can_transition_from({:ok}) do
IO.puts "yes"
end
defp handle_can_transition_from({:error, reason}) do
IO.puts "no"
raise reason
end
end