Skip to content

Commit

Permalink
move ruby discovery code into a function
Browse files Browse the repository at this point in the history
When you install a new ruby in a different terminal shell,
chruby does not pick up on the new ruby version.

The solution is to to source chruby.sh again.
Introducing chruby_discover which will allow any shell to pick up on the
new ruby versions
  • Loading branch information
kbrock committed Apr 26, 2023
1 parent a543a35 commit a573a23
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions share/chruby/chruby.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
CHRUBY_VERSION="0.3.9"
RUBIES=()

for dir in "$PREFIX/opt/rubies" "$HOME/.rubies"; do
[[ -d "$dir" && -n "$(command ls -A "$dir")" ]] && RUBIES+=("$dir"/*)
done
unset dir
function chruby_discover()
{
RUBIES=()
local dir
for dir in "$PREFIX/opt/rubies" "$HOME/.rubies"; do
[[ -d "$dir" && -n "$(command ls -A "$dir")" ]] && RUBIES+=("$dir"/*)
done
}

chruby_discover

function chruby_reset()
{
Expand Down

0 comments on commit a573a23

Please sign in to comment.