Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic reshim after gem installing/uninstalling #63

Closed
AlexWayfer opened this issue May 30, 2018 · 5 comments · Fixed by #162
Closed

Automatic reshim after gem installing/uninstalling #63

AlexWayfer opened this issue May 30, 2018 · 5 comments · Fixed by #162

Comments

@AlexWayfer
Copy link

Hello!

It's weird that I should exec asdf reshim ruby after any gem installation and uninstallation.

So, I've ran bundle, which installed needed dependencies, but I can't exec rspec, for example.

Please.

@ghost
Copy link

ghost commented Jun 13, 2018

Actually, asdf-ruby is doing it for us.
I'm running Ubuntu 16.04 and I'm able to use a gem right after I've installed it.
Try to update asdf-ruby.

@AlexWayfer
Copy link
Author

I'm tired to reinstall all rubies and gems, so let's wait for #61.

@mattbrictson
Copy link

So, I've ran bundle, which installed needed dependencies, but I can't exec rspec

Agreed, I am seeing the same thing.

I have found that:

  • asdf-ruby does automatically reshim if you install a gem via gem install ...
  • it does not automatically reshim if you install gems via bundle install

Looking at the code, it appears this is because asdf-ruby has only partially implemented the solution that rbenv uses. You can see that in asdf-ruby, it hooks into gem install:

Gem.post_install do |installer|
if installer.spec.executables.any? && installer.bin_dir == Gem.default_bindir
installer.spec.executables.each do |executable|
`asdf reshim ruby #{RUBY_VERSION} bin/#{executable}`
end
end
end

But it does not hook into bundler like rbenv does here:

https://github.com/rbenv/rbenv/blob/1c772d5ff21bbee52e0c6cdf128c5cffaf8feea8/rbenv.d/exec/gem-rehash/rubygems_plugin.rb#L14-L35

@AlexWayfer
Copy link
Author

@mattbrictson nice catch! Thank you.

@hurricup
Copy link

hurricup commented Jul 8, 2019

Any updates on bundle install handling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants