-
-
Save 1stvamp/342030ba92a80597b9a39cc15be33f01 to your computer and use it in GitHub Desktop.
rbenv/jenv shims for use with asdf, specifically for exec support
This file contains 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
#!/usr/bin/env bash | |
set -e | |
if [ "$#" -gt 0 ] && [ "$1" = "shell" ] | |
then | |
shift | |
_SHIM_VERSION=${1:-$(asdf current ruby | awk '{print $1}')} | |
asdf sh-shell ruby "${_SHIM_VERSION}" | |
elif [ "$#" -gt 0 ] && [ "$1" = "version" ] | |
then | |
exec asdf --version | |
elif [ "$#" -gt 0 ] && [ "$1" = "init" ] | |
then | |
exit 0 | |
else | |
exec asdf "$@" | |
fi |
This file contains 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
#!/usr/bin/env bash | |
set -e | |
if [ "$#" -gt 0 ] && [ "$1" = "exec" ] | |
then | |
shift | |
exec asdf exec "$@" | |
elif [ "$#" -gt 0 ] && [ "$1" = "versions" ] | |
then | |
asdf list ruby | sed 's/^ *//g' | |
elif [ "$#" -gt 0 ] && [ "$1" = "shell" ] | |
then | |
shift | |
_SHIM_VERSION=${1:-$(asdf current ruby | awk '{print $1}')} | |
_ASDF_DIR=$(dirname "$(dirname "$(which asdf)")") | |
# shellcheck disable=SC1091 | |
source "${_ASDF_DIR}/asdf.sh" | |
asdf shell ruby "${_SHIM_VERSION}" | |
elif [ "$#" -gt 0 ] && [ "$1" = "version" ] | |
then | |
exec asdf --version | |
elif [ "$#" -gt 0 ] && [ "$1" = "init" ] | |
then | |
exit 0 | |
else | |
command="$1" | |
shift | |
if [ "$1" = "--skip-existing" ] | |
then | |
shift | |
fi | |
exec asdf "${command}" ruby "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment