chruby
chruby copied to clipboard
Allow RUBIES to contain dir globs that are expanded on each run
Allow RUBIES to contain dir glob strings ("$HOME/.rubies/*") which are expanded as chruby iterates over RUBIES. This would allow chruby to see rubies that were just installed into ~/.rubies/.
Example Code
RUBIES=("/opt/rubies/*" "$HOME/.rubies/*")
for ruby in ${RUBIES[@]}; do
echo "Testing: $ruby"
if [[ -d "$ruby" ]] && [[ "$ruby" == *$1* ]]; then
echo "Found: $ruby"
exit
fi
done
Inspired by #212.
Of course this will misbehave if $HOME contains spaces.
this should work https://gist.github.com/mpapis/7ffdd6e97533f92a5cff you could shorten the read lines code:
__chruby_get_dirs()
{
# NEW LINE, BE CAREFUL
typeset IFS="
"
__dirs=( $( \cat - ) )
}
@postmodern does @mpapis's approach avoid the keyword splitting problem you were facing?
@aprescott sort of, but I want to keep $RUBIES an explicit list of directories until 1.0.0.