Closed dirschn closed 10 months ago
Thanks for taking time sharing this!
Yeah we were discussing this recently on some rbenv related pull request whether that's needed, we left it there due to not being sure. Thanks for finding the reference that it isn't needed, We can fix that with confidence now.
Alternatively, you can edit the page yourself here: https://github.com/developer-portal/content/blob/master/start/sw/web-app/rails.md , we have some related info for contributing here: https://developer-portal.github.io/contributing/
I can make the edit either later today or sometime tomorrow, if you like! I've been wanting to get into open source contributions so why not start here!
Coworker of @dirschn here, with a small gotcha. I'm observing with rbenv 1.2.0-80-gd6bb1c6
that while gem install
appears to trigger automatic rehashing, bundle
does not.
We include the following in our setup script, haven't added cli tools in a while, and strongly encourage binstub/bundle exec
usage, hence @dirschn's confusion
system('bundle check') || system!('bundle install')
system('if command -v rbenv &> /dev/null; then rbenv rehash; fi')
Since the majority of rails devs will be installing tools via bundle
, that might warrant leaving this section in for now at least (perhaps open an issue with the rbenv team to expand functionality to bundle
? and then this could be removed).
Huh, that's interesting behavior. So to get my mental notes on this straight:
The following triggers a rehash:
gem install foo-bar-with-executable
While the following command in a project with a Gemfile containing entry for gem foo-bar-with-executable
:
bundle install
will not then execute rehash and therefore foo-bar-with-executable
will not be available correctly?
I am a little bit confused as I have not yet had the need for bundler + rbenv combo,
is it regularly expected that bundle install would make foo-bar-with-executable
available on regular path with rbenv after a rehash?
A rewording or similar might be warranted though if it works for all but bundler environments.
Huh, that's interesting behavior. So to get my mental notes on this straight:
The following triggers a rehash:
gem install foo-bar-with-executable
While the following command in a project with a Gemfile containing entry for gem
foo-bar-with-executable
:bundle install
will not then execute rehash and therefore
foo-bar-with-executable
will not be available correctly?
Yes that's correct.
I am a little bit confused as I have not yet had the need for bundler + rbenv combo, is it regularly expected that bundle install would make
foo-bar-with-executable
available on regular path with rbenv after a rehash?A rewording or similar might be warranted though if it works for all but bundler environments.
So after some more investigation, I've figured out that this is in fact a bug with rbenv
- https://github.com/rbenv/rbenv/issues/1540 (i.e. there is code for automatic rehashing specifically for bundle install
, but it doesn't work).
Update: patch has been accepted and merged in rbenv/rbenv:master
so now this issue as initially described is accurate, assuming an up-to-date rbenv.
I'll caution that there hasn't been an "official" release of rbenv
in 2 years so it's likely only people who install via git will get it for a while (depending on the different package manager formulae definitions).
Thanks! I think it should now be adjusted to say to either update rbenv (with reference to either this discussion or rather the upstream PR) if pulled via git by user or state that in the other case the rehash is needed for bundler install
:)
Either way, we have an answer for whether it's needed, if any of you would manage to write something up, I'd immensely appreciate it.
I have created #498, I also fixed up the styling and whatnot on the page. If you want to, you can check the section regarding rbenv on the PR and review it.
That's my bad, it was a busy week and this slipped my mind. I'll take a look when I get home from work.
Thanks to you both, for helping with reviews, collaboration, and reporting/fixing the bug upstream. All of these contributions are very much appreciated.
I noticed today that the Ruby on Rails guide mentions
I was a little confused because I haven't manually run that command ever and haven't had any issues, so I took a look at the rbenv GitHub page and in the
rbenv rehash
section it mentions thatrbenv rehash
is run automatically when installing gems. It seems to me that there's no need to run it manually after installing new versions or gems?Apologies if I have the format of creating a new issue wrong, I couldn't find any format requirements!