Skip to content

Commit b1887f7

Browse files
authored
Merge pull request #6 from gigalixir/fix-handle-tool-versions-with-no-versions
fix: handle when tool-versions does not contain either version
2 parents cdbba3d + bc3c1ef commit b1887f7

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

lib/misc_funcs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function extract_asdf_version() {
5858
local package=$1
5959

6060
if [ -f $file ]; then
61-
grep "^$package" $file | tail -n 1 | awk '{print $2}'
61+
grep "^$package" $file | tail -n 1 | awk '{print $2}' || true
6262
fi
6363
}
6464

test/load_config.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -e -o pipefail
44

55
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
66
source $SCRIPT_DIR/.test_support.sh
@@ -111,6 +111,20 @@ erlang_version=26.0" > $build_path/elixir_buildpack.config
111111

112112

113113

114+
test "has config file with versions and asdf file with only unrelated packages"
115+
116+
echo "nodejs 22.1.0" > $build_path/.tool-versions
117+
echo "elixir_version=1.16.2
118+
erlang_version=26.2.5" > $build_path/elixir_buildpack.config
119+
120+
load_config > /dev/null
121+
122+
[ "$erlang_version" == "26.2.5" ]
123+
[ "$elixir_version" == "v1.16.2" ]
124+
[ $failed == "false" ]
125+
126+
127+
114128
test "fixes single integer erlang versions"
115129

116130
echo "erlang_version=25" > $build_path/elixir_buildpack.config

0 commit comments

Comments
 (0)