diff --git a/dev/all-tests.sh b/dev/all-tests.sh index 4923962..e766105 100755 --- a/dev/all-tests.sh +++ b/dev/all-tests.sh @@ -5,14 +5,14 @@ # # Description: run all tests, exit after failed test # -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d ############################################################# # 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 +if [ "${GIT_DIR}" != "" ] ; then + cd "${GIT_DIR}/.." || exit 1 else printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 fi @@ -52,7 +52,7 @@ do "${test}" "${TESTENV}" ret=$? set +e - if [ "$ret" -eq 0 ] ; then + if [ "${ret}" -eq 0 ] ; then printf "OK: ---- %s\n" "${test}" passed=$((passed+1)) else @@ -64,7 +64,7 @@ done ########################### # cleanup depending on test state -if [ "$fail" -eq 0 ]; then +if [ "${fail}" -eq 0 ]; then printf 'SUCCESS ' exitcode=0 rm -rf "${TESTENV}" @@ -82,4 +82,4 @@ printf "%s\n\n" "${passed} / ${tests}" ls -ld /tmp/bashbot.test* 2>/dev/null && printf "Do not forget to delete bashbot test files in /tmp!!\n" -exit ${exitcode} +exit "${exitcode}" diff --git a/dev/git-add.sh b/dev/git-add.sh index 1a6f337..b7e2ab7 100755 --- a/dev/git-add.sh +++ b/dev/git-add.sh @@ -3,13 +3,13 @@ # # works together with git pre-push.sh and ADD all changed files since last push -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d # 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 +if [ "${GIT_DIR}" != "" ] ; then + cd "${GIT_DIR}/.." || exit 1 else printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 fi @@ -31,7 +31,7 @@ for file in ${FILES} do [ -d "${file}" ] && continue printf "%s" "${file} " - git add "$file" + git add "${file}" done printf " - Done.\n" diff --git a/dev/inject-json.sh b/dev/inject-json.sh index f470500..805ae9e 100644 --- a/dev/inject-json.sh +++ b/dev/inject-json.sh @@ -7,7 +7,7 @@ # # Usage: source inject-json.sh # -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d ############################################################## # download JSON.sh diff --git a/dev/install-hooks.sh b/dev/install-hooks.sh index d004ec8..e0bd873 100755 --- a/dev/install-hooks.sh +++ b/dev/install-hooks.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # this has to run once atfer git clone # and every time we create new hooks -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d # 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 +if [ "${GIT_DIR}" != "" ] ; then + cd "${GIT_DIR}/.." || exit 1 else printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 fi @@ -19,7 +19,7 @@ for hook in pre-commit post-commit pre-push do rm -f "${GIT_DIR}/hooks/${hook}" if [ -f "${HOOKDIR}/${hook}.sh" ]; then - printf "%s"" $hook" + printf "%s"" ${hook}" ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}" fi done diff --git a/dev/make-distribution.sh b/dev/make-distribution.sh index f67a85b..9ca43d0 100755 --- a/dev/make-distribution.sh +++ b/dev/make-distribution.sh @@ -7,15 +7,15 @@ # # Options: --notest - skip tests # -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d ############################################################## # 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 +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 @@ -47,6 +47,7 @@ cp -r ${DISTFILES} "${DISTDIR}" cd "${DISTDIR}" || exit 1 printf "Create directories\n" +# shellcheck disable=SC2250 for dir in $DISTMKDIR do [ ! -d "${dir}" ] && mkdir "${dir}" @@ -62,7 +63,7 @@ done # inject JSON.sh into distribution # shellcheck disable=SC1090 -source "$GIT_DIR/../dev/inject-json.sh" +source "${GIT_DIR}/../dev/inject-json.sh" # make html doc printf "Create html doc\n" @@ -73,13 +74,13 @@ 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 "${GIT_DIR}/../dev/${0##*/}.exclude") >"${DISTNAME}-${VERSION}.zip" +tar --exclude-ignore="${GIT_DIR}/../dev/${0##*/}.exclude" -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}" printf "%s Done!\n" "$0" # shellcheck disable=SC2086 -ls -ld ${DISTNAME}-${VERSION}.* +ls -ld "${DISTNAME}-${VERSION}".* # an empty DEBUG.log is created ... :-( -rm -f "$GIT_DIR/../test/"*.log +rm -f "${GIT_DIR}/../test/"*.log diff --git a/dev/make-html.sh b/dev/make-html.sh index c8be7e8..70327c5 100644 --- a/dev/make-html.sh +++ b/dev/make-html.sh @@ -7,7 +7,7 @@ # # Usage: source make-hmtl # -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d ############################################################## # check for correct dir @@ -36,7 +36,7 @@ else 'printf "."; pandoc -s -f commonmark -M "title=Bashobot Documentation - ${0%.md}.html" "${0}" -o "${0%.md}.html"' {} \; fi # final: convert links from *.md to *.html - find README.html html ${EXAMPLES} -iname "*.html" -type f -exec sh -c\ + find README.html html "${EXAMPLES}" -iname "*.html" -type f -exec sh -c\ 'sed -i -E "s/href=\"(\.\.\/)*doc\//href=\"\1html\//g;s/href=\"(.*).md(#.*)*\"/href=\"\1.html\"/g" ${0}' {} \; printf " Done!\n" fi diff --git a/dev/make-standalone.sh b/dev/make-standalone.sh index edcf64b..b061f97 100755 --- a/dev/make-standalone.sh +++ b/dev/make-standalone.sh @@ -9,21 +9,21 @@ # 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.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d ################################################################### # 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 +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" -DISTDIR="./STANDALONE/${DISTNAME}" +DISTDIR="./STANDALONE" DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules scripts logs LICENSE README.* doc botacl botconfig.jssh" # run pre_commit on files @@ -37,7 +37,7 @@ cd "${DISTDIR}" || exit 1 # inject JSON.sh into distribution # shellcheck disable=SC1090 -source "$GIT_DIR/../dev/inject-json.sh" +source "${GIT_DIR}/../dev/inject-json.sh" ####################### # here the magic starts @@ -95,7 +95,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 "${GIT_DIR}/../dev/make-html.sh" printf "%s Done!\n" "$0" diff --git a/dev/obfuscate.sh b/dev/obfuscate.sh index 2db4016..aa2470a 100755 --- a/dev/obfuscate.sh +++ b/dev/obfuscate.sh @@ -2,7 +2,7 @@ # # joke hack to obfuscate bashbot.min.sh # -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d # shellcheck disable=SC2028,SC2016,SC1117 infile="bashbot.sh" diff --git a/dev/version.sh b/dev/version.sh index eb759d4..580adbb 100755 --- a/dev/version.sh +++ b/dev/version.sh @@ -1,6 +1,6 @@ #!/bin/bash # -#### $$VERSION$$ v1.21-0-gc85af77 +#### $$VERSION$$ v1.25-dev-6-g641727d # shellcheck disable=SC2016 # # Easy Versioning in git: @@ -37,8 +37,8 @@ # 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 +if [ "${GIT_DIR}" != "" ] ; then + cd "${GIT_DIR}/.." || exit 1 else printf "Sorry, no git repository %s\n" "$(pwd)" && exit 1 fi @@ -52,7 +52,7 @@ printf "Update to version %s ...\n" "${VERSION}" FILES="$(find ./*)" [ "$1" != "" ] && FILES="$*" -for file in $FILES +for file in ${FILES} do [ ! -f "${file}" ] && continue #[ "${file}" == "version" ] && continue