Skip to content

Commit

Permalink
Create runCore script
Browse files Browse the repository at this point in the history
- Add "Run Core" run configuration for `./runCore`
- Added options `--help`, `--silent`, `--cicd`, and `--force` with aliases
- Handles both Linux/Mac and Windows paths using cygpath
  • Loading branch information
JeremyEastham committed Apr 22, 2022
1 parent 8db3c4a commit 7e5eb7e
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .idea/runConfigurations/Run_Core.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions runCore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

function cleanup {
kill %1 > /dev/null # Send exit to startTestingEnv
}

usage="Usage: runCore [--help] [--silent] [--cicd] [--force]"
silent=false
cicd=false
force=false

# Based on https://stackoverflow.com/a/33826763/11827673
while [[ "$#" -gt 0 ]]; do
case $1 in
-h|--help) echo "$usage"; exit ;;
-s|--silent) silent=true ;;
-c|--cicd) cicd=true ;;
-f|--force) force=true ;;
*) echo "Unknown parameter passed: $1"; echo "$usage"; exit 1 ;;
esac
shift
done

if [[ $force = true && -f .testEnvRunning ]]; then
[[ $silent = false ]] && echo "Removing previous testing environment..."
if [[ $cicd = true ]]; then
./utils/cleanTestEnvCicd
else
./utils/cleanTestEnvLocal
fi
fi

trap cleanup EXIT

./startTestingEnv --wait --silent & # Run in background

[[ $silent = false ]] && echo "Waiting for testing environment to start..."
until [[ -f .testEnvRunning ]]
do
sleep 1
done
[[ $silent = false ]] && echo "Test environment started!"
cp ./temp/config.yaml .
[[ $silent = false ]] && echo "Starting core..."

classpath="./core/*:./plugin-interface/*"

if which cygpath > /dev/null; then # Convert path to Windows-style if using Git Bash
classpath="$(cygpath -C ANSI -w -p "${classpath}")"
fi

java -classpath "${classpath}" io.supertokens.Main ./ DEV

0 comments on commit 7e5eb7e

Please sign in to comment.