Is there a way to hook into Elixir's Mix built in tasks to execute a task after another one has completed?
I know you can do something similar to this.
defmodule Mix.Tasks.Other.Get
use Mix.Task
@shortdoc "Other dependencies?"
def run(_) do
Mix.Task.run("deps.get")
end
end
But I kindof want a task to run right after mix deps.get
considering using make
to wrap the commands that make the most sense. (ie make deps
which would run both mix deps.get
then mix other.get
)
You can use a Mix alias for that:
defmodule MyApp.MixProject do
use Mix.Project
def project do
[
app: :my_app,
version: "1.0.0",
aliases: aliases()
]
end
defp aliases do
[
"deps.get": ["deps.get", "custom.task"]
]
end
end