2024-07-22 11:30:33 +02:00
|
|
|
# For using the alias gw-importOfficeData or gw-importHostingAssets,
|
2024-07-16 10:23:16 +02:00
|
|
|
# copy the file .tc-environment to .environment (ignored by git)
|
|
|
|
# and amend them according to your external DB.
|
2024-01-23 15:11:23 +01:00
|
|
|
|
2022-09-06 11:07:49 +02:00
|
|
|
gradleWrapper () {
|
|
|
|
if [ ! -f gradlew ]; then
|
|
|
|
echo "No 'gradlew' found. Maybe you are not in the root dir of a gradle project?"
|
2022-10-16 18:50:32 +02:00
|
|
|
return 1
|
2022-09-06 11:07:49 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
TEMPFILE=$(mktemp /tmp/gw.XXXXXX)
|
2022-09-06 13:32:53 +02:00
|
|
|
unbuffer ./gradlew "$@" | tee $TEMPFILE
|
2022-09-06 11:07:49 +02:00
|
|
|
|
|
|
|
echo
|
2022-09-06 13:32:53 +02:00
|
|
|
grep --color=never "Report:" $TEMPFILE
|
2022-09-06 11:07:49 +02:00
|
|
|
rm $TEMPFILE
|
|
|
|
}
|
|
|
|
|
2022-10-16 18:50:32 +02:00
|
|
|
postgresAutodoc () {
|
|
|
|
if ! [ -x "$(command -v postgresql_autodoc)" ]; then
|
|
|
|
echo "Program 'postgresql_autodoc' not found. Please install, e.g. via: sudo apt install postgresql-autodoc" >&2
|
|
|
|
echo "See also https://github.com/cbbrowne/autodoc" >&2
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -x "$(command -v dot)" ]; then
|
|
|
|
echo "Program 'graphviz dot' not found. Please install, e.g. via: sudo apt install graphviz" >&2
|
|
|
|
echo "See also https://graphviz.org" >&2
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
postgresql_autodoc -d postgres -f build/postgres-autodoc -h localhost -u postgres --password=password \
|
|
|
|
-m '(rbacobject|hs).*' \
|
2024-10-09 19:19:11 +02:00
|
|
|
-l /usr/share/postgresql-autodoc -t neato &&
|
2022-10-16 18:50:32 +02:00
|
|
|
dot -Tsvg build/postgres-autodoc.neato >build/postgres-autodoc-hs.svg && \
|
|
|
|
echo "generated: $PWD/build/postgres-autodoc-hs.svg"
|
|
|
|
|
|
|
|
postgresql_autodoc -d postgres -f build/postgres-autodoc -h localhost -u postgres --password=password \
|
|
|
|
-m '(global|rbac).*' \
|
2024-10-09 19:19:11 +02:00
|
|
|
-l /usr/share/postgresql-autodoc -t neato &&
|
2022-10-16 18:50:32 +02:00
|
|
|
dot -Tsvg build/postgres-autodoc.neato >build/postgres-autodoc-rbac.svg && \
|
|
|
|
echo "generated $PWD/build/postgres-autodoc-rbac.svg"
|
|
|
|
}
|
|
|
|
alias postgres-autodoc=postgresAutodoc
|
|
|
|
|
2024-07-22 11:30:33 +02:00
|
|
|
function importLegacyData() {
|
|
|
|
export target=$1
|
|
|
|
if [ -z "$target" ]; then
|
|
|
|
echo "importLegacyData needs target argument, but none was given" >&2
|
|
|
|
else
|
|
|
|
source .tc-environment
|
2024-01-23 15:11:23 +01:00
|
|
|
|
2024-07-22 11:30:33 +02:00
|
|
|
if [ -f .environment ]; then
|
|
|
|
source .environment
|
|
|
|
fi
|
2024-01-23 15:11:23 +01:00
|
|
|
|
2024-07-22 11:30:33 +02:00
|
|
|
echo "using environment (with ending ';' for use in IntelliJ IDEA):"
|
|
|
|
echo "--- BEGIN: ---"
|
|
|
|
set | grep ^HSADMINNG_ | sed 's/$/;/'
|
|
|
|
echo "---- END. ----"
|
|
|
|
echo
|
|
|
|
|
|
|
|
echo ./gradlew $target --rerun
|
|
|
|
./gradlew $target --rerun
|
|
|
|
fi
|
2024-01-23 15:11:23 +01:00
|
|
|
}
|
2024-07-22 11:30:33 +02:00
|
|
|
alias gw-importOfficeData='importLegacyData importOfficeData'
|
|
|
|
alias gw-importHostingAssets='importLegacyData importHostingAssets'
|
2024-01-23 15:11:23 +01:00
|
|
|
|
2022-09-15 11:19:04 +02:00
|
|
|
alias podman-start='systemctl --user enable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock'
|
2022-09-16 15:25:58 +02:00
|
|
|
alias podman-stop='systemctl --user disable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock'
|
2022-09-15 11:19:04 +02:00
|
|
|
alias podman-use='export DOCKER_HOST="unix:///run/user/$UID/podman/podman.sock"; export TESTCONTAINERS_RYUK_DISABLED=true'
|
2022-09-06 11:07:49 +02:00
|
|
|
|
|
|
|
alias gw=gradleWrapper
|
2024-01-02 13:28:56 +01:00
|
|
|
alias pg-sql-run='docker run --name hsadmin-ng-postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:15.5-bookworm'
|
2022-07-28 10:43:49 +02:00
|
|
|
alias pg-sql-stop='docker stop hsadmin-ng-postgres'
|
|
|
|
alias pg-sql-start='docker container start hsadmin-ng-postgres'
|
|
|
|
alias pg-sql-remove='docker rm hsadmin-ng-postgres'
|
|
|
|
alias pg-sql-reset='pg-sql-stop; pg-sql-remove; pg-sql-run'
|
|
|
|
alias pg-sql-backup='docker exec -i hsadmin-ng-postgres /usr/bin/pg_dump --clean --create -U postgres postgres | gzip -9'
|
|
|
|
alias pg-sql-restore='gunzip --stdout | docker exec -i hsadmin-ng-postgres psql -U postgres -d postgres'
|
|
|
|
|
2022-10-03 11:09:36 +02:00
|
|
|
alias fp='grep -r '@Accepts' src | sed -e 's/^.*@/@/g' | sort -u | wc -l'
|
2024-01-23 15:11:23 +01:00
|
|
|
|
|
|
|
alias gw-spotless='./gradlew spotlessApply -x pitest -x test -x :processResources'
|
2024-08-22 11:56:21 +02:00
|
|
|
alias gw-test='. .aliases; ./gradlew test'
|
2024-10-09 19:19:11 +02:00
|
|
|
alias gw-check='. .aliases; gw test check -x pitest'
|
2024-08-12 12:06:12 +02:00
|
|
|
|
|
|
|
# etc/docker-compose.yml limits CPUs+MEM and includes a PostgreSQL config for analysing slow queries
|
|
|
|
alias gw-importOfficeData-in-docker-compose='
|
|
|
|
docker-compose -f etc/docker-compose.yml down &&
|
|
|
|
docker-compose -f etc/docker-compose.yml up -d && sleep 10 &&
|
|
|
|
time gw-importHostingAssets'
|
2024-08-30 10:06:39 +02:00
|
|
|
|
|
|
|
if [ ! -f .environment ]; then
|
|
|
|
cp .tc-environment .environment
|
|
|
|
fi
|
|
|
|
source .environment
|