dev version 0.7 starts

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-04-19 13:01:25 +02:00
parent 3fb7796c99
commit ef0041e7bd
17 changed files with 71 additions and 29 deletions

View File

@ -51,6 +51,7 @@ Bashbot [Documentation](https://github.com/topkecleon/telegram-bot-bash) and [Do
* Seperate logic from commands
* Test your Bot with shellcheck
* [Bashbot function reference](doc/6_reference.md)
* [Notes for bashbot developers](doc/7_develop.md)
## Note on Keyboards
From Version 0.60 on keybord format for ```send_keyboard``` and ```send_message "mykeyboardstartshere ..."``` was changed.
@ -98,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-5-ga97cd69
#### $$VERSION$$ 0.70-dev-6-g3fb7796

View File

@ -30,14 +30,14 @@ Install bashbot
1. Go to the directory you want to install bashbot, e.g.
* your $HOME directory (install and run with your user-ID)
* /usr/local if you want to run as service
2. Clone the repository:
+
....
git clone --recursive https://github.com/topkecleon/telegram-bot-bash
....
3. Change to directory `telegram-bot-bash`, run `./bashbot.sh init` and
follow the instructions. At this stage you are asked for your Bots token
given by botfather.
2. https://github.com/topkecleon/telegram-bot-bash/releases[Download
latest release archive from github] and unpack it.
If you want the current version from github, clone the repository:
`git clone https://github.com/topkecleon/telegram-bot-bash` 3. Change
directory to `telegram-bot-bash` and run `./bashbot.sh init`. Now follow
the instructions. At one point you are asked for your Bots token given
by botfather.
Update bashbot
~~~~~~~~~~~~~~
@ -71,6 +71,7 @@ Documentation
** Seperate logic from commands
** Test your Bot with shellcheck
* link:doc/6_reference.md[Bashbot function reference]
* link:doc/7_develop.md[Notes for bashbot developers]
Note on Keyboards
~~~~~~~~~~~~~~~~~
@ -161,5 +162,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-4-g12fd839
latexmath:[\[VERSION\]] 0.70-dev-6-g3fb7796
+++++++++++++++++++++++++++++++++++++++++++

View File

@ -1,7 +1,7 @@
#!/bin/sh
# description: Start or stop telegram-bash-bot
#
#### $$VERSION$$ 0.70-dev-4-g12fd839
#### $$VERSION$$ 0.70-dev-6-g3fb7796
# 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-5-ga97cd69
#### $$VERSION$$ 0.70-dev-6-g3fb7796
#
# 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-4-g12fd839
#### $$VERSION$$ 0.70-dev-6-g3fb7796
#
# shellcheck disable=SC2154
# shellcheck disable=SC2034

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash
#### $$VERSION$$ 0.70-dev-0-g209c4b3
#### $$VERSION$$ 0.70-dev-6-g3fb7796
# 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
HOOKDIR="dev/hooks"
export HOOKDIR="dev/hooks"
echo "Running pre-commit hook"
@ -28,6 +28,7 @@ else
fi
# run shellcheck before commit
echo "read files from ${HOOKDIR}/shellcheck.files ..."
FILES=$(sed '/^#/d' <"${HOOKDIR}/shellcheck.files")
if [ "$FILES" != "" ]; then
# shellcheck disable=SC2086

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash
#### $$VERSION$$ 0.70-dev-0-g209c4b3
#### $$VERSION$$ 0.70-dev-6-g3fb7796
# 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
HOOKDIR="dev/hooks"
export 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//')"

View File

@ -1,5 +1,5 @@
# list of files to run shellscheck against
#### $$VERSION$$ 0.70-dev-0-g209c4b3
#### $$VERSION$$ 0.70-dev-6-g3fb7796
# main files
bashbot.sh
commands.sh
@ -10,5 +10,6 @@ examples/notify
examples/question
# dev files
dev/version.sh
dev/hooks/install-hooks.sh
dev/install-hooks.sh
dev/hooks/pre-commit.sh
dev/hooks/pre-push.sh

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# this has to run once atfer git clone
# and every time we create new hooks
#### $$VERSION$$ 0.70-dev-0-g209c4b3
#### $$VERSION$$ 0.70-dev-6-g3fb7796
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -13,7 +13,7 @@ HOOKDIR="dev/hooks"
echo -n "Installing hooks..."
for hook in pre-commit pre-push
do
rm -f ".git/hooks/${hook}"
rm -f "${GIT_DIR}/hooks/${hook}"
if [ -f "${HOOKDIR}/${hook}.sh" ]; then
echo -n " $hook"
ln -s "../../${HOOKDIR}/${hook}.sh" "${GIT_DIR}/hooks/${hook}"

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
#### $$VERSION$$ 0.70-dev-4-g12fd839
#### $$VERSION$$ 0.70-dev-6-g3fb7796
# shellcheck disable=SC2016
#
# Easy Versioning in git:
@ -45,7 +45,7 @@ unset IFS
VERSION="$(git describe --tags --long)"
echo "Update to version $VERSION ..."
FILES="* doc/* test/*"
FILES="* doc/* dev/* dev/*/*"
[ "$1" != "" ] && FILES="$*"
for file in $FILES

View File

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

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-5-ga97cd69
#### $$VERSION$$ 0.70-dev-6-g3fb7796

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-5-ga97cd69
#### $$VERSION$$ 0.70-dev-6-g3fb7796

View File

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

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-5-ga97cd69
#### $$VERSION$$ 0.70-dev-6-g3fb7796

View File

@ -346,6 +346,7 @@ The name of your bot is availible as bash variable "$ME", there is no need to ca
Send Input from Telegram to waiting Interactive Chat.
#### [Prev Best Practice](5_practice.md)
#### [Next Developer Rules](7_develop.md)
#### $$VERSION$$ 0.70-dev-5-ga97cd69
#### $$VERSION$$ 0.70-dev-6-g3fb7796

37
doc/7_develop.md Normal file
View File

@ -0,0 +1,37 @@
#### [Home](../README.md)
## Notes for bashbot developers
This section is about help and best pratices for new bashbot developers. The main focus on creating new versions of bashbot, not on develop an individual bot. Nevertheless rules and tools described can also applied to your bot development.
Bashbot development is done on gitbub. If you want to provide fixes or new features fork bashbot on githup and provide changes as pull request.
### Setup your develop environment
1. install git, install [shellcheck](5_practice.md#Test-your-Bot-with-shellcheck)
2. setup your [environment for UTF-8](4_expert.md#Setting-up-your-Environment)
3. clone your bashbot fork to a new directory ```git clone https://github.com/<YOURNAME>/telegram-bot-bash.git```, replace <YOURNAME> with your username on github
4. create and change to your develop branch ```git checkout -b <YOURBRANCH>```, replace <YOURBRANCH> with the name you want to name it, e.g. 'develop'
5. give your (dev) fork a new version tag: ```git tag vx.xx```, version must be higher than current version
6. setup github hooks by running ```dev/install-hooks.sh``` (optional)
### Versioning
Bashbot is tagged with version numbers. If you start new development you must tag your fork with a new version higher than the current version.
If you fork 'v0.60' the next develop version should tagged as e.g. ```git tag "v0.61-dev"``` for fixes or ```git tag "v0.70-dev"``` for new features.
To get the current version name of your dev fork run ```git describe --tags```. The output will something like '0.70-dev-6-g3fb7796', where your version tag is followed by the number of commits since you tag your version and the latest commit hash. see also [comments in version.sh](../dev/version.sh)
To update the Version Number in your scripts run ```dev/version.sh```, it will update the line '#### $$VERSION$$ ###' in all files to the current version name.
If you actived git hooks in Setup step 6, 'version.sh' updates the version name on every push
### Shellchecking
For a shell script running as a service it's important to be paranoid about quoting, globbing and ohter common problems. So it's a must to run shellchek on all shell scripts before you commit a change. this is done by a git hook activated in Setup step 6.
You can run shellcheck manually on every file or run ```dev/hooks/pre-commit.sh``` to run shellcheck for all files given in 'dev/hooks/shellcheck.files'.
#### [Prev Function Reference](6_function.md)
#### $$VERSION$$ 0.70-dev-6-g3fb7796