Skip to content

Commit

Permalink
Ensure /hooks folder is created
Browse files Browse the repository at this point in the history
Fixes #62
  • Loading branch information
qgadrian committed Nov 3, 2020
1 parent 78b0a9e commit e0b9afb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/mix/tasks/git_hooks/install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ defmodule Mix.Tasks.GitHooks.Install do

Printer.info("Installing git hooks...")

ensure_hooks_folder_exists()
clean_missing_hooks()
track_configured_hooks()

Expand Down Expand Up @@ -111,10 +112,13 @@ defmodule Mix.Tasks.GitHooks.Install do
Printer.warn(
"Couldn't find git_hooks.db file, won't be able to restore old backups: #{inspect(error)}"
)
end

Printer.warn(
"Check that you are not missing `.git` folder, otherwise open a ticket at https://github.com/qgadrian/elixir_git_hooks/issues/new"
)
@spec ensure_hooks_folder_exists() :: any
defp ensure_hooks_folder_exists do
Project.deps_path()
|> Path.join("/../.git/hooks")
|> File.mkdir_p()
end

@spec clean_missing_hooks() :: any
Expand Down

0 comments on commit e0b9afb

Please sign in to comment.