How to get Capistrano 3 to use RVM ruby?

与世无争的帅哥 提交于 2019-12-05 15:59:43

I don't think you understand how capistrano-rvm works.

Here's the relevant code

capistrano-rvm works by figuring out the location of your RVM installation, and then prefixing your capistrano commands with the relevant mapped commands. The command-map is part of SSHKit.

Capistrano-rvm by default maps gem rake ruby bundle to an rvm-prefixed version. What this means is that whenever capistrano encounters a command, e.g. in the form of execute :bundle it will replace it with, e.g. ~/.rvm/bin/rvm 2.1.1 do bundle

You've completely side-stepped that entire mechanism in your contrived execute_interactively command that specifies the command in-line. In fact, you've completely side-stepped the beauty of capistrano as a whole by setting up your own SSH session!

Also the whole set :default_env, { rvm_bin_path: '~/.rvm/bin' } is not at all needed, that's the reason you're using the capistrano-rvm gem.


As for why cap production rvm:check is displaying system is because the term system is overloaded in this case. What you think it means in this context is "what kind of rvm setup scheme is this, a /usr/local/rvm installation or a ~/.rvm installation"

What it actually means is from this code, i.e. it checks the ruby version that's listed in RVM as the current ruby, which the default installation of ruby on a server is known as the system ruby

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!