diff --git a/project.clj b/project.clj index 6d96440..7afd647 100644 --- a/project.clj +++ b/project.clj @@ -12,11 +12,16 @@ :aliases {"test" ["run" "-m" "kaocha.runner"] "cljstyle" ["run" "-m" "cljstyle.main"]} + :plugins [[jainsahab/lein-githooks "1.0.0"]] + :profiles {:dev {:dependencies [[org.testcontainers/postgresql "1.14.3"] [lambdaisland/kaocha-cloverage "1.0-45"] [lambdaisland/kaocha "1.0.641"] [lambdaisland/kaocha-junit-xml "0.0.76"] - [mvxcvi/cljstyle "0.13.0" :exclusions [org.clojure/clojure]]]}} + [mvxcvi/cljstyle "0.13.0" :exclusions [org.clojure/clojure]]] + :githooks {:auto-install true + :ci-env-variable "CI" + :pre-commit ["script/pre-commit"]}}} :target-path "target/%s") diff --git a/script/pre-commit b/script/pre-commit index 816b213..6e50f82 100755 --- a/script/pre-commit +++ b/script/pre-commit @@ -2,6 +2,8 @@ set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")/.." + FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') if [[ -z "$FILES" ]]; then diff --git a/script/setup b/script/setup deleted file mode 100755 index 4904d49..0000000 --- a/script/setup +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -cd "$(dirname "${BASH_SOURCE[0]}")/.." - -echo "Installing pre-commit hook..." -mkdir -p .git/hooks -cp script/pre-commit .git/hooks/pre-commit - -echo "Done!"