TaKO8Ki / frum

A little bit fast and modern Ruby version manager written in Rust
MIT License
628 stars 15 forks source link

Fix detection of global Ruby version #111

Open bkuhlmann opened 2 years ago

bkuhlmann commented 2 years ago

Overview

After installing and upgrading to a newer version of Ruby, I'm not seeing Frum detect and automatically switch to the global version.

Steps to Recreate

  1. Install the latest version of Ruby: frum install 3.0.3.
  2. Update your global version version file: printf "%s\n" "3.0.3" > ~/.ruby-version
  3. Ask Frum to list current versions: frum versions.
  4. Notice that Frum doesn't detect what's in ~/.ruby-version and automatically update the global version to the new version. Instead, it is pointing to the previous version. See screenshot:

2021-11-24_07-50-37-iTerm2

Desired Behavior

When the global Ruby version is updated ~/.ruby-version, I would expect Frum to detect this change and update it's global alias accordingly.

The workaround for fixing this is to run frum global 3.0.3. This will manually update Frum to use the right global version but since other versions managers do this automatically for you, it'd be nice if Frum could automatically do this without having to remember to run this extra step manually.

Environment

dinshaw commented 2 years ago

Not sure if this is related or not but when I use zoxide's z instead of cd to enter into a directory with a valid .ruby-version file, frum does not auto switch. If I then cd . frum does change the ruby version.

bkuhlmann commented 2 years ago

If it helps, I can recreate this behavior on my machine too. Originally, when I wrote the above issue, I thought maybe I had misconfigured Frum but, turns out, I'm usually always using the same version of Ruby when using Zoxide to jump between Ruby projects so didn't realize the difference was between Zoxide and cd when using Frum. So cd works fine but when using z, Frum doesn't detect the direct change for some reason and update the Ruby version accordingly.