Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
almirsarajcic committed Sep 18, 2024
1 parent 904a772 commit 5f341cb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 60 deletions.
32 changes: 7 additions & 25 deletions priv/static/Linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -67,7 +67,6 @@ function already_installed() {

function install() {
case "$1" in

"Elixir")
mise use -g elixir@$elixir_version
;;
Expand All @@ -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
Expand Down
31 changes: 7 additions & 24 deletions priv/static/macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
16 changes: 5 additions & 11 deletions test/scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5f341cb

Please sign in to comment.