From dfa5e61e113c1638adf2f73a62e51df7ce79264d Mon Sep 17 00:00:00 2001 From: Adrian Quintas Date: Fri, 29 Nov 2024 12:48:01 +1100 Subject: [PATCH] Use compile env to run install mix task This ensures that if the :auto_install configuration changes, the module will recompile, and the hooks will be installed or skipped accordingly. --- lib/git_hooks.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/git_hooks.ex b/lib/git_hooks.ex index f704331..7629de6 100644 --- a/lib/git_hooks.ex +++ b/lib/git_hooks.ex @@ -3,7 +3,9 @@ defmodule GitHooks do alias Mix.Tasks.GitHooks.Install - if Application.get_env(:git_hooks, :auto_install, true) do + @auto_install Application.compile_env(:git_hooks, :auto_install, true) + + if @auto_install do Install.run(["--quiet"]) end