aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml24
-rw-r--r--bash_completion/kerl9
-rwxr-xr-xkerl38
-rw-r--r--zsh_completion/_kerl14
4 files changed, 84 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..326bbc2
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,24 @@
+os:
+ - linux
+ - osx
+
+env:
+ global:
+ - KERL_BASE_DIR="$TMPDIR"/.kerl
+ - KERL_CONFIGURE_DISABLE_APPLICATIONS="odbc"
+ matrix:
+ - _KERL_VSN=19.2
+ - _KERL_VSN=18.3
+ - _KERL_VSN=17.5
+ - _KERL_VSN=R16B03-1
+
+script:
+ - ./kerl update releases
+ - travis_wait 45 ./kerl build "$_KERL_VSN" "$_KERL_VSN"
+ - ./kerl install "$_KERL_VSN" "install_$_KERL_VSN"
+ - ./kerl status
+ - source $(./kerl path install_$_KERL_VSN)/activate
+ - erl -s crypto -s init stop
+ - kerl_deactivate
+ - ./kerl delete installation $(./kerl path install_$_KERL_VSN)
+ - ./kerl delete build "$_KERL_VSN"
diff --git a/bash_completion/kerl b/bash_completion/kerl
index 689463d..d620a4d 100644
--- a/bash_completion/kerl
+++ b/bash_completion/kerl
@@ -12,7 +12,7 @@ _kerl()
case $prev in
kerl)
- COMPREPLY=( $( compgen -W "build install update list delete active status" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "build install update list delete active path status" -- "$cur" ) )
;;
list)
COMPREPLY=( $( compgen -W "releases builds installations" -- "$cur" ) )
@@ -42,6 +42,13 @@ _kerl()
fi
COMPREPLY=( $( compgen -W "$BUILDS" -- "$cur") )
;;
+ path)
+ INSTALL_LIST="$HOME"/.kerl/otp_installations
+ if [ -f "$INSTALL_LIST" ]; then
+ NAMES=$(cut -d ' ' -f 2 "$INSTALL_LIST" | xargs basename)
+ fi
+ COMPREPLY=( $( compgen -W "$NAMES" -- "$cur") )
+ ;;
deploy)
if [ "$COMP_CWORD" -eq 3 ]; then
if [ -f "$HOME"/.kerl/otp_installations ]; then
diff --git a/kerl b/kerl
index 98cefb2..d053bd9 100755
--- a/kerl
+++ b/kerl
@@ -1229,6 +1229,11 @@ list_has()
return 1
}
+path_usage()
+{
+ echo "usage: $0 path [<install_name>]"
+}
+
list_usage()
{
echo "usage: $0 list <releases|builds|installations>"
@@ -1549,6 +1554,39 @@ case "$1" in
;;
esac
;;
+ path)
+ # Usage:
+ # kerl path
+ # # Print currently active installation path, else non-zero exit
+ # kerl path <install>
+ # Print path to installation with name <install>, else non-zero exit
+ if [ -z "$2" ]; then
+ activepath=$(get_active_path)
+ if [ -z "$activepath" ]; then
+ echo "No active kerl-managed erlang installation"
+ exit 1
+ fi
+ echo "$activepath"
+ else
+ # There are some possible extensions to this we could
+ # consider, such as:
+ # - if 2+ matches: prefer one in a subdir from $PWD
+ # - prefer $KERL_DEFAULT_INSTALL_DIR
+ match=
+ for ins in $(list_print installations | cut -d' ' -f2); do
+ if [ "$(basename $ins)" = "$2" ]; then
+ if [ -z "$match" ]; then
+ match="$ins"
+ else
+ echo "Error: too many matching installations" >&2
+ exit 2
+ fi
+ fi
+ done
+ [ -n "$match" ] && echo "$match" && exit 0
+ echo "Error: no matching installation found" >&2 && exit 1
+ fi
+ ;;
delete)
if [ $# -ne 3 ]; then
delete_usage
diff --git a/zsh_completion/_kerl b/zsh_completion/_kerl
index e58eb8b..7c9f0d6 100644
--- a/zsh_completion/_kerl
+++ b/zsh_completion/_kerl
@@ -30,6 +30,10 @@ _kerl_installations() {
installations=(${(f)"$(_call_program installations kerl list installations 2>/dev/null | cut -f 2 -d " ")"})
}
+_kerl_installnames() {
+ installnames=(${(f)"$(_call_program installations kerl list installations 2>/dev/null | cut -f 2 -d " " | xargs basename)"})
+}
+
local -a _1st_arguments
_1st_arguments=(
'build:Build specified release or git repository'
@@ -39,6 +43,7 @@ _1st_arguments=(
'list:List releases, builds and installations'
'delete:Delete builds and installations'
'active:Print the path of the active installation'
+ 'path:Print the path of any installation'
'status:Print available builds and installations'
'prompt:Print a string suitable for insertion in prompt'
'cleanup:Remove compilation artifacts (use after installation)'
@@ -96,6 +101,15 @@ case "$words[1]" in
# TODO: suggest starting location of "$KERLDIR/$(lowercase $build)"
_directories
;;
+ path)
+ _arguments \
+ '1: :->installnames' && return 0
+ if [[ "$state" == installnames ]]; then
+ _kerl_installnames
+ _wanted installnames expl '' compadd -a installnames
+ return
+ fi
+ ;;
deploy)
_arguments \
'1: :->hosts' \