From 9d7a397f2d07e178f8a9c066e9c9a37fe2510af3 Mon Sep 17 00:00:00 2001 From: Tomasz Marek Sulima Date: Thu, 20 Mar 2025 17:23:12 +0200 Subject: [PATCH 1/3] Added latest-stable script closes: #118 --- bin/latest-stable | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 bin/latest-stable diff --git a/bin/latest-stable b/bin/latest-stable new file mode 100644 index 0000000..193d61b --- /dev/null +++ b/bin/latest-stable @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# list all elixir releases +# reject releases before 1.0.0 (starting with 0) +# reject main and master branches +# reject releases with otp version +# reject release candidates +# finally take last one +ASDF_ELIXIR_LATEST_VERSION=$(asdf list all elixir | grep -Pv "^0|^main|^master|otp|rc|^$" | tail -n 1) + +# gets current erlang version without headers +# changes spaces to new line +# takes second line (Name Version Source Installed) +ASDF_ELIXIR_LATEST_OTP=$(asdf current --no-header erlang | tr -s " " "\n" | sed -n 2p) + +# Note: asdf latest does not allows latest stable version to start with number +# therefore installing from source by git ref is not supported, see: +# https://github.com/asdf-vm/asdf/blob/v0.16.5/internal/versions/versions.go#L276 +echo "$ASDF_ELIXIR_LATEST_VERSION-otp-$ASDF_ELIXIR_LATEST_OTP" From 0c3224f4c40ed99e65dc801948b4ff45479b60c1 Mon Sep 17 00:00:00 2001 From: Tomasz Marek Sulima Date: Fri, 21 Mar 2025 18:14:57 +0200 Subject: [PATCH 2/3] use @Stratus3D proposal to call list-all script instead of asdf binary --- bin/latest-stable | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/latest-stable b/bin/latest-stable index 193d61b..e110ca7 100644 --- a/bin/latest-stable +++ b/bin/latest-stable @@ -1,12 +1,13 @@ #!/usr/bin/env bash -# list all elixir releases +# calling a script to list all elixir releases # reject releases before 1.0.0 (starting with 0) # reject main and master branches # reject releases with otp version # reject release candidates +# reject empty line # finally take last one -ASDF_ELIXIR_LATEST_VERSION=$(asdf list all elixir | grep -Pv "^0|^main|^master|otp|rc|^$" | tail -n 1) +ASDF_ELIXIR_LATEST_VERSION=$(./list-all | grep -Pv "^0|^main|^master|otp|rc|^$" | tail -n 1) # gets current erlang version without headers # changes spaces to new line From 6769338aa3334eafa969a88f9dffbc6b2883b21c Mon Sep 17 00:00:00 2001 From: Tomasz Marek Sulima Date: Fri, 21 Mar 2025 19:25:13 +0200 Subject: [PATCH 3/3] added execute script permission --- bin/latest-stable | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/latest-stable diff --git a/bin/latest-stable b/bin/latest-stable old mode 100644 new mode 100755