2023-01-09 15:19:31 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function error_handler() {
|
|
|
|
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
|
|
|
|
exit "$2"
|
|
|
|
}
|
|
|
|
trap 'error_handler ${LINENO} $?' ERR
|
|
|
|
set -o errtrace -o errexit -o nounset -o pipefail
|
|
|
|
|
2023-02-15 22:07:12 +00:00
|
|
|
if [[ -z "${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR:-}" ]]; then
|
2023-01-09 15:19:31 +00:00
|
|
|
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
|
|
|
2023-09-01 00:52:09 +00:00
|
|
|
sibling_to_arena_root="${script_dir}/../../../sample-process-models"
|
|
|
|
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="$sibling_to_arena_root"
|
2023-02-15 22:07:12 +00:00
|
|
|
if [[ ! -d "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR" ]]; then
|
2023-09-01 00:52:09 +00:00
|
|
|
sibling_to_backend_root="${script_dir}/../../sample-process-models"
|
|
|
|
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="$sibling_to_backend_root"
|
2023-02-15 22:07:12 +00:00
|
|
|
if [[ ! -d "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR" ]]; then
|
2023-09-01 00:52:09 +00:00
|
|
|
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="$sibling_to_arena_root"
|
|
|
|
process_model_clone_url="https://github.com/sartography/sample-process-models.git"
|
|
|
|
>&2 echo "could not find process model dir. cloning ${process_model_clone_url} to ${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR}"
|
|
|
|
git clone "$process_model_clone_url" "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR"
|
2023-01-09 15:19:31 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2023-02-15 22:07:12 +00:00
|
|
|
realpath "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR"
|