| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #!/usr/bin/env bash
- set -euo pipefail
- # ensure dir
- cd -P -- "$(dirname -- "$0")/.."
- help() {
- echo
- echo "-h|--help: To display this usage info"
- echo "--ct fast|docker: Print apps which needs docker-compose to run ct"
- echo "--json: Print apps in json"
- }
- WANT_JSON='no'
- CT='novalue'
- while [ "$#" -gt 0 ]; do
- case $1 in
- -h|--help)
- help
- exit 0
- ;;
- --json)
- WANT_JSON='yes'
- shift 1
- ;;
- --ct)
- CT="$2"
- shift 2
- ;;
- *)
- echo "unknown option $1"
- exit 1
- ;;
- esac
- done
- if [ "$(./scripts/get-distro.sh)" = 'windows' ]; then
- # Otherwise windows may resolve to find.exe
- FIND="/usr/bin/find"
- else
- FIND='find'
- fi
- find_app() {
- local appdir="$1"
- "$FIND" "${appdir}" -mindepth 1 -maxdepth 1 -type d
- }
- CE="$(find_app 'apps')"
- EE="$(find_app 'lib-ee')"
- if [ "$CT" = 'novalue' ]; then
- echo -e "${CE}\n${EE}"
- exit 0
- fi
- APPS_ALL="$(echo -e "${CE}\n${EE}")"
- APPS_DOCKER_CT="$(grep -v -E '^#.*' scripts/docker-ct-apps)"
- # TODO: fix the tests!
- APPS_ALL=("${APPS_ALL[@]/"apps/emqx_auto_subscribe"}")
- # shellcheck disable=SC2068
- for app in ${APPS_DOCKER_CT[@]}; do
- APPS_ALL=("${APPS_ALL[@]/$app}")
- done
- if [ "$CT" = 'docker' ]; then
- RESULT="${APPS_DOCKER_CT}"
- else
- RESULT="${APPS_ALL[*]}"
- fi
- if [ "$WANT_JSON" = 'yes' ]; then
- echo "${RESULT}" | xargs | tr -d '\n' | jq -R -s -c 'split(" ")'
- else
- echo "${RESULT}" | xargs
- fi
|