diff --git a/bin/start_lexical.sh b/bin/start_lexical.sh index dee5a07ac..56eb892ec 100755 --- a/bin/start_lexical.sh +++ b/bin/start_lexical.sh @@ -1,16 +1,15 @@ #!/usr/bin/env bash set_up_version_manager() { - if [ -e $HOME/.asdf ] && asdf which elixir > /dev/null -eq 0; then + if command -v asdf > /dev/null && asdf which elixir > /dev/null 2>&1 ; then VERSION_MANAGER="asdf" - elif [ -e $HOME/.rtx ] && rtx which elixir > /dev/null -eq 0; then + elif command -v rtx > /dev/null && rtx which elixir > /dev/null 2>&1 ; then VERSION_MANAGER="rtx" else VERSION_MANAGER="none" fi } - set_up_version_manager # Start the program in the background @@ -19,7 +18,7 @@ case "$VERSION_MANAGER" in asdf env erl exec "$@" & ;; rtx) - rtx env -s bash erl exec "$@" & + eval "$(rtx env -s bash)" ;; *) ;; @@ -36,8 +35,14 @@ esac SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -export ERL_LIBS="${SCRIPT_DIR}/../lib" -"${ELIXIR_COMMAND}" -pa "${SCRIPT_DIR}/../consolidated" \ +PATH_APPEND_ARGS=$(for f in $(find ${SCRIPT_DIR}/../lib -name '*.ez') +do + lib=$(basename $f | sed -e 's/.ez//g') + echo "-pa $f/$lib/ebin" +done) + +"${ELIXIR_COMMAND}" $(echo $PATH_APPEND_ARGS) \ + -pa "${SCRIPT_DIR}/../consolidated" \ -pa "${SCRIPT_DIR}/../config/" \ -pa "${SCRIPT_DIR}/../priv/" \ --eval "LXical.Server.Boot.start" \