kill some duplication and just go ahead and get a process model repo if there is none
This commit is contained in:
parent
5ff85b3706
commit
b60b620f16
|
@ -10,21 +10,18 @@ set -o errtrace -o errexit -o nounset -o pipefail
|
|||
if [[ -z "${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR:-}" ]]; then
|
||||
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="${script_dir}/../../../sample-process-models"
|
||||
sibling_to_arena_root="${script_dir}/../../../sample-process-models"
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="$sibling_to_arena_root"
|
||||
if [[ ! -d "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR" ]]; then
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="${script_dir}/../../sample-process-models"
|
||||
sibling_to_backend_root="${script_dir}/../../sample-process-models"
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="$sibling_to_backend_root"
|
||||
if [[ ! -d "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR" ]]; then
|
||||
>&2 echo "ERROR: Could not find a process model repo. Last tried: ${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR}. Please set SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR to the absolute path of the git repo where you want to store process models. This could be an empty git repo, or if you want you could clone https://github.com/sartography/sample-process-models.git so that spiff-arena and sample-process-models are in the same directory."
|
||||
exit 1
|
||||
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"
|
||||
fi
|
||||
fi
|
||||
|
||||
pushd "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR" >/dev/null 2>&1
|
||||
if [[ "$(git rev-parse --abbrev-ref HEAD)" == "main" ]]; then
|
||||
>&2 echo "ERROR: please do not use the main branch of sample-process-models. use dev"
|
||||
exit 1
|
||||
fi
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
realpath "$SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR"
|
||||
|
|
|
@ -10,20 +10,23 @@ set -o errtrace -o errexit -o nounset -o pipefail
|
|||
port="${SPIFFWORKFLOW_BACKEND_PORT:-7000}"
|
||||
|
||||
process_model_dir="${1:-}"
|
||||
if [[ "$process_model_dir" == "acceptance" ]]; then
|
||||
export SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA=true
|
||||
export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME=acceptance_tests.yml
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR=$(./bin/find_sample_process_models)
|
||||
elif [[ "$process_model_dir" == "localopenid" ]]; then
|
||||
export SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL="http://localhost:$port/openid"
|
||||
export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME="example.yml"
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR=$(./bin/find_sample_process_models)
|
||||
elif [[ -n "$process_model_dir" ]]; then
|
||||
|
||||
if [[ -z "${SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR:-}" ]]; then
|
||||
if [[ -n "${process_model_dir}" ]] && [[ -d "${process_model_dir}" ]]; then
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR="$process_model_dir"
|
||||
else
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR=$(./bin/find_sample_process_models)
|
||||
fi
|
||||
export SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR
|
||||
fi
|
||||
|
||||
if [[ "$process_model_dir" == "acceptance" ]]; then
|
||||
export SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA=true
|
||||
export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME=acceptance_tests.yml
|
||||
elif [[ "$process_model_dir" == "localopenid" ]]; then
|
||||
export SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL="http://localhost:$port/openid"
|
||||
export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME="example.yml"
|
||||
fi
|
||||
|
||||
if [[ -z "${SPIFFWORKFLOW_BACKEND_ENV:-}" ]]; then
|
||||
export SPIFFWORKFLOW_BACKEND_ENV=local_development
|
||||
|
|
Loading…
Reference in New Issue