mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 15:35:09 +00:00
add pre-push hook
This commit is contained in:
parent
ebd9e6fb9f
commit
8bb14ec909
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
@ -17,8 +17,8 @@ Prerequisites
|
||||
Depends on http://github.com/tmux/tmux[tmux]. Uses
|
||||
http://github.com/dominictarr/JSON.sh[JSON.sh].
|
||||
|
||||
For full UTF-8 support you need
|
||||
link:doc/4_expert.md#UTF-8-Support[python on your system] (optional).
|
||||
Most complete link:doc/4_expert.md#Bashbot-UTF-8-Support[UTF-8 support
|
||||
for bashbot] is availible if phyton is installed (optional).
|
||||
|
||||
Bashbot https://github.com/topkecleon/telegram-bot-bash[Documentation]
|
||||
and https://github.com/topkecleon/telegram-bot-bash/releases[Downloads]
|
||||
@ -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\]] v0.60-0-gf5162e2
|
||||
++++++++++++++++++++++++++++++++++++++++
|
||||
latexmath:[\[VERSION\]] 0.70-dev-2-gebd9e6f
|
||||
+++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
|
||||
SHELL=/bin/sh
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# description: Start or stop telegram-bash-bot
|
||||
#
|
||||
#### $$VERSION$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
# shellcheck disable=SC2009
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
|
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
|
2
calc
2
calc
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
#
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -61,5 +61,5 @@ group. This step is up to you actually.
|
||||
|
||||
#### [Next Getting started](2_usage.md)
|
||||
|
||||
#### $$VERSION$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
|
@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action"
|
||||
#### [Prev Create Bot](1_firstbot.md)
|
||||
#### [Next Advanced Usage](3_advanced.md)
|
||||
|
||||
#### $$VERSION$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
|
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
|
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
|
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
|
@ -347,5 +347,5 @@ Send Input from Telegram to waiting Interactive Chat.
|
||||
|
||||
#### [Prev Best Practice](5_practice.md)
|
||||
|
||||
#### $$VERSION$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
|
@ -12,9 +12,9 @@ echo -n "Installing hooks..."
|
||||
for hook in pre-commit pre-push
|
||||
do
|
||||
rm -f "$GIT_DIR/hooks/${hook}"
|
||||
if [ -f "test/${hook}.sh" ]; then
|
||||
if [ -f "hooks/${hook}.sh" ]; then
|
||||
echo -n " $hook"
|
||||
ln -s "../../test/${hook}.sh" "$GIT_DIR/hooks/${hook}"
|
||||
ln -s "../../hooks/${hook}.sh" "$GIT_DIR/hooks/${hook}"
|
||||
fi
|
||||
done
|
||||
echo " Done!"
|
@ -18,7 +18,7 @@ echo "............................"
|
||||
unset IFS; set -f
|
||||
|
||||
# run shellcheck before commit
|
||||
FILES=$(sed '/^#/d' <"test/shellcheck.files")
|
||||
FILES=$(sed '/^#/d' <"hooks/shellcheck.files")
|
||||
if [ "$FILES" != "" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
shellcheck -x ${FILES}
|
31
hooks/pre-push.sh
Executable file
31
hooks/pre-push.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ 0.70-dev-0-g209c4b3
|
||||
|
||||
# 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
|
||||
REMOTEVER="$(git ls-remote -t --refs 2>/dev/null | tail -1 | sed 's/.*\/v//')"
|
||||
VERSION="$(git describe --tags | sed -e 's/-.*//' -e 's/v//')"
|
||||
|
||||
echo "Running pre-push hook"
|
||||
|
||||
# if any command inside script returns error, exit and return that error
|
||||
set -e
|
||||
|
||||
# let's fake failing test for now
|
||||
echo "Running tests"
|
||||
echo "............................"
|
||||
|
||||
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
|
||||
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}"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -10,5 +10,5 @@ commands.sh
|
||||
notify
|
||||
question
|
||||
# test files
|
||||
test/install-hooks.sh
|
||||
test/pre-commit.sh
|
||||
hooks/install-hooks.sh
|
||||
hooks/pre-commit.sh
|
2
notify
2
notify
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
2
question
2
question
@ -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$$ v0.60-0-gf5162e2
|
||||
#### $$VERSION$$ 0.70-dev-2-gebd9e6f
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
Loading…
Reference in New Issue
Block a user