summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/create-test-repo.sh35
-rw-r--r--tools/windows/create-test-repo.bat35
-rw-r--r--tools/windows/run_tests.bat15
3 files changed, 85 insertions, 0 deletions
diff --git a/tools/create-test-repo.sh b/tools/create-test-repo.sh
new file mode 100755
index 0000000..79934d6
--- /dev/null
+++ b/tools/create-test-repo.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+RED="\033[31m"
+YELLOW="\033[33m"
+BLUE="\033[94m"
+GREEN="\033[32m"
+NO_COLOR="\033[0m"
+
+CWD="$(pwd)"
+echo "pwd=$CWD"
+# Create the repo
+cd /tmp
+reponame=$(date +gitlint-test-%Y-%m-%d_%H-%M-%S)
+git init $reponame
+cd $reponame
+
+# Do some basic config
+git config user.name gïtlint-test-user
+git config user.email gitlint@test.com
+git config core.quotePath false
+git config core.precomposeUnicode true
+
+# Add a test commit
+echo "tëst 123" > test.txt
+git add test.txt
+# commit -m -> use multiple -m args to add multiple paragraphs (/n in strings are ignored)
+git commit -m "test cömmit title" -m "test cömmit body that has a bit more text"
+cd $CWD
+
+# Let the user know
+echo ""
+echo -e "Created $GREEN/tmp/${reponame}$NO_COLOR"
+echo "Hit key up to access 'cd /tmp/$reponame'"
+echo "(Run this script using 'source' for this to work)"
+history -s "cd /tmp/$reponame"
diff --git a/tools/windows/create-test-repo.bat b/tools/windows/create-test-repo.bat
new file mode 100644
index 0000000..4220ad1
--- /dev/null
+++ b/tools/windows/create-test-repo.bat
@@ -0,0 +1,35 @@
+
+:: Use pushd, so we can popd back at the end (directory changes are not contained inside batch file)
+PUSHD C:\Windows\Temp
+
+:: Determine unique git repo name
+:: Note that date/time parsing on windows is locale dependent, so this might not work on every windows machine
+:: (see https://stackoverflow.com/questions/203090/how-do-i-get-current-date-time-on-the-windows-command-line-in-a-suitable-format)
+@echo off
+For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
+For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a-%%b)
+echo %mydate%_%mytime%
+
+set Reponame=gitlint-test-%mydate%_%mytime%
+echo %Reponame%
+
+:: Create git repo
+git init %Reponame%
+cd %Reponame%
+
+:: Do some basic config
+git config user.name gïtlint-test-user
+git config user.email gitlint@test.com
+git config core.quotePath false
+git config core.precomposeUnicode true
+
+:: Add a test commit
+echo "tëst 123" > test.txt
+git add test.txt
+git commit -m "test cömmit title" -m "test cömmit body that has a bit more text"
+
+:: echo. -> the dot allows us to print and empty line
+echo.
+echo Created C:\Windows\Temp\%Reponame%
+:: Move back to original dir
+POPD
diff --git a/tools/windows/run_tests.bat b/tools/windows/run_tests.bat
new file mode 100644
index 0000000..16ebc8b
--- /dev/null
+++ b/tools/windows/run_tests.bat
@@ -0,0 +1,15 @@
+@echo off
+
+set arg1=%1
+
+IF "%arg1%"=="-p" (
+ echo Running flake8...
+ flake8 --extend-ignore=H307,H405,H803,H904,H802,H701 --max-line-length=120 --exclude="*settings.py,*.venv/*.py" gitlint qa examples
+) ELSE (
+ :: Run passed arg, or all unit tests if passed arg is empty
+ IF "%arg1%" == "" (
+ pytest -rw -s gitlint
+ ) ELSE (
+ pytest -rw -s %arg1%
+ )
+) \ No newline at end of file