I've got a custom mix task. its working perfectly, however, it is not triggering a compile when it is called like other mix tasks do. I can run the compile manually but this is very frustrating as I almost always forget to do it and have to run the task once or twice before I realize why I'm not seeing my changes.
Here is "my" task, what am i missing?
defmodule Mix.Tasks.Return do
@moduledoc """
Task for processing returns
"""
use Mix.Task
require Logger
alias Returns
@shortdoc "Check for returns and process"
def run(args) do
args
|> get_return_file_name()
|> Returns.process()
|> Kernel.inspect()
|> Logger.info()
end
defp get_file_name(nil), do: get_file_name([])
defp get_file_name([]), do: get_default_file_name()
defp get_file_name([filename]), do: filename
defp get_default_file_name() do
DateTime.utc_now()
|> DateTime.to_string()
|> String.split(" ")
|> List.first()
|> (fn date -> "default-#{date}.txt" end).()
end
end