ajust develop and environmen doc

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-04-26 11:17:42 +02:00
parent b8a23c4553
commit d08d581312
3 changed files with 32 additions and 18 deletions

View File

@ -12,7 +12,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.70-dev3-5-g8b8da67
#### $$VERSION$$ v0.70-dev3-8-gb8a23c4
#
# Exit Codes:
# - 0 sucess (hopefully)
@ -34,9 +34,10 @@ fi
# get location and name of bashbot.sh
SCRIPT="$0"
SCRIPTDIR="$(dirname "$0")"
RUNDIR="${BASHBOT_VAR:-${SCRIPTDIR}}"
[ "${RUNDIR}" = "${SCRIPTDIR}" ] && SCRIPT="./$(basename "${SCRIPT}")"
MODULEDIR="${SCRIPTDIR}/modules"
RUNDIR="${SCRIPTDIR}"
[ "${RUNDIR}" = "${SCRIPTDIR}" ] && SCRIPT="./$(basename "${SCRIPT}")"
RUNUSER="${USER}" # USER is overwritten by bashbot array
@ -115,9 +116,7 @@ elif [ ! -w "${COUNTFILE}" ]; then
exit 2
fi
COMMANDS="${BASHBOT_COMMANDS:-${RUNDIR}/commands.sh}"
[[ "${COMMANDS}" != *".sh" ]] && echo -e "${RED}ERROR: \"${COMMANDS}\" ends not with \".sh\".${NC}" && exit 3
COMMANDS="${BASHBOT_ETC:-.}/commands.sh"
if [ "$1" != "source" ]; then
if [ ! -f "${COMMANDS}" ] || [ ! -r "${COMMANDS}" ]; then
${CLEAR}

View File

@ -5,7 +5,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.70-dev2-27-g2da31c1
#### $$VERSION$$ v0.70-dev3-8-gb8a23c4
#
# shellcheck disable=SC2154
# 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)
'
# load additional modules
[ -r "modules/aliases.sh" ] && source "modules/aliases.sh"
[ -r "modules/background.sh" ] && source "modules/background.sh"
# load modules
# shellcheck source=./modules/aliases.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 ...
# mycommands is the last "module" to source in
# shellcheck source=./commands.sh
[ -r "mycommands.sh" ] && source "mycommands.sh"
[ -r "${BASHBOT_ETC:-.}/mycommands.sh" ] && source "${BASHBOT_ETC:-.}/mycommands.sh"
fi

View File

@ -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
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
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.
If you actived git hooks in Setup step 6, 'version.sh' updates the version name on every push
### Shellchecking
@ -32,17 +44,18 @@ In addition you can run ```dev/hooks/pre-commit.sh``` every time you want to she
## 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
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.
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.
### 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
an optional dir ```p-name-test/``` *(script name minus '.sh')* for additional files.
To create a new test run ```test/ADD-test-new.sh``` and answer the questions, afterwards you have the following described files and dirs:
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.
@ -71,5 +84,5 @@ fi
#### [Prev Function Reference](6_function.md)
#### [Next Bashbot Environment](8_custom.md)
#### $$VERSION$$ v0.70-dev2-27-g2da31c1
#### $$VERSION$$ v0.70-dev3-8-gb8a23c4