Skip to content

Conversation

CaiqueMitsuoka
Copy link

Adding support for release candidate versions of elixir.
A quick way to get all of them asdf list-all elixir | grep -v "otp\|master\|main".
From hexdocs elixir adopted the pattern of VERSION-rc.NUMBER.
The only ofender is the 1.0.0 RCs that didn't had adopted the dot.

This update cover it all.

const elixirVersion = (data) => {
	const match = /Elixir ([0-9]+\.[0-9]+\.[0-9]+(?:-rc\.?[0-9]+)?)/g.exec(data);
	return (match ? `elixir:${match.splice(1)}` : '');
};


const t1 = "Elixir 1.17.0-rc.1 (ac64fba) (compiled with Erlang/OTP 27)"
console.log(elixirVersion(t1)); // Output: "elixir:1.17.0-rc.1"

const t2 = "Elixir 1.12.2 (compiled with Erlang/OTP 24)"
console.log(elixirVersion(t2)); // Output: "elixir:1.12.2"

const t3 = "Elixir 1.0.0-rc1"
console.log(elixirVersion(t3)); // Output: "elixir:1.0.0-rc1"

const t4 = "Elixir fdsafdsa"
console.log(elixirVersion(t4)); // Output:

The 1.0.0-rc1 example don't have the "compiled with" text because at the time the command -v only printed the version and not the full build info at the time.

There is one case not supported right now which is if you are running bleeding edge elixir main branch. The -v will return 1.18.0-dev and which is a HexDoc 404, in this case we should use the version main which pull the latest main branch doc. We can do this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant