home · contact · privacy
Add small script for setting up a proper development environment.
authorChristian Heller <c.heller@plomlompom.de>
Sat, 16 Mar 2024 21:36:34 +0000 (22:36 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sat, 16 Mar 2024 21:36:34 +0000 (22:36 +0100)
git_hooks/pre-commit [deleted file]
scripts/pre-commit [new file with mode: 0755]
scripts/setup_dev_environment.sh [new file with mode: 0755]

diff --git a/git_hooks/pre-commit b/git_hooks/pre-commit
deleted file mode 100755 (executable)
index a053262..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-set -e
-python3 -m mypy task.py
-python3 -m flake8 task.py
-python3 -m pylint --good-names 'do_GET,do_POST' task.py
-exit 0
diff --git a/scripts/pre-commit b/scripts/pre-commit
new file mode 100755 (executable)
index 0000000..a053262
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+python3 -m mypy task.py
+python3 -m flake8 task.py
+python3 -m pylint --good-names 'do_GET,do_POST' task.py
+exit 0
diff --git a/scripts/setup_dev_environment.sh b/scripts/setup_dev_environment.sh
new file mode 100755 (executable)
index 0000000..8ea3a44
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -e
+
+if [ ! -d '.git' ]; then
+  echo "Cannot find .git/, please run me from your cloned repo's top directory!" 
+elif [ ! -f '.git/hooks/pre-commit' ]; then
+  echo 'Linking pre-commit hook.' 
+  cd .git/hooks/
+  ln -s ../../scripts/pre-commit
+fi