From 5f341cb4a3220e6c0ccc7d8b7044e956b013e9ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Almir=20Saraj=C4=8Di=C4=87?= Date: Wed, 18 Sep 2024 15:59:50 +0200 Subject: [PATCH] Try again --- priv/static/Linux.sh | 32 +++++++------------------------- priv/static/macOS.sh | 31 +++++++------------------------ test/scripts/Makefile | 16 +++++----------- 3 files changed, 19 insertions(+), 60 deletions(-) diff --git a/priv/static/Linux.sh b/priv/static/Linux.sh index 9122d751..58ebc728 100755 --- a/priv/static/Linux.sh +++ b/priv/static/Linux.sh @@ -44,19 +44,19 @@ esac function already_installed() { case "$1" in "Elixir") - which elixir >/dev/null 2>&1 + mise which elixir >/dev/null 2>&1 ;; "Erlang") - command -v erl >/dev/null 2>&1 + mise which erl >/dev/null 2>&1 ;; "mise") which mise >/dev/null 2>&1 ;; "Phoenix") - mix phx.new --version >/dev/null 2>&1 + mise exec mix phx.new --version >/dev/null 2>&1 ;; "PostgreSQL") - which initdb >/dev/null 2>&1 + mise which initdb >/dev/null 2>&1 ;; *) echo "Invalid name argument on checking: $1" @@ -67,7 +67,6 @@ function already_installed() { function install() { case "$1" in - "Elixir") mise use -g elixir@$elixir_version ;; @@ -76,38 +75,21 @@ function install() { ;; "mise") curl https://mise.run | sh - - previous_path=$(pwd) - cd ~ - echo -e "\n\n" >>$config_file case $current_shell in "bash" | "rbash") echo "eval \"\$(~/.local/bin/mise activate bash)\"" >>$config_file - eval "$(~/.local/bin/mise hook-env -s bash)" ;; "zsh") echo "eval \"\$(~/.local/bin/mise activate zsh)\"" >>$config_file - eval "$(~/.local/bin/mise hook-env -s zsh)" - ;; - *) - echo "Unsupported shell: $current_shell" - exit 1 ;; esac - - echo "--- Debug $config_file ---" - cat $config_file - echo "--- End debug $config_file ---" - echo "PATH: $PATH" - - cd $previous_path ;; "Phoenix") - mix local.hex --force - mix local.rebar --force - mix archive.install --force hex phx_new $phoenix_version + mise exec mix local.hex --force + mise exec mix local.rebar --force + mise exec mix archive.install --force hex phx_new $phoenix_version ;; "PostgreSQL") sudo apt-get update diff --git a/priv/static/macOS.sh b/priv/static/macOS.sh index 56fdfcd1..36a986a3 100755 --- a/priv/static/macOS.sh +++ b/priv/static/macOS.sh @@ -44,10 +44,10 @@ esac function already_installed() { case "$1" in "Elixir") - which elixir >/dev/null 2>&1 + mise which elixir >/dev/null 2>&1 ;; "Erlang") - command -v erl >/dev/null 2>&1 + mise which erl >/dev/null 2>&1 ;; "Homebrew") which brew >/dev/null 2>&1 @@ -56,10 +56,10 @@ function already_installed() { which mise >/dev/null 2>&1 ;; "Phoenix") - mix phx.new --version >/dev/null 2>&1 + mise exec mix phx.new --version >/dev/null 2>&1 ;; "PostgreSQL") - which pg_ctl >/dev/null 2>&1 + mise which initdb >/dev/null 2>&1 ;; "Xcode Command Line Tools") which xcode-select >/dev/null @@ -84,38 +84,21 @@ function install() { ;; "mise") curl https://mise.run | sh - - previous_path=$(pwd) - cd ~ - echo -e "\n\n" >>$config_file case $current_shell in "bash" | "rbash") echo "eval \"\$(~/.local/bin/mise activate bash)\"" >>$config_file - eval "$(~/.local/bin/mise hook-env -s bash)" ;; "zsh") echo "eval \"\$(~/.local/bin/mise activate zsh)\"" >>$config_file - eval "$(~/.local/bin/mise hook-env -s zsh)" - ;; - *) - echo "Unsupported shell: $current_shell" - exit 1 ;; esac - - echo "--- Debug $config_file ---" - cat $config_file - echo "--- End debug $config_file ---" - echo "PATH: $PATH" - - cd $previous_path ;; "Phoenix") - mix local.hex --force - mix local.rebar --force - mix archive.install --force hex phx_new $phoenix_version + mise exec mix local.hex --force + mise exec mix local.rebar --force + mise exec mix archive.install --force hex phx_new $phoenix_version ;; "PostgreSQL") brew install gcc readline zlib curl ossp-uuid diff --git a/test/scripts/Makefile b/test/scripts/Makefile index be5471e3..7e4ac963 100644 --- a/test/scripts/Makefile +++ b/test/scripts/Makefile @@ -4,15 +4,9 @@ SHELL := $(shell echo $$SHELL) .SHELLFLAGS := -eu -c serve: - @if [[ "$$SHELL" == *"bash"* ]]; then \ - eval "$$(~/.local/bin/mise hook-env -s bash)"; \ - elif [[ "$$SHELL" == *"zsh"* ]]; then \ - eval "$$(~/.local/bin/mise hook-env -s zsh)"; \ - fi - - initdb -D ~/pgdata -U postgres - pg_ctl start -D ~/pgdata - mix phx.new --no-install phx_tools_test + mise exec initdb -D ~/pgdata -U postgres + mise exec pg_ctl start -D ~/pgdata + mise exec mix phx.new --no-install phx_tools_test cd phx_tools_test - mix setup - elixir --erl '-detached' -S mix phx.server + mise exec mix setup + mise exec elixir --erl '-detached' -S mix phx.server