build.sh: Use portable function definition style

This commit is contained in:
Starbeamrainbowlabs 2019-08-08 18:14:52 +01:00
parent 71bceaa60b
commit 4c6459b70d
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,9 @@
# Changelog # Changelog
This file holds the changelog for Pepperminty Wiki. This is the master list of things that have changed (second only to the commit history!) - though the information for any particular release can also be found in the description of it's page for every release made on GitHub too. This file holds the changelog for Pepperminty Wiki. This is the master list of things that have changed (second only to the commit history!) - though the information for any particular release can also be found in the description of it's page for every release made on GitHub too.
## v0.20-dev
- Made `build.sh` build script more robust, especially when generating the documentation.
## v0.19 ## v0.19
_(No changes have been made since the last beta release.)_ _(No changes have been made since the last beta release.)_

View File

@ -49,7 +49,7 @@ fi
############################################################################### ###############################################################################
function task_setup { task_setup() {
task_begin "Checking Environment"; task_begin "Checking Environment";
check_command git true; check_command git true;
@ -72,7 +72,7 @@ function task_setup {
task_end $?; task_end $?;
} }
function task_build { task_build() {
if [ -f "./build/index.php" ]; then if [ -f "./build/index.php" ]; then
task_begin "Deleting old build result"; task_begin "Deleting old build result";
rm build/index.php; rm build/index.php;
@ -84,7 +84,7 @@ function task_build {
task_end $?; task_end $?;
} }
function task_docs { task_docs() {
task_begin "Building HTTP API Docs"; task_begin "Building HTTP API Docs";
node_modules/apidoc/bin/apidoc -o './docs/RestApi/' --config apidoc.json -f '.*\.php' -e 'index.php|ModuleApi' node_modules/apidoc/bin/apidoc -o './docs/RestApi/' --config apidoc.json -f '.*\.php' -e 'index.php|ModuleApi'
exit_code="$?"; exit_code="$?";
@ -115,7 +115,7 @@ function task_docs {
task_end $?; task_end $?;
} }
function task_docs-livereload { task_docs-livereload() {
task_begin "Listening for changes to docs"; task_begin "Listening for changes to docs";
while :; do while :; do
inotifywait -qr -e modify --format '%:e %f' ./docs/ nightdocs.toml; inotifywait -qr -e modify --format '%:e %f' ./docs/ nightdocs.toml;
@ -124,7 +124,7 @@ function task_docs-livereload {
task_end $?; task_end $?;
} }
function task_start-server { task_start-server() {
task_begin "Starting Server"; task_begin "Starting Server";
if [ -f "${server_pid_file}" ]; then if [ -f "${server_pid_file}" ]; then
task_end 1 "${FRED}${HC}Error: A development server appears to be running already. Try running the 'stop-server' task before starting it again.${RS}"; task_end 1 "${FRED}${HC}Error: A development server appears to be running already. Try running the 'stop-server' task before starting it again.${RS}";
@ -139,7 +139,7 @@ function task_start-server {
task_end $?; task_end $?;
} }
function task_stop-server { task_stop-server() {
task_begin "Stopping Server"; task_begin "Stopping Server";
kill "$(cat "${server_pid_file}")"; kill "$(cat "${server_pid_file}")";