I need to run a mix task after every time Phoenix
's CodeReloader
runs. The following is the single line of code I need to hook up.
System.cmd("mix", ["custom_command"])
What I’m looking for is a hook interface for me to plug in my code.
I’ve tried creating
defmodule Mix.Tasks.Compile.Mycompiler do
use Mix.Task.Compiler
def run(args) do
dbg(args)
:ok
end
end
and passing configuring my endpoint like this:
config :my_app, MyApp.Endpoint,
code_reloader: true,
reloadable_compilers: Mix.compilers() ++ [:mycompiler]
But it only get’s run twice, once with this args:
args #=> ["--no-halt"]
And a second one with these:
["--purge-consolidation-path-if-stale", "<...>/_build/dev/consolidated", "--no-all-warnings"]
Any ideas how I can achieve this, using the existing CodeReloader
infrastructure?