Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
How to do rbenv Ruby upgrades? #3
This is not really a bug, but more of a convention that we should figure out for posterity.
I just ran into this problem with Barkeep. The issue occurs when you have a setup script that looks like this:
#!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), "terraform_dsl")) include Terraform::DSL # ... ensure_rbenv_ruby("some-version")
Then you'll have something like this in your deploy script:
This works fine when you're running the setup script for the first time, but if you ran it before and now you've updated the
My workaround in Barkeep (hacky, but very quick) was to do this in the deploy script instead:
Other things I thought of:
Any better ideas?
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
Scratch that, my workaround doesn't work. Later in the same setup script, it tries to install gems. If the script was run with the wrong Ruby, then
My current workaround is to check, in the deploy script, whether rbenv in installed and the Ruby version is not installed. In this case, I manually install the new Ruby version before running the deploy script.
See 5ba607 in the Barkeep repo to see exactly what I did.
Obviously, this is an undesirable hack.
We need to figure out a way to reconcile the fact that (a) we run the setup script using any old Ruby that happens to be on the box with (b) some steps in the setup script (notably installing gems) rely on the correct Ruby being used.