Skip to content

Switched over to mise rather than rtx #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apps/remote_control/lib/lexical/remote_control.ex
Original file line number Diff line number Diff line change
@@ -80,6 +80,7 @@ defmodule Lexical.RemoteControl do

{path_result, env} =
with nil <- version_manager_path_and_env("asdf", root_path),
nil <- version_manager_path_and_env("mise", root_path),
nil <- version_manager_path_and_env("rtx", root_path) do
{File.cd!(root_path, fn -> System.find_executable("elixir") end), System.get_env()}
end
@@ -153,4 +154,25 @@ defmodule Lexical.RemoteControl do
end)
|> Enum.reject(&is_nil/1)
end

defp reset_env("mise", root_path) do
{env, _} = System.cmd("mise", ~w(env -s bash), cd: root_path)

env
|> String.trim()
|> String.split("\n")
|> Enum.map(fn
"export " <> key_and_value ->
[key, value] =
key_and_value
|> String.split("=", parts: 2)
|> Enum.map(&String.trim/1)

{key, value}

_ ->
nil
end)
|> Enum.reject(&is_nil/1)
end
end
14 changes: 7 additions & 7 deletions integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@
# Build: docker build -t lx -f integration/Dockerfile .
# Run: docker run -it lx

ARG SYS_ELIXIR_VERSION=1.15.6
ARG SYS_ERLANG_VERSION=26.1.1
ARG SYS_ELIXIR_VERSION=1.15.7
ARG SYS_ERLANG_VERSION=26.2.1

FROM hexpm/elixir:${SYS_ELIXIR_VERSION}-erlang-${SYS_ERLANG_VERSION}-ubuntu-jammy-20230126
FROM hexpm/elixir:${SYS_ELIXIR_VERSION}-erlang-${SYS_ERLANG_VERSION}-ubuntu-jammy-20231128

ENV ELIXIR_VERSION=1.15.6-otp-26
ENV ERLANG_VERSION=26.1.1
ENV ELIXIR_VERSION=1.15.7-otp-26
ENV ERLANG_VERSION=26.2.1

RUN apt-get update
RUN apt-get install -y \
@@ -24,8 +24,8 @@ RUN apt-get install -y \

WORKDIR /lexical

COPY integration/boot/set_up_rtx.sh integration/boot/set_up_rtx.sh
RUN integration/boot/set_up_rtx.sh
COPY integration/boot/set_up_mise.sh integration/boot/set_up_mise.sh
RUN integration/boot/set_up_mise.sh

COPY integration/boot/set_up_asdf.sh integration/boot/set_up_asdf.sh
RUN integration/boot/set_up_asdf.sh
34 changes: 34 additions & 0 deletions integration/boot/set_up_mise.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -eo pipefail

mise_dir=/version_managers/mise_vm
mkdir -p $mise_dir && cd $mise_dir

# Download the mise binary for the correct architecture
arch=$(uname -m)
architecture=""

case $arch in
"x86_64")
architecture="x64"
;;
"aarch64")
architecture="arm64"
;;
*)
echo "Unsupported architecture: $arch"
exit 1
;;
esac

curl "https://mise.jdx.dev/mise-latest-linux-$architecture" >"$(pwd)/mise"
chmod +x ./mise

eval "$(./mise activate bash)"

export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --without-termcap --without-wx"
./mise plugin install -y erlang
./mise use --global "erlang@$ERLANG_VERSION"

./mise plugins install -y elixir
./mise use --global "elixir@$ELIXIR_VERSION"
34 changes: 0 additions & 34 deletions integration/boot/set_up_rtx.sh

This file was deleted.

28 changes: 14 additions & 14 deletions integration/test.sh
Original file line number Diff line number Diff line change
@@ -94,11 +94,11 @@ test_asdf_dir_found() {
return $?
}

test_asdf_used_when_activated_rtx_missing_elixir() {
test_asdf_used_when_activated_mise_missing_elixir() {
local setup=(
'mv "$(which elixir)" "$(which elixir).hidden" && '
'eval "$(/version_managers/rtx_vm/rtx activate bash)" && '
'rtx uninstall "elixir@$ELIXIR_VERSION" && '
'eval "$(/version_managers/mise_vm/mise activate bash)" && '
'mise uninstall "elixir@$ELIXIR_VERSION" && '
'export ASDF_DIR=/version_managers/asdf_vm'
)
local expect=(
@@ -111,45 +111,45 @@ test_asdf_used_when_activated_rtx_missing_elixir() {
return $?
}

test_rtx_already_activated() {
test_mise_already_activated() {
local setup=(
'mv "$(which elixir)" "$(which elixir).hidden" && '
'eval "$(/version_managers/rtx_vm/rtx activate bash)"'
'eval "$(/version_managers/mise_vm/mise activate bash)"'
)
local expect=(
"Detected Elixir through rtx"
"Detected Elixir through mise"
)

run_test "${setup[*]}" "${expect[@]}"
return $?
}

test_rtx_binary_found_and_activated() {
test_mise_binary_found_and_activated() {
local setup=(
'mv "$(which elixir)" "$(which elixir).hidden" && '
'export PATH="/version_managers/rtx_vm:$PATH"'
'export PATH="/version_managers/mise_vm:$PATH"'
)
local expect=(
"No activated version manager detected"
"Found rtx"
"Detected Elixir through rtx"
"Found mise"
"Detected Elixir through mise"
)

run_test "${setup[*]}" "${expect[@]}"
return $?
}

test_rtx_used_when_activated_asdf_missing_elixir() {
test_mise_used_when_activated_asdf_missing_elixir() {
local setup=(
'mv "$(which elixir)" "$(which elixir).hidden" && '
'ASDF_DIR=/version_managers/asdf_vm . /version_managers/asdf_vm/asdf.sh && '
'asdf uninstall elixir "$ELIXIR_VERSION" && '
'export PATH="/version_managers/rtx_vm:$PATH"'
'export PATH="/version_managers/mise_vm:$PATH"'
)
local expect=(
"No activated version manager detected"
"Found rtx. Activating"
"Detected Elixir through rtx"
"Found mise. Activating"
"Detected Elixir through mise"
)

run_test "${setup[*]}" "${expect[@]}"