fix make-standalone, add html doc to it

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-06-20 17:30:03 +02:00
parent 0b8c0476db
commit cac1ea44c2
3 changed files with 33 additions and 11 deletions

View File

@ -2,7 +2,7 @@
# file: make-distribution.sh
# creates files and arcchives to dirtribute bashbot
#
#### $$VERSION$$ v0.96-0-g3871ca9
#### $$VERSION$$ v0.98-dev-63-g0b8c047
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -33,10 +33,13 @@ done
# create dir for distribution and copy files
mkdir -p "${DISTDIR}" 2>/dev/null
# shellcheck disable=SC2086
echo "Copy files"
# shellcheck disable=SC2086
cp -r ${DISTFILES} "${DISTDIR}"
cd "${DISTDIR}" || exit 1
# do not overwrite on update
echo "Create .dist files"
for file in mycommands.sh bashbot.rc addons/*.sh
do
[ "${file}" = "addons/*.sh" ] && continue
@ -44,6 +47,7 @@ do
done
# dwonload JSON.sh
echo "Inject JSON.sh"
JSONSHFILE="JSON.sh/JSON.sh"
if [ ! -f "${JSONSHFILE}" ]; then
mkdir "JSON.sh" 2>/dev/null
@ -52,17 +56,17 @@ if [ ! -f "${JSONSHFILE}" ]; then
fi
# make html doc
mkdir html 2>/dev/null
cp README.html html/index.html
find doc -iname "*.md" -type f -exec sh -c 'pandoc -s -f commonmark -M "title=Bashobot Documentation - ${0%.md}.html" "${0}" -o "./html/$(basename ${0%.md}.html)"' {} \;
find examples -iname "*.md" -type f -exec sh -c 'pandoc -s -f commonmark -M "title=Bashobot Documentation - ${0%.md}.html" "${0}" -o "${0%.md}.html"' {} \;
find README.html html examples -iname "*.html" -type f -exec sh -c 'sed -i -E "s/href=\"(\.\.\/)*doc\//href=\"\1html\//g;s/href=\"(.*).md(#.*)*\"/href=\"\1.html\"/g" ${0}' {} \;
echo "Create html doc"
#shellcheck disable=SC1090
source "$GIT_DIR/../dev/make-html.sh"
# create archive
cd .. || exit 1
echo "Create dist archives"
zip -rq "${DISTNAME}-${VERSION}.zip" "${DISTNAME}"
tar -czf "${DISTNAME}-${VERSION}.tar.gz" "${DISTNAME}"
echo "Done!"
# shellcheck disable=SC2086
ls -ld ${DISTNAME}-${VERSION}.*

13
dev/make-html.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
if [ ! -f README.html ]; then
echo "This script must run where README.html is!" && exit 1
fi
# make html doc
mkdir html 2>/dev/null
cp README.html html/index.html
find doc -iname "*.md" -type f -exec sh -c 'pandoc -s -f commonmark -M "title=Bashobot Documentation - ${0%.md}.html" "${0}" -o "./html/$(basename ${0%.md}.html)"' {} \;
find examples -iname "*.md" -type f -exec sh -c 'pandoc -s -f commonmark -M "title=Bashobot Documentation - ${0%.md}.html" "${0}" -o "${0%.md}.html"' {} \;
find README.html html examples -iname "*.html" -type f -exec sh -c 'sed -i -E "s/href=\"(\.\.\/)*doc\//href=\"\1html\//g;s/href=\"(.*).md(#.*)*\"/href=\"\1.html\"/g" ${0}' {} \;

View File

@ -5,7 +5,7 @@
# If you your bot is finished you can use make-standalone.sh to create the
# the old all-in-one bashbot: bashbot.sh and commands.sh only!
#
#### $$VERSION$$ v0.96-0-g3871ca9
#### $$VERSION$$ v0.98-dev-63-g0b8c047
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -18,7 +18,7 @@ fi
#DISTNAME="telegram-bot-bash"
DISTDIR="./STANDALONE/${DISTNAME}"
DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules LICENSE README.txt token count botacl botadmin"
DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules LICENSE README.* doc botacl botconfig.jssh"
# run pre_commit on files
dev/hooks/pre-commit.sh
@ -38,7 +38,7 @@ echo " ... create unified commands.sh"
{
# first head of commands.sh
sed -n '0,/^if / p' commands.sh | head -n -2 | grep -v 'mycommands.sh'
sed -n '0,/^if / p' commands.sh | head -n -2
# then mycommands from first non comment line on
printf '\n##############################\n# my commands starts here ...\n'
@ -46,7 +46,7 @@ echo " ... create unified commands.sh"
# last tail of commands.sh
printf '\n##############################\n# default commands starts here ...\n'
sed -n '/\/mycommands.sh"/,$ p' commands.sh | tail -n +2
sed -n '/source .*\/mycommands.sh"/,$ p' commands.sh | tail -n +2
} >>$$commands.sh
@ -79,10 +79,15 @@ sed -E -e '/(shellcheck)|(#!\/bin\/bash)/! s/^[[:space:]]*#.*//' -e 's/^[[:space
sed -E -e '/(shellcheck)|(#!\/bin\/bash)/! s/^[[:space:]]*#.*//' -e 's/^[[:space:]]*//' -e '/^$/d' commands.sh > commands.sh.min
chmod +x bashbot.sh.min
# make html doc
echo "Create html doc"
#shellcheck disable=SC1090
source "$GIT_DIR/../dev/make-html.sh"
echo "Done!"
cd .. || exit 1
echo -e "\\nStandalone bashbot files are now availible in \"${DISTDIR}\":\\n"
ls -l "${DISTDIR}"*
ls -l "${DISTDIR}"