I use rbenv but other team members use RVM.
When specifying the
ruby ENV['RBENV_VERSION'] || '2.2.4'
To get the current Ruby version from any RVM instance, you can query it using this method:
rvm list default string | sed s/ruby-//
You can also use the RVM prompt tools to query the current version
rvm-prompt i v | sed s/ruby-//
rvm-prompt i v p g | sed s/ruby-//
depending on how detailed you want to allow. Docs for the
rvm-prompt command can be found in "rvm-prompt".
If the user chooses to leave RVM at its default version, you get that version reported, but if the Ruby version has been changed in RVM, you get the currently chosen version.
You can chain this in any way that
ENV['RBENV_VERSION'] is used, such as:
`rvm list default string | sed s/ruby-//` || 2.2.4
This will choose the current RVM Ruby version or 2.2.4 if RVM doesn't show a version.
Note that RVM has to exist (or at least something called
rvm has to be available as an executable). If not, an additional script wrapper may be needed to handle the situation in which it doesn't exist and degrade gracefully.
Personally, I love having it available everywhere, including production environments. It's the very first thing that I install on a new OS instance, even before the text editor, and the second thing that I do is install the appropriate Ruby version with RVM.