diff --git a/dev/dev.inc.sh b/dev/dev.inc.sh index 78882df..04f5263 100644 --- a/dev/dev.inc.sh +++ b/dev/dev.inc.sh @@ -5,16 +5,15 @@ # # 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, # 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) +BASE_DIR=$(git rev-parse --show-toplevel 2>/dev/null) if [ "${BASE_DIR}" != "" ] ; then cd "${BASE_DIR}" || exit 1 else diff --git a/dev/git-add.sh b/dev/git-add.sh index c8da9f8..b8709fb 100755 --- a/dev/git-add.sh +++ b/dev/git-add.sh @@ -3,16 +3,10 @@ # # 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, -# 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" [ ! -f .git/.lastcommit ] && printf "No previous commit or hooks not installed, use \"git add\" instead ... Abort\n" && exit diff --git a/dev/install-hooks.sh b/dev/install-hooks.sh index 54f5adc..99697ff 100755 --- a/dev/install-hooks.sh +++ b/dev/install-hooks.sh @@ -1,16 +1,10 @@ #!/usr/bin/env bash # this has to run once atfer git clone # 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, -# 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" HOOKDIR="dev/hooks" diff --git a/dev/make-distribution.sh b/dev/make-distribution.sh index b2d673e..0ab7118 100755 --- a/dev/make-distribution.sh +++ b/dev/make-distribution.sh @@ -7,18 +7,11 @@ # # 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, -# no matter from which directory we'll run script -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 +#shellcheck disable=SC1090 +source "${0%/*}/dev.inc.sh" 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} do [ "${file}" = "addons/*.sh" ] && continue - cp "${GIT_DIR}/../${file}" "${file}.dist" + cp "${BASE_DIR}/${file}" "${file}.dist" done # inject JSON.sh into distribution # shellcheck disable=SC1090 -source "${GIT_DIR}/../dev/inject-json.sh" +source "${BASE_DIR}/dev/inject-json.sh" # make html doc printf "Create html doc\n" @@ -76,8 +69,8 @@ source "../../dev/make-html.sh" cd .. || exit 1 printf "Create dist archives\n" # shellcheck disable=SC2046 -zip -rq - "${DISTNAME}" --exclude $(cat "${GIT_DIR}/../dev/${0##*/}.exclude") >"${DISTNAME}-${VERSION}.zip" -tar --exclude-ignore="${GIT_DIR}/../dev/${0##*/}.exclude" -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}" +zip -rq - "${DISTNAME}" --exclude $(cat "${BASE_DIR}/dev/${0##*/}.exclude") >"${DISTNAME}-${VERSION}.zip" +tar --exclude-ignore="${BASE_DIR}/dev/${0##*/}.exclude" -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}" printf "%s Done!\n" "$0" @@ -85,4 +78,4 @@ printf "%s Done!\n" "$0" ls -ld "${DISTNAME}-${VERSION}".* # an empty DEBUG.log is created ... :-( -rm -f "${GIT_DIR}/../test/"*.log +rm -f "${BASE_DIR}/test/"*.log diff --git a/dev/make-standalone.sh b/dev/make-standalone.sh index bfb0ea6..1cfbcd9 100755 --- a/dev/make-standalone.sh +++ b/dev/make-standalone.sh @@ -9,18 +9,12 @@ # 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! # -#### $$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, -# no matter from which directory we'll run script -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 - [ ! -f "bashbot.sh" ] && printf "bashbot.sh not found in %s\n" " $(pwd)" && exit 1 -fi +#shellcheck disable=SC1090 +source "${0%/*}/dev.inc.sh" +[ ! -f "bashbot.sh" ] && printf "bashbot.sh not found in %s\n" " $(pwd)" && exit 1 #DISTNAME="telegram-bot-bash" DISTDIR="./STANDALONE" @@ -37,7 +31,7 @@ cd "${DISTDIR}" || exit 1 # inject JSON.sh into distribution # shellcheck disable=SC1090 -source "${GIT_DIR}/../dev/inject-json.sh" +source "${BASE_DIR}/dev/inject-json.sh" ####################### # here the magic starts @@ -95,7 +89,7 @@ chmod +x bashbot.sh.min # make html doc printf "Create html doc\n" #shellcheck disable=SC1090 -source "${GIT_DIR}/../dev/make-html.sh" +source "${BASE_DIR}/dev/make-html.sh" printf "%s Done!\n" "$0" diff --git a/dev/version.sh b/dev/version.sh index 66f71a9..41e3143 100755 --- a/dev/version.sh +++ b/dev/version.sh @@ -1,6 +1,6 @@ #!/bin/bash # -#### $$VERSION$$ v1.25-dev-46-g8253a53 +#### $$VERSION$$ v1.30-dev-20-g541a279 # shellcheck disable=SC2016 # # Easy Versioning in git: @@ -34,14 +34,8 @@ # run this script to (re)place Version number in files # -# 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" unset IFS # set -f # if you are paranoid use set -f to disable globbing