I want to simplify the installation process for my application into a single command line:
mix my_app.install
I’d like this installation process to get and compile all dependencies and any assets that are not tracked in git.
However, when I clone my application from git to a new repository and run the custom mix task, I get following message from Mix.Tasks.Deps.Loadpaths
:
Unchecked dependencies for environment dev:
* ex_doc (Hex package)
the dependency is not available, run "mix deps.get"
...
This is strange to me because deps.get
is the first function I call in my custom task via Mix.Task.run/2
. When I run mix deps.get --no-archive-check
from the CLI I don’t have any issues.
Anyone know why this is?
My custom mix task:
defmodule Mix.Tasks.MyApp.Install do
use Mix.Task
def run(_) do
get_deps()
compile_deps()
install_brunch()
setup_database()
end
defp get_deps do
Mix.Task.run "deps.get", ["--no-archives-check"]
end
defp compile_deps do
Mix.Task.run "deps.compile"
end
defp install_brunch do
args =
for app <- Mix.Project.config[:web_apps] do
"--app #{app}"
end
|> Kernel.++(["npm install"])
Mix.shell.cmd args
end
defp setup_database do
Mix.Task.run "ecto.setup"
end
end