dev: use dev.inc.sh

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-15 14:23:19 +01:00
parent 541a279f29
commit 550a0defb3
6 changed files with 25 additions and 57 deletions

View File

@ -5,16 +5,15 @@
# #
# Description: common stuff for all dev scripts # Description: common stuff for all dev scripts
# #
#### $$VERSION$$ v1.30-dev-19-g0794506 #### $$VERSION$$ v1.30-dev-20-g541a279
############################################################# #############################################################
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script # 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 # shellcheck disable=SC2034
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
BASE_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
if [ "${BASE_DIR}" != "" ] ; then if [ "${BASE_DIR}" != "" ] ; then
cd "${BASE_DIR}" || exit 1 cd "${BASE_DIR}" || exit 1
else else

View File

@ -3,16 +3,10 @@
# #
# works together with git pre-push.sh and ADD all changed files since last push # works together with git pre-push.sh and ADD all changed files since last push
#### $$VERSION$$ v1.25-dev-50-g427e4df #### $$VERSION$$ v1.30-dev-20-g541a279
# magic to ensure that we're always inside the root of our application, #shellcheck disable=SC1090
# no matter from which directory we'll run script source "${0%/*}/dev.inc.sh"
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
[ ! -f .git/.lastcommit ] && printf "No previous commit or hooks not installed, use \"git add\" instead ... Abort\n" && exit [ ! -f .git/.lastcommit ] && printf "No previous commit or hooks not installed, use \"git add\" instead ... Abort\n" && exit

View File

@ -1,16 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# this has to run once atfer git clone # this has to run once atfer git clone
# and every time we create new hooks # and every time we create new hooks
#### $$VERSION$$ v1.25-dev-14-g2fe6d4b #### $$VERSION$$ v1.30-dev-20-g541a279
# magic to ensure that we're always inside the root of our application, #shellcheck disable=SC1090
# no matter from which directory we'll run script source "${0%/*}/dev.inc.sh"
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
HOOKDIR="dev/hooks" HOOKDIR="dev/hooks"

View File

@ -7,18 +7,11 @@
# #
# Options: --notest - skip tests # Options: --notest - skip tests
# #
#### $$VERSION$$ v1.25-dev-42-gde24ded #### $$VERSION$$ v1.30-dev-20-g541a279
############################################################## ##############################################################
# magic to ensure that we're always inside the root of our application, #shellcheck disable=SC1090
# no matter from which directory we'll run script source "${0%/*}/dev.inc.sh"
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ "${GIT_DIR}" != "" ] ; then
[[ "${GIT_DIR}" != "/"* ]] && GIT_DIR="${PWD}/${GIT_DIR}"
cd "${GIT_DIR}/.." || exit 1
else
printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1
fi
VERSION="$(git describe --tags | sed -e 's/-[0-9].*//' -e 's/v//')" VERSION="$(git describe --tags | sed -e 's/-[0-9].*//' -e 's/v//')"
@ -60,12 +53,12 @@ printf "Create .dist files\n"
for file in ${DISTFILESDIST} for file in ${DISTFILESDIST}
do do
[ "${file}" = "addons/*.sh" ] && continue [ "${file}" = "addons/*.sh" ] && continue
cp "${GIT_DIR}/../${file}" "${file}.dist" cp "${BASE_DIR}/${file}" "${file}.dist"
done done
# inject JSON.sh into distribution # inject JSON.sh into distribution
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${GIT_DIR}/../dev/inject-json.sh" source "${BASE_DIR}/dev/inject-json.sh"
# make html doc # make html doc
printf "Create html doc\n" printf "Create html doc\n"
@ -76,8 +69,8 @@ source "../../dev/make-html.sh"
cd .. || exit 1 cd .. || exit 1
printf "Create dist archives\n" printf "Create dist archives\n"
# shellcheck disable=SC2046 # shellcheck disable=SC2046
zip -rq - "${DISTNAME}" --exclude $(cat "${GIT_DIR}/../dev/${0##*/}.exclude") >"${DISTNAME}-${VERSION}.zip" zip -rq - "${DISTNAME}" --exclude $(cat "${BASE_DIR}/dev/${0##*/}.exclude") >"${DISTNAME}-${VERSION}.zip"
tar --exclude-ignore="${GIT_DIR}/../dev/${0##*/}.exclude" -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}" tar --exclude-ignore="${BASE_DIR}/dev/${0##*/}.exclude" -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}"
printf "%s Done!\n" "$0" printf "%s Done!\n" "$0"
@ -85,4 +78,4 @@ printf "%s Done!\n" "$0"
ls -ld "${DISTNAME}-${VERSION}".* ls -ld "${DISTNAME}-${VERSION}".*
# an empty DEBUG.log is created ... :-( # an empty DEBUG.log is created ... :-(
rm -f "${GIT_DIR}/../test/"*.log rm -f "${BASE_DIR}/test/"*.log

View File

@ -9,18 +9,12 @@
# If you your bot is finished you can use make-standalone.sh to create the # If you your bot is finished you can use make-standalone.sh to create the
# the old all-in-one bashbot: bashbot.sh and commands.sh only! # the old all-in-one bashbot: bashbot.sh and commands.sh only!
# #
#### $$VERSION$$ v1.25-dev-14-g2fe6d4b #### $$VERSION$$ v1.30-dev-20-g541a279
################################################################### ###################################################################
# magic to ensure that we're always inside the root of our application, #shellcheck disable=SC1090
# no matter from which directory we'll run script source "${0%/*}/dev.inc.sh"
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) [ ! -f "bashbot.sh" ] && printf "bashbot.sh not found in %s\n" " $(pwd)" && exit 1
if [ "${GIT_DIR}" != "" ] ; then
[[ "${GIT_DIR}" != "/"* ]] && GIT_DIR="${PWD}/${GIT_DIR}"
cd "${GIT_DIR}/.." || exit 1
else
[ ! -f "bashbot.sh" ] && printf "bashbot.sh not found in %s\n" " $(pwd)" && exit 1
fi
#DISTNAME="telegram-bot-bash" #DISTNAME="telegram-bot-bash"
DISTDIR="./STANDALONE" DISTDIR="./STANDALONE"
@ -37,7 +31,7 @@ cd "${DISTDIR}" || exit 1
# inject JSON.sh into distribution # inject JSON.sh into distribution
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${GIT_DIR}/../dev/inject-json.sh" source "${BASE_DIR}/dev/inject-json.sh"
####################### #######################
# here the magic starts # here the magic starts
@ -95,7 +89,7 @@ chmod +x bashbot.sh.min
# make html doc # make html doc
printf "Create html doc\n" printf "Create html doc\n"
#shellcheck disable=SC1090 #shellcheck disable=SC1090
source "${GIT_DIR}/../dev/make-html.sh" source "${BASE_DIR}/dev/make-html.sh"
printf "%s Done!\n" "$0" printf "%s Done!\n" "$0"

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
#### $$VERSION$$ v1.25-dev-46-g8253a53 #### $$VERSION$$ v1.30-dev-20-g541a279
# shellcheck disable=SC2016 # shellcheck disable=SC2016
# #
# Easy Versioning in git: # Easy Versioning in git:
@ -34,14 +34,8 @@
# run this script to (re)place Version number in files # run this script to (re)place Version number in files
# #
# magic to ensure that we're always inside the root of our application, #shellcheck disable=SC1090
# no matter from which directory we'll run script source "${0%/*}/dev.inc.sh"
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
unset IFS unset IFS
# set -f # if you are paranoid use set -f to disable globbing # set -f # if you are paranoid use set -f to disable globbing