Created
April 21, 2015 07:35
-
-
Save gildas/35adc856cfa949d2e085 to your computer and use it in GitHub Desktop.
use real vagrant outside of gemset in shim
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 | |
[ -n "$RBENV_DEBUG" ] && set -x | |
program="${0##*/}" | |
if [ "$program" = "ruby" ]; then | |
for arg; do | |
case "$arg" in | |
-e* | -- ) break ;; | |
*/* ) | |
if [ -f "$arg" ]; then | |
export RBENV_DIR="${arg%/*}" | |
break | |
fi | |
;; | |
esac | |
done | |
fi | |
# if vagrant is part of a gemset and we are not in any subfolder, use the standard vagrant | |
ruby_version="$(rbenv version)" | |
if [[ -z "$(rbenv gemset list | grep "${ruby_version%% *}")" ]]; then | |
/opt/vagrant/bin/vagrant "$@" | |
else | |
export RBENV_ROOT="/Users/gildas/.config/rbenv" | |
exec "/usr/local/Cellar/rbenv/0.4.0/libexec/rbenv" exec "$program" "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not perfect yet:
That's a start shall we say.