build: add docs task

This commit is contained in:
Starbeamrainbowlabs 2019-03-17 13:29:20 +00:00
parent 04241dc0a2
commit 3af8992a24
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

61
build
View file

@ -55,6 +55,8 @@ if [[ "$#" -lt 1 ]]; then
echo -e " ${CACTION}dev-server-stop${RS} - Stop the currently running development server"; echo -e " ${CACTION}dev-server-stop${RS} - Stop the currently running development server";
echo -e " ${CACTION}client${RS} - Build the client web app"; echo -e " ${CACTION}client${RS} - Build the client web app";
echo -e " ${CACTION}client-watch${RS} - Watch for changes to the client code & rebuild automatically"; echo -e " ${CACTION}client-watch${RS} - Watch for changes to the client code & rebuild automatically";
echo -e " ${CACTION}docs${RS} - Render the documentation";
echo -e " ${CACTION}ci${RS} - Perform CI tasks";
echo -e ""; echo -e "";
exit 1; exit 1;
@ -62,7 +64,15 @@ fi
############################################################################### ###############################################################################
function task_setup {
# ███████ ███████ ████████ ██ ██ ██████
# ██ ██ ██ ██ ██ ██ ██
# ███████ █████ ██ ██ ██ ██████
# ██ ██ ██ ██ ██ ██
# ███████ ███████ ██ ██████ ██
task_setup() {
stage_begin "Setting up"; stage_begin "Setting up";
task_begin "Checking environment"; task_begin "Checking environment";
@ -112,7 +122,7 @@ function task_setup {
stage_end $?; stage_end $?;
} }
function task_setup-dev { task_setup-dev() {
task_begin "Checking environment"; task_begin "Checking environment";
check_command mysql true optional; check_command mysql true optional;
task_end $?; task_end $?;
@ -126,7 +136,14 @@ function task_setup-dev {
task_end $?; task_end $?;
} }
function task_database {
# ██████ ███████ ██ ██
# ██ ██ ██ ██ ██
# ██ ██ █████ ██ ██
# ██ ██ ██ ██ ██
# ██████ ███████ ████
task_database() {
task_begin "Connecting to the database"; task_begin "Connecting to the database";
set-title "Database"; set-title "Database";
ssh -TN "${database_host}" -L 3306:localhost:3306 & ssh -TN "${database_host}" -L 3306:localhost:3306 &
@ -138,7 +155,7 @@ function task_database {
task_end $?; task_end $?;
} }
function task_dev-server { task_dev-server() {
task_begin "Starting development server"; task_begin "Starting development server";
php -S [::1]:40482 & php -S [::1]:40482 &
exit_code=$?; exit_code=$?;
@ -147,7 +164,7 @@ function task_dev-server {
sleep 1; sleep 1;
} }
function task_dev-server-stop { task_dev-server-stop() {
task_begin "Stopping development server"; task_begin "Stopping development server";
kill "$(cat /tmp/micro-lantern-dev-server.pid)"; kill "$(cat /tmp/micro-lantern-dev-server.pid)";
@ -157,7 +174,13 @@ function task_dev-server-stop {
} }
function task_client { # ██████ ██ ██ ███████ ███ ██ ████████
# ██ ██ ██ ██ ████ ██ ██
# ██ ██ ██ █████ ██ ██ ██ ██
# ██ ██ ██ ██ ██ ██ ██ ██
# ██████ ███████ ██ ███████ ██ ████ ██
task_client() {
task_begin "Packaging Javascript"; task_begin "Packaging Javascript";
node_modules/rollup/bin/rollup --sourcemap --config rollup.config.js; node_modules/rollup/bin/rollup --sourcemap --config rollup.config.js;
task_end $? "Error: rollup packing failed!"; task_end $? "Error: rollup packing failed!";
@ -172,7 +195,7 @@ function task_client {
# task_end $?; # task_end $?;
} }
function task_client-watch { task_client-watch() {
set-title "Client Watcher"; set-title "Client Watcher";
echo -e "Watching for changes."; echo -e "Watching for changes.";
@ -189,6 +212,30 @@ function task_client-watch {
done done
} }
# ██████ ██████ ██████ ███████
# ██ ██ ██ ██ ██ ██
# ██ ██ ██ ██ ██ ███████
# ██ ██ ██ ██ ██ ██
# ██████ ██████ ██████ ███████
task_docs() {
task_begin "Rendering docs";
node_modules/.bin/nightdocs --config nightdocs.toml;
task_end $?;
}
# ██████ ██
# ██ ██
# ██ ██
# ██ ██
# ██████ ██
task_ci() {
tasks_run setup setup-dev client docs;
}
######################################################################### #########################################################################
tasks_run $@; tasks_run $@;