diff --git a/lib/misc_funcs.sh b/lib/misc_funcs.sh index b0b921b..73a08bf 100644 --- a/lib/misc_funcs.sh +++ b/lib/misc_funcs.sh @@ -58,7 +58,7 @@ function extract_asdf_version() { local package=$1 if [ -f $file ]; then - grep "^$package" $file | tail -n 1 | awk '{print $2}' + grep "^$package" $file | tail -n 1 | awk '{print $2}' || true fi } diff --git a/test/load_config.sh b/test/load_config.sh index 412cdb3..9605981 100755 --- a/test/load_config.sh +++ b/test/load_config.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -e +set -e -o pipefail SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" source $SCRIPT_DIR/.test_support.sh @@ -111,6 +111,20 @@ erlang_version=26.0" > $build_path/elixir_buildpack.config + test "has config file with versions and asdf file with only unrelated packages" + + echo "nodejs 22.1.0" > $build_path/.tool-versions + echo "elixir_version=1.16.2 +erlang_version=26.2.5" > $build_path/elixir_buildpack.config + + load_config > /dev/null + + [ "$erlang_version" == "26.2.5" ] + [ "$elixir_version" == "v1.16.2" ] + [ $failed == "false" ] + + + test "fixes single integer erlang versions" echo "erlang_version=25" > $build_path/elixir_buildpack.config