mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 15:35:09 +00:00
ajust develop and environmen doc
This commit is contained in:
parent
b8a23c4553
commit
d08d581312
11
bashbot.sh
11
bashbot.sh
@ -12,7 +12,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.70-dev3-5-g8b8da67
|
#### $$VERSION$$ v0.70-dev3-8-gb8a23c4
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
@ -34,9 +34,10 @@ fi
|
|||||||
# get location and name of bashbot.sh
|
# get location and name of bashbot.sh
|
||||||
SCRIPT="$0"
|
SCRIPT="$0"
|
||||||
SCRIPTDIR="$(dirname "$0")"
|
SCRIPTDIR="$(dirname "$0")"
|
||||||
RUNDIR="${BASHBOT_VAR:-${SCRIPTDIR}}"
|
MODULEDIR="${SCRIPTDIR}/modules"
|
||||||
[ "${RUNDIR}" = "${SCRIPTDIR}" ] && SCRIPT="./$(basename "${SCRIPT}")"
|
|
||||||
|
|
||||||
|
RUNDIR="${SCRIPTDIR}"
|
||||||
|
[ "${RUNDIR}" = "${SCRIPTDIR}" ] && SCRIPT="./$(basename "${SCRIPT}")"
|
||||||
|
|
||||||
RUNUSER="${USER}" # USER is overwritten by bashbot array
|
RUNUSER="${USER}" # USER is overwritten by bashbot array
|
||||||
|
|
||||||
@ -115,9 +116,7 @@ elif [ ! -w "${COUNTFILE}" ]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMMANDS="${BASHBOT_COMMANDS:-${RUNDIR}/commands.sh}"
|
COMMANDS="${BASHBOT_ETC:-.}/commands.sh"
|
||||||
[[ "${COMMANDS}" != *".sh" ]] && echo -e "${RED}ERROR: \"${COMMANDS}\" ends not with \".sh\".${NC}" && exit 3
|
|
||||||
|
|
||||||
if [ "$1" != "source" ]; then
|
if [ "$1" != "source" ]; then
|
||||||
if [ ! -f "${COMMANDS}" ] || [ ! -r "${COMMANDS}" ]; then
|
if [ ! -f "${COMMANDS}" ] || [ ! -r "${COMMANDS}" ]; then
|
||||||
${CLEAR}
|
${CLEAR}
|
||||||
|
12
commands.sh
12
commands.sh
@ -5,7 +5,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.70-dev2-27-g2da31c1
|
#### $$VERSION$$ v0.70-dev3-8-gb8a23c4
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
@ -40,14 +40,16 @@ Written by Drew (@topkecleon), Daniil Gentili (@danogentili) and KayM(@gnadelwar
|
|||||||
Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
|
Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
|
||||||
'
|
'
|
||||||
|
|
||||||
# load additional modules
|
# load modules
|
||||||
[ -r "modules/aliases.sh" ] && source "modules/aliases.sh"
|
# shellcheck source=./modules/aliases.sh
|
||||||
[ -r "modules/background.sh" ] && source "modules/background.sh"
|
[ -r "${MODULEDIR}/aliases.sh" ] && source "${MODULEDIR}/aliases.sh"
|
||||||
|
# shellcheck source=./modules/background.sh
|
||||||
|
[ -r "${MODULEDIR}/background.sh" ] && source "${MODULEDIR}/background.sh"
|
||||||
# ... more modules here ...
|
# ... more modules here ...
|
||||||
|
|
||||||
# mycommands is the last "module" to source in
|
# mycommands is the last "module" to source in
|
||||||
# shellcheck source=./commands.sh
|
# shellcheck source=./commands.sh
|
||||||
[ -r "mycommands.sh" ] && source "mycommands.sh"
|
[ -r "${BASHBOT_ETC:-.}/mycommands.sh" ] && source "${BASHBOT_ETC:-.}/mycommands.sh"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -13,6 +13,19 @@ bashbot development is done on github. If you want to provide fixes or new featu
|
|||||||
5. give your (dev) fork a new version tag: ```git tag vx.xx```, version must be higher than current version
|
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)
|
6. setup github hooks by running ```dev/install-hooks.sh``` (optional)
|
||||||
|
|
||||||
|
### Test, Add, Push changes
|
||||||
|
A typical bashbot develop cycle looks as follow:
|
||||||
|
|
||||||
|
1. 'git checkout develop'
|
||||||
|
2. start developing - *change, copy, edit bashbot files ...*
|
||||||
|
3. run 'dev/all-tests.sh' - *in case if errors back to 2.*
|
||||||
|
4. run 'dev/git-add.sh' - *check for changed files, update version string, run git add*
|
||||||
|
5. 'git commit' -m "COMMIT MESSAGE"
|
||||||
|
6. 'git push'
|
||||||
|
|
||||||
|
|
||||||
|
**If you setup with hooks and use the scripts above, versioning, addding and testing is done automatically.**
|
||||||
|
|
||||||
### Versioning
|
### Versioning
|
||||||
|
|
||||||
Bashbot is tagged with version numbers. If you start a new development cycle you must tag your fork with a version higher than the current version.
|
Bashbot is tagged with version numbers. If you start a new development cycle you must tag your fork with a version higher than the current version.
|
||||||
@ -22,7 +35,6 @@ To get the current version name of your develepment fork run ```git describe --t
|
|||||||
|
|
||||||
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.
|
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
|
### Shellchecking
|
||||||
|
|
||||||
@ -32,17 +44,18 @@ In addition you can run ```dev/hooks/pre-commit.sh``` every time you want to she
|
|||||||
|
|
||||||
|
|
||||||
## bashbot tests
|
## bashbot tests
|
||||||
Starting with version 0.70 bashbot has a test suite. To start testsuite run ```test/ALL-tests.sh```. ALL-tests.sh will only return 'SUCCESS' if all tests pass.
|
Starting with version 0.70 bashbot has a test suite. To start testsuite run ```dev/all-tests.sh```. all-tests.sh will return 'SUCCESS' only if all tests pass.
|
||||||
|
|
||||||
### enabling / disabling tests
|
### enabling / disabling tests
|
||||||
|
|
||||||
All tests are placed in the directory ```test```. To disable a test remove the x flag from the '*-test.sh' test script, to (re)enable
|
All tests are placed in the directory ```test```. To disable a test remove the x flag from the '*-test.sh' test script, to (re)enable a test make the script executable again.
|
||||||
a test make the script executable again.
|
|
||||||
|
|
||||||
|
|
||||||
### creating new tests
|
### creating new tests
|
||||||
Each test consists of a script script named like ```p-name-test.sh``` *(where p is test pass 'a-z' and name the name of your test)* and
|
To create a new test run ```test/ADD-test-new.sh``` and answer the questions, afterwards you have the following described files and dirs:
|
||||||
an optional dir ```p-name-test/``` *(script name minus '.sh')* for additional files.
|
|
||||||
|
Each test consists of a script script named like ```p-name-test.sh``` *(where p is test pass 'a-z' and name the name
|
||||||
|
of your test)* and an optional dir ```p-name-test/``` *(script name minus '.sh')* for additional files.
|
||||||
|
|
||||||
The file ```ALL-tests.inc.sh``` must be included from all tests, do not forget the shellcheck source directive to statisfy shellcheck.
|
The file ```ALL-tests.inc.sh``` must be included from all tests, do not forget the shellcheck source directive to statisfy shellcheck.
|
||||||
|
|
||||||
@ -71,5 +84,5 @@ fi
|
|||||||
#### [Prev Function Reference](6_function.md)
|
#### [Prev Function Reference](6_function.md)
|
||||||
#### [Next Bashbot Environment](8_custom.md)
|
#### [Next Bashbot Environment](8_custom.md)
|
||||||
|
|
||||||
#### $$VERSION$$ v0.70-dev2-27-g2da31c1
|
#### $$VERSION$$ v0.70-dev3-8-gb8a23c4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user