-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Install rbenv automatically if missing #13034
Conversation
This small script addition will allow us to remove the rbenv installation from our Ansible provisioning scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
It would be nice to mention this script at https://github.com/openfoodfoundation/openfoodnetwork/blob/master/GETTING_STARTED.md?plain=1#L32
And also I think the os-specific guides could be simplified.
What if we modify this part? Lines 20 to 32 in 58c3916
If neither rbenv nor rvm are installed, we could just install rbenv. If somebody objects then they probably have the knowledge to fix this. They could add their own version manager in the setup script or just make sure that they have the right ruby version installed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Tested on my machine, all good 🟢 |
That's a great idea, it streamlines the setup even further 👍 It's perhaps worth mentioning that for Mac, rbenv recommend using the package manager. But they don't recommend it on Linux because packages are out of date. Anyways, the user can still install rbenv with a package manager if they want to. |
No. Our rbenv-install script does that for you. Well, at least it updates ruby-build to get the latest build information for new rubies. It doesn't actually update rbenv. There was one release this year and one in 2019. So really not that common but we could add a line to this script as well. |
I tested this and it didn't go so smoothly on my Mac :(
✅
The uninstaller didn't remove the old data, so I did that and tried again:
I checked, and So I had a go with rbenv-installer and it went ahead and installed it with Homebrew for me. Now that rbenv is installed, it seems to be installing ruby fine:
|
Co-authored-by: David Cook <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, so that latest update makes it work after cloning ✅
~/projects/openfoodnetwork $ script/rbenv-install.sh
Cloning into '/Users/dcook/.rbenv'...
remote: Enumerating objects: 3348, done.
remote: Counting objects: 100% (280/280), done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 3348 (delta 223), reused 168 (delta 167), pack-reused 3068 (from 2)
Receiving objects: 100% (3348/3348), 700.84 KiB | 804.00 KiB/s, done.
Resolving deltas: 100% (2071/2071), done.
skipping ~/.bash_profile: already configured for rbenv.
Cloning into '/Users/dcook/.rbenv/plugins/ruby-build'...
remote: Enumerating objects: 16604, done.
remote: Counting objects: 100% (4873/4873), done.
remote: Compressing objects: 100% (417/417), done.
remote: Total 16604 (delta 4640), reused 4591 (delta 4443), pack-reused 11731 (from 1)
Receiving objects: 100% (16604/16604), 3.21 MiB | 2.49 MiB/s, done.
Resolving deltas: 100% (11803/11803), done.
ruby-build: using openssl@3 from homebrew
==> Downloading ruby-3.1.4.tar.gz...
-> curl -q -fL -o ruby-3.1.4.tar.gz https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.4.tar.gz
Regarding the issue when rbenv isn't installed, but the ~/.rbenv/
dir still exists: I think that's probably ok and the user can decide what do to.
I never tried the uninstaller. I just move the whole directory ~/.rbenv out of the way. But for a proper test, I also removed my bash integration (PATH and init). |
What? Why?
This small script addition will allow us to remove the rbenv installation from our Ansible provisioning scripts.
Ansible has become hard to maintain and the rbenv installation caused an issue today. Somehow it didn't install Ruby with the specified jemalloc flag.
What should we test?
./script/rbenv-install.sh
to make sure it doesn't run anything unnecessarily.Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates