Open webframp opened 5 years ago
Currently, chruby does use ~/.gem/$ruby/X.Y.Z instead of the ABI version. This issue has some discussion about how the RubyGems default is currently --no-env-shebang
, so gem executable shebangs are hardcoded to a specific Ruby version.
This RubyGems issue looks at changing the default to --env-shebang
, so Ruby version switchers like chruby could use the ABI version for gem locations.
This is likely something very easy that I have missed or mistaken, so please point me at old issues or docs somewhere else if so.
I currently use a combination of chruby and direnv to manage rubies alongside the embedded ruby from my installed chef workstation package. It all seems a bit convoluted to me to try and track down what's happening so I'll try to explain clearly.
On macOS I have done
ruby-install ruby-2.6.1
andbrew cask install chef/chef/chef-workstation
This gives me ruby 2.6.1 at
.rubies/ruby-2.6.1
and the embedded chef ruby at/opt/chef-workstation/embedded
which is currently ruby 2.5.3as a result my
$RUBIES
var looks like:using
chruby ruby-2.6.1
orchruby embedded
sets the wrong value for $PATH with this setup.Here I believe the correct bin path should be
~/.gem/ruby/2.6.0/bin
not~/.gem/ruby/2.6.1/bin
Again here I believe the correct bin path should be
~/.gem/ruby/2.5.0/bin
not~/.gem/ruby/2.5.3/bin
Where direnv comes into the picture is that I have defined a custom layout for the embedded chef ruby which behaves slightly differently than chruby and it seems to work consistently.
In my
~/.direnvrc
I have added:Which allows me to just add a
use chefdk
statement in any.envrc
file and it sets the correct local ruby gem bin path for that working directory.However with this in my
.direnvrc
:I do not get the same behavior but get an invalid gem bin path in my $PATH variable, the same as described about with just using chruby.
Thanks for reviewing!