defmodule Mix.Tasks.Dockerize do use Mix.Task def run([path]) when is_binary(path) do absolute_path = Path.expand(path) cond do !File.exists?(absolute_path) -> IO.puts("Error: path \"#{path}\" does not exist!") !File.dir?(absolute_path) -> IO.puts("Error: path \"#{path}\" is not a directory!") !File.exists?(Path.join(absolute_path, "mix.exs")) -> IO.puts("Error: path \"#{path}\" is not a mix project!") true -> DockerizeElixir.dockerize(absolute_path) end end def run(_) do IO.puts("Usage: mix dockerize path") end end