The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

52 lines
1.7 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. # Run a local JSON API script against a remote API server
  6. #
  7. # Usage:
  8. #
  9. # bscript script-file [options] [args]
  10. #
  11. # script-file : a JSON API script
  12. # options : script options, see bubble.main.BubbleScriptOptions (and parent classes) for more info
  13. # args : a JSON object representing arguments to the script.
  14. #
  15. # Environment variables
  16. #
  17. # BUBBLE_API : which API to use. Default is local (http://127.0.0.1:PORT, where PORT is found in .bubble.env)
  18. # BUBBLE_USER : account to use. Default is root@local.local
  19. # BUBBLE_PASS : password for account. Default is password
  20. # BUBBLE_INCLUDE : path to look for JSON include files. default value is to assume we are being run from
  21. # bubble repo, bubble-models repo, or bubble-client and use include files from minimal model.
  22. #
  23. SCRIPT="${0}"
  24. SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
  25. . "${SCRIPT_DIR}"/bubble_common
  26. BUBBLE_SERVER="$(cd "$(dirname "${0}")"/.. && pwd)"
  27. CANDIDATE_INCLUDES="
  28. ${BUBBLE_SERVER}/src/test/resources/models/minimal/tests
  29. ${BUBBLE_SERVER}/resources/models/minimal/tests
  30. ${SCRIPT_DIR}/models/minimal/tests
  31. "
  32. if [[ -z "${BUBBLE_INCLUDE}" ]] ; then
  33. for include in ${CANDIDATE_INCLUDES} ; do
  34. if [[ -d ${include} ]] ; then
  35. BUBBLE_INCLUDE="$(cd ${include} && pwd)"
  36. break
  37. fi
  38. done
  39. fi
  40. if [[ -n "${BUBBLE_INCLUDE}" ]] ; then
  41. BUBBLE_INCLUDE="-I ${BUBBLE_INCLUDE}"
  42. fi
  43. SCRIPT=${1:?no JSON script provided}
  44. shift
  45. ARGS=$(quote_args "$@")
  46. exec ${SCRIPT_DIR}/bubble script -H ${BUBBLE_INCLUDE} ${ARGS} ${SCRIPT}