ExGuard is a mix command to handle events on file system modifications, ExGuard heavily borrowed ideas/art works from Guard
-
Add
ex_guard
to your list of dependencies inmix.exs
:def deps do [{:ex_guard, "~> 1.2", only: :dev}] end
-
Create a file named
.exguard.exs
in your root application directory:use ExGuard.Config guard("unit-test") |> command("mix test --color") |> watch(~r{\.(erl|ex|exs|eex|xrl|yrl)\z}i) |> notification(:auto)
Look at .exguard.exs for more fine-grained config.
-
Run
mix guard
as soon as you change any file with above pattern, the test gets executed
Currently supports notification with tools:
- Terminal Title (Xterm)
- TMux (Universal)
- Terminal Notifier (mac only)
- Notify Send (linux distros)
In order to ExGuard sends notification, you need to make sure these tools are setup properly.