Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Add commands to install and uninstall Elixir versions #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions libexec/exenv-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
[ -n "$EXENV_DEBUG" ] && set -x

if [ -n "$1" ]; then
VERSION="$1"
else
echo "Please specify a version to install. e.g. 'exenv install 1.4.0'"
exit
fi

if [ -d "${EXENV_ROOT}/versions/${VERSION}" ]; then
echo "Elixir ${VERSION} is already installed"
else
echo "Installing Elixir ${VERSION}..."
cd "${EXENV_ROOT}/versions/"
wget https://github.com/elixir-lang/elixir/archive/v${VERSION}.zip -O "${VERSION}.zip"
unzip "${VERSION}.zip"
mv "elixir-${VERSION}" "${VERSION}"
rm "${VERSION}.zip"
cd "${VERSION}"
make clean test
exenv rehash
fi
27 changes: 27 additions & 0 deletions libexec/exenv-uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
[ -n "$EXENV_DEBUG" ] && set -x

if [ -n "$1" ]; then
VERSION="$1"
else
echo "Please specify a version to uninstall. e.g. 'exenv uninstall 1.4.0'"
exit
fi

if [ -d "${EXENV_ROOT}/versions/${VERSION}" ]; then
echo "Are you sure you want to uninstall Elixir ${VERSION}? [Yn]:"
read sure
case "${sure}" in
"Y"|"y"|"")
rm -rf "${EXENV_ROOT}/versions/${VERSION}"
exenv rehash
echo "Uninstalled Elixir ${VERSION}"
;;
*)
# Not uninstalling
;;
esac
else
echo "Elixir ${VERSION} is not installed"
fi