mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-25 00:37:34 +00:00
dev: dev.inc.sh for BASE_DIR
This commit is contained in:
parent
0794506753
commit
541a279f29
@ -5,17 +5,11 @@
|
||||
#
|
||||
# Description: run all tests, exit after failed test
|
||||
#
|
||||
#### $$VERSION$$ v1.25-dev-14-g2fe6d4b
|
||||
#### $$VERSION$$ v1.30-dev-19-g0794506
|
||||
#############################################################
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
|
||||
if [ "${GIT_DIR}" != "" ] ; then
|
||||
cd "${GIT_DIR}/.." || exit 1
|
||||
else
|
||||
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
|
||||
fi
|
||||
#shellcheck disable=SC1090
|
||||
source "${0%/*}/dev.inc.sh"
|
||||
|
||||
##########################
|
||||
# create test environment
|
||||
|
23
dev/dev.inc.sh
Normal file
23
dev/dev.inc.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
#############################################################
|
||||
#
|
||||
# File: dev/dev.inc.sh
|
||||
#
|
||||
# Description: common stuff for all dev scripts
|
||||
#
|
||||
#### $$VERSION$$ v1.30-dev-19-g0794506
|
||||
#############################################################
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
||||
BASE_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||
# keep old for compatibility
|
||||
# shellcheck disable=SC2034
|
||||
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
|
||||
if [ "${BASE_DIR}" != "" ] ; then
|
||||
cd "${BASE_DIR}" || exit 1
|
||||
else
|
||||
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user