asdf-ruby
asdf-ruby copied to clipboard
Reshim doesn't pick up new versions of Ruby
I am a frequent user of the Parity gem (https://github.com/thoughtbot/parity). The shims for these ruby commands don't seem to pick up newer versions of Ruby any longer. When running then, I get an error about the version not being included.
An example is below for the command "development":
#!/usr/bin/env bash
# asdf-plugin: ruby 2.5.8
exec /Users/home/.asdf/bin/../bin/asdf exec "development" "$@"
If I add a line # asdf-plugin: ruby 2.7.2
it works perfectly.
#!/usr/bin/env bash
# asdf-plugin: ruby 2.7.2
# asdf-plugin: ruby 2.5.8
exec /Users/home/.asdf/bin/../bin/asdf exec "development" "$@"
Is there some way to troubleshoot why asdf doesn't seem to be catching the newer versions? I've tried deleting the shims directory completely and regenerating them to no avail. It used to work fine, but a couple of months ago, this issue cropped up and hasn't resolved.
Thanks for any insight you can provide.
Could you dump what your global and local .tools-versions
is?
I am wondering if it's trying to match the shim to whatever version it thinks is set as current.
Do you have any Ruby version set in a local.ruby-version
or in Gemfile
?
Out of curiosity, is there a reason why your binary path is defined as exec /Users/home/.asdf/bin/../bin/asdf
?
local .tool-version
ruby 2.7.2
nodejs 15.3.0
yarn 1.22.10
python 3.9.0
global .tool-version
postgres 11.6
nodejs 13.14.0
ruby 2.7.2
python 3.8.5
flutter 1.17.0-stable
jq 1.6
yarn 1.22.4
ruby 2.7.2 is what I'm using and what I want. Once I add the line to the shim, it works as expected.
Ruby version is set in .ruby-version as:
ruby-2.7.2
Gemfile is:
ruby "2.7.2"
The issue I'm facing is the shims aren't being written with all the ruby versions. I've tried deleting the entire shims directory and regenerating them, etc to no avail.
Re: the odd binary path, it looks like it was a bug related to the asdf plugin for oh-my-zsh. I resolved the issue, deleted the entire shims directory, and reshim'd. The output is exactly the same:
#!/usr/bin/env bash
# asdf-plugin: ruby 2.5.8
exec /Users/home/.asdf/bin/asdf exec "production" "$@"
(I replaced my username with home)
> asdf list ruby
2.5.8
2.7.2
Can you print the output of gemenv?
Sure, thank you:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.4
- RUBY VERSION: 2.7.2 (2020-10-01 patchlevel 137) [x86_64-darwin20]
- INSTALLATION DIRECTORY: /Users/home/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /Users/home/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /Users/home/.asdf/installs/ruby/2.7.2/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /Users/home/.asdf/installs/ruby/2.7.2/bin
- SPEC CACHE DIRECTORY: /Users/home/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/home/.asdf/installs/ruby/2.7.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-20
- GEM PATHS:
- /Users/home/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0
- /Users/home/.gem/ruby/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/home/.asdf/installs/ruby/2.7.2/bin
- /usr/local/opt/bison/bin
- /Users/home/.asdf/shims
- /Users/home/.asdf/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/share/dotnet
- ~/.dotnet/tools
- /Library/Apple/usr/bin
- /Library/Frameworks/Mono.framework/Versions/Current/Commands
- /Users/home/Dev/duckworth/node_modules/.bin
- /Users/home/.android/tools/bin
I am also seeing this issue
@jsmestad just so we're clear on the scope, is this with Parity, or another gem? Trying to get a better idea of what the issue might be.
I am hitting this in two spots the last couple days. One was with rails
actually. Uninstalling rails 6.1 and installing rails 6.0, the asdf reshim
did not pick up the older version and regenerate properly.
Another case this morning installing a ruby version actually. ASDF would not generate the version entry in the ~/.asdf/shims/ruby
file even though asdf list ruby
showed the version was installed. Workaround was to asdf uninstall ruby 3.0.1
and then asdf install ruby 3.0.1
to get it going.
I hit something similar when I uninstalled and then reinstalled ruby 2.5.8. When I went to run bundle install I got an error message complaining about version 2.5.8 not existing even though .tool-versions states that as the version and asdf info had that showing as installed.
The problem was actually that I needed to install bundler again as it was removed when I uninstalled ruby 2.5.8. However the error message did not state that the command bundle
was unrecognized, it stated that the version of ruby was not installed and either should be installed or that I should set a different version in .tool-versions.
I also am seeing this issue
I'm having a similar issue here. Is there any updated solution?
I'm having a similar issue here on my mac. Is there any updated solution?
I think the issue here is that the gemspec doesn't mention bindir
. Without this setting no binary is installed into .asdf/install/ruby/$VERSION/bin
. I added a workaround in #378 wich adds .asdf/install/ruby/$VERSION/lib/ruby/gems/$VERSION/bin
to the paths where reshim
is lookin.