Skip to content

Commit 8a550dd

Browse files
authored
Merge pull request #137 from Eiji7/patch-1
Added latest-stable script
2 parents 1a238e5 + 177d077 commit 8a550dd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

bin/latest-stable

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
# calling a script to list all elixir releases
4+
# reject releases before 1.0.0 (starting with 0)
5+
# reject main and master branches
6+
# reject releases with otp version
7+
# reject release candidates
8+
# reject empty line
9+
# finally take last one
10+
ASDF_ELIXIR_LATEST_VERSION=$(./list-all | grep -Pv "^0|^main|^master|otp|rc|^$" | tail -n 1)
11+
12+
# gets current erlang version without headers
13+
# changes spaces to new line
14+
# takes second line (Name Version Source Installed)
15+
ASDF_ELIXIR_LATEST_OTP=$(asdf current --no-header erlang | tr -s " " "\n" | sed -n 2p)
16+
17+
# Note: asdf latest does not allows latest stable version to start with number
18+
# therefore installing from source by git ref is not supported, see:
19+
# https://github.com/asdf-vm/asdf/blob/v0.16.5/internal/versions/versions.go#L276
20+
echo "$ASDF_ELIXIR_LATEST_VERSION-otp-$ASDF_ELIXIR_LATEST_OTP"

0 commit comments

Comments
 (0)