telegram-bot-bash/dev/dev.inc.sh

25 lines
688 B
Bash
Raw Normal View History

2021-01-15 13:06:10 +00:00
#!/usr/bin/env bash
#############################################################
#
# File: dev/dev.inc.sh
#
# Description: common stuff for all dev scripts
#
2021-02-04 17:13:32 +00:00
#### $$VERSION$$ v1.40-0-gf9dab50
2021-01-15 13:06:10 +00:00
#############################################################
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
# shellcheck disable=SC2034
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
2021-01-15 13:23:19 +00:00
BASE_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
2021-01-15 13:06:10 +00:00
if [ "${BASE_DIR}" != "" ] ; then
cd "${BASE_DIR}" || exit 1
else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi
2021-01-19 17:09:45 +00:00
HOOKDIR="dev/hooks"
LASTCOMMIT=".git/.lastcommit"