Last active
August 29, 2015 14:21
-
-
Save christophermaier/de7e9905ca4fcc4afe20 to your computer and use it in GitHub Desktop.
Setting up Kerl with ZSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KERL_DOWNLOAD_DIR=$KERL_BASE_DIR/archives | |
KERL_BUILD_DIR=$KERL_BASE_DIR/builds | |
KERL_DEFAULT_INSTALL_DIR=$KERL_BASE_DIR/installs | |
KERL_INSTALL_MANPAGES=1 | |
KERL_INSTALL_HTMLDOCS=1 | |
KERL_ENABLE_PROMPT= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Kerl Setup | |
# git clone https://github.com/yrashk/kerl ~/src/kerl | |
KERL_SRC=~/src/kerl | |
DEFAULT_KERL_INSTALLATION=17.5 | |
chmod a+x ${KERL_SRC}/kerl | |
path=($path ${KERL_SRC}) | |
chmod a+x ${KERL_SRC}/zsh_completion/_kerl | |
fpath=($fpath ${KERL_SRC}/zsh_completion) | |
if [ -d ~/.kerl/installs/${DEFAULT_KERL_INSTALLATION} ] | |
then | |
source ~/.kerl/installs/${DEFAULT_KERL_INSTALLATION}/activate | |
fi | |
autoload -U compinit | |
compinit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
RELEASES=(17.5 17.4 17.3 17.1) | |
kerl_installation_dir() { | |
BUILD_NAME=$1 | |
kerl list installations | awk '/'${BUILD_NAME}'/{print $2}' | |
} | |
kerl_build_exists() { | |
RELEASE_CODE=$1 | |
BUILD_NAME=$2 | |
kerl list builds | grep "${RELEASE_CODE},${BUILD_NAME}" 1>/dev/null | |
} | |
build_and_install() { | |
RELEASE_CODE=$1 | |
BUILD_NAME=$2 | |
if kerl_build_exists ${RELEASE_CODE} ${BUILD_NAME} | |
then | |
echo "Build '${BUILD_NAME}' of OTP release ${RELEASE_CODE} is already built" | |
else | |
kerl build ${RELEASE_CODE} ${BUILD_NAME} | |
fi | |
KERL_INSTALLATION_DIR=`kerl_installation_dir ${BUILD_NAME}` | |
if [ -d "$KERL_INSTALLATION_DIR" ] | |
then | |
echo "Build '${BUILD_NAME}' of OTP release ${RELEASE_CODE} is already installed" | |
else | |
kerl install ${BUILD_NAME} | |
fi | |
} | |
kerl update releases 1>/dev/null | |
for RELEASE_CODE in "${RELEASES[@]}" | |
do | |
BUILD_NAME=$RELEASE_CODE | |
build_and_install ${RELEASE_CODE} ${BUILD_NAME} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment