Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 58 lines (54 sloc) 1.63 KB
#!/usr/bin/env sh
# choose a default before overriding
EVM_HOME="$HOME/Library/Erlang"
test -e "$HOME/.evmrc" && source "$HOME/.evmrc"
# NB: this (next) line should be handled generically by `env' now
# export PATH="$EVM_HOME/Current/tools/bin:$EVM_HOME/Current/erl_interface/bin:$PATH"
case "$1" in
'inspect')
escript `evm site`/bin/inspect $@
;;
'list')
ls -l "$EVM_HOME/Versions" | awk '/dr.*/ { print $NF }'
;;
'use')
rm -f "$EVM_HOME/Current/tools"
rm -f "$EVM_HOME/Current/erl_interface"
rm -f "$EVM_HOME/Current"
sleep 1
ln -s "$EVM_HOME/Versions/$2" "$EVM_HOME/Current"
ln -s "`find $EVM_HOME/Current/lib/erlang/lib -type d -maxdepth 1 | grep /tools-`" "$EVM_HOME/Current/tools"
ln -s "`find $EVM_HOME/Current/lib/erlang/lib -type d -maxdepth 1 | grep /erl_interface`" "$EVM_HOME/Current/erl_interface"
if [ -f "$EVM_HOME/Current/activate" ]; then
. $EVM_HOME/Current/activate
fi
;;
'info')
case "$2" in
'arch')
evm current | awk '{ print $NF }'
;;
'vsn')
evm current | awk '{ print $1 }'
;;
*)
evm current
esac
;;
'site')
echo "$EVM_HOME/Site"
;;
'env')
echo "Home: $EVM_HOME"
echo "Site Directory: $EVM_HOME/Site"
echo "Active Emulator: `evm current`"
echo "Environment:"
set | grep ERL_
;;
'current')
sh -c 'erl -eval "io:format(\"~s compiled for ~s, ~sbit~n\", [erlang:system_info(otp_release), erlang:system_info(system_architecture), integer_to_list(8 * erlang:system_info(wordsize))])" -s erlang halt -noshell'
;;
*)
echo "Usage: $0 { list | use (version) | info (arch | vsn) | site | env | current }"
;;
esac
Something went wrong with that request. Please try again.