rearrange example and dev files

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-04-19 10:43:06 +02:00
parent 12fd839e72
commit a97cd69402
21 changed files with 52 additions and 40 deletions

View File

@ -99,4 +99,4 @@ Bashbot is not more (in)secure as any other Bot written in any other language, w
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839

View File

@ -161,5 +161,5 @@ That's it!
If you feel that there's something missing or if you found a bug, feel
free to submit a pull request!
latexmath:[\[VERSION\]] 0.70-dev-2-gebd9e6f
latexmath:[\[VERSION\]] 0.70-dev-4-g12fd839
+++++++++++++++++++++++++++++++++++++++++++

View File

@ -1,7 +1,7 @@
#!/bin/sh
# description: Start or stop telegram-bash-bot
#
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
# shellcheck disable=SC2009
# shellcheck disable=SC2181

View File

@ -10,7 +10,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
#
# Exit Codes:
# - 0 sucess (hopefully)

View File

@ -4,7 +4,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
#
# shellcheck disable=SC2154
# shellcheck disable=SC2034
@ -100,7 +100,7 @@ else
'/question')
checkproc
if [ "$res" -gt 0 ] ; then
startproc "./question"
startproc "example/question"
else
send_normal_message "${CHAT[ID]}" "$MESSAGE already running ..."
fi
@ -109,7 +109,7 @@ else
'/run-notify')
myback="notify"; checkback "$myback"
if [ "$res" -gt 0 ] ; then
background "./notify 60" "$myback" # notify every 60 seconds
background "example/notify 60" "$myback" # notify every 60 seconds
else
send_normal_message "${CHAT[ID]}" "Background command $myback already running ..."
fi

View File

@ -8,13 +8,15 @@
GIT_DIR=$(git rev-parse --git-dir)
cd "$GIT_DIR/.." || exit 1
HOOKDIR="dev/hooks"
echo -n "Installing hooks..."
for hook in pre-commit pre-push
do
rm -f "$GIT_DIR/hooks/${hook}"
if [ -f "hooks/${hook}.sh" ]; then
rm -f ".git/hooks/${hook}"
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
echo -n " $hook"
ln -s "../../hooks/${hook}.sh" "$GIT_DIR/hooks/${hook}"
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"
fi
done
echo " Done!"

View File

@ -6,6 +6,8 @@
GIT_DIR=$(git rev-parse --git-dir)
cd "$GIT_DIR/.." || exit 1
HOOKDIR="dev/hooks"
echo "Running pre-commit hook"
# if any command inside script returns error, exit and return that error
@ -26,7 +28,7 @@ else
fi
# run shellcheck before commit
FILES=$(sed '/^#/d' <"hooks/shellcheck.files")
FILES=$(sed '/^#/d' <"${HOOKDIR}/shellcheck.files")
if [ "$FILES" != "" ]; then
# shellcheck disable=SC2086
shellcheck -x ${FILES} || exit 1

View File

@ -5,6 +5,9 @@
# no matter from which directory we'll run script
GIT_DIR=$(git rev-parse --git-dir)
cd "$GIT_DIR/.." || exit 1
HOOKDIR="dev/hooks"
REMOTEVER="$(git ls-remote -t --refs 2>/dev/null | tail -1 | sed 's/.*\/v//')"
VERSION="$(git describe --tags | sed -e 's/-.*//' -e 's/v//')"
@ -22,7 +25,7 @@ unset IFS; set -f
# LOCAL version must greater than latest REMOTE release version
if (( $(echo "${VERSION} > ${REMOTEVER}" | bc -l) )); then
# update version in bashbot files on push
./version
dev/version.sh 2>/dev/null
else
echo "Error: local version ${VERSION} must be greater than latest release version."
echo "use \"git tag ...\" to create a local version greater than ${REMOTEVER}"

View File

@ -0,0 +1,14 @@
# list of files to run shellscheck against
#### $$VERSION$$ 0.70-dev-0-g209c4b3
# main files
bashbot.sh
commands.sh
bashbot.rc
# example files
examples/calc
examples/notify
examples/question
# dev files
dev/version.sh
dev/hooks/install-hooks.sh
dev/hooks/pre-commit.sh

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
# shellcheck disable=SC2016
#
# Easy Versioning in git:
@ -34,11 +34,16 @@
# 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)
cd "$GIT_DIR/.." || exit 1
unset IFS
# set -f # if you are paranoid use set -f to disable globbing
VERSION="$(git describe --tags --long)"
echo "Update files to version $VERSION ..."
echo "Update to version $VERSION ..."
FILES="* doc/* test/*"
[ "$1" != "" ] && FILES="$*"
@ -47,11 +52,11 @@ for file in $FILES
do
[ ! -f "$file" ] && continue
#[ "$file" == "version" ] && continue
echo -n " $file"
echo -n " $file" >&2
sed -i 's/^#### $$VERSION$$.*/#### \$\$VERSION\$\$ '"$VERSION"'/' "$file"
done
# try to compile README.txt
echo -n " README.txt"
echo -n " README.txt" >&2
pandoc -f markdown -t asciidoc README.md | sed '/^\[\[/d' >README.txt
echo " done."

View File

@ -61,5 +61,5 @@ group. This step is up to you actually.
#### [Next Getting started](2_usage.md)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839

View File

@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action"
#### [Prev Create Bot](1_firstbot.md)
#### [Next Advanced Usage](3_advanced.md)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839

View File

@ -156,5 +156,5 @@ answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
#### [Prev Advanced Usage](3_advanced.md)
#### [Next Expert Use](4_expert.md)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839

View File

@ -104,5 +104,5 @@ An example crontab is provided in ```bashbot.cron```.
#### [Prev Expert Use](4_expert.md)
#### [Next Best Practice](5_practice.md)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839

View File

@ -112,5 +112,5 @@ The second warning is about an unused variable, this is true because in our exam
#### [Prev Best Practice](5_practice.md)
#### [Next Functions Reference](6_reference.md)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839

View File

@ -347,5 +347,5 @@ Send Input from Telegram to waiting Interactive Chat.
#### [Prev Best Practice](5_practice.md)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839

View File

@ -7,7 +7,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
SHELL=/bin/sh

View File

@ -3,7 +3,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
# adjust your language setting here
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment

View File

@ -2,7 +2,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
# adjust your language setting here
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment

View File

@ -3,7 +3,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
#### $$VERSION$$ 0.70-dev-4-g12fd839
# adjust your language setting here
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment

View File

@ -1,14 +0,0 @@
# list of files to run shellscheck against
#### $$VERSION$$ 0.70-dev-0-g209c4b3
# main files
bashbot.rc
bashbot.sh
version
# job files
calc
commands.sh
notify
question
# test files
hooks/install-hooks.sh
hooks/pre-commit.sh