Support Ruby version in Gemfile

RVM can read required Ruby version from Gemfile.

But Travis ignores it.

Is it possible to add the support for it?

We do not fetch Gemfile when we receive the build request, only .travis.yml. So .travis.yml has to instruct us which Ruby version to use.

Well, this is not entirely accurate. You can use .ruby-version.

Actually I discovered that I can add Ruby version to Gemfile while troubleshooting the problem with .ruby-version.

If Ruby version is not specified explicitly, why not let RVM choose Ruby version like it does locally? Then it will not be necessary to maintain additional integration code.

I believe this default command prevents rvm from looking into Gemfile.

$ rvm use default

If it can be replaced with command that triggers default rvm behavior, then in presence of .ruby-version the following will be unnecessary too.

rvm use $(< .ruby-version) --install --binary --fuzzy

No, RVM shell integration is responsible for automatic version switch when you work locally. It overrides cd:

$ git clone
$ cd dpl/
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/vmuser/dpl/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

Unknown ruby interpreter version (do not know how to handle): >=2.2.
$ declare -f cd
cd () 
    __zsh_like_cd cd "$@"
$ grep ~ -rFe __zsh_like_cd
/home/vmuser/.rvm/src/rvm/scripts/extras/bash_zsh_support/chpwd/ __zsh_like_cd()
1 Like

Is it possible to call rvm to just detect the version?

From what I can see, you can

source "$(dirname "$(which rvm)")/../scripts/rvm"

and it will autodetect the version.