分享 在服务器部署时默认信任 rvmrc 文件

foxzool · 2012年02月26日 · 最后由 wadexing 回复于 2013年04月17日 · 5297 次阅读

在开发中,我们通过.rvmrc 来控制当前目录的 ruby 版本。

当使用 capistrano 部署到服务器上时,由于版本控制 (git, svn) 的原因,在进入/path/to/app/current/目录时,一直会提示下面的信息来让你确认。

==============================================================================
= NOTICE                                                                     =
==============================================================================
= RVM has encountered a new or modified .rvmrc file in the current directory =
= This is a shell script and therefore may contain any shell commands.       =
=                                                                            =
= Examine the contents of this file carefully to be sure the contents are    =
= safe before trusting it! ( Choose v[iew] below to view the contents )      =
==============================================================================
Do you wish to trust this .rvmrc file? (/home/www/apps/current/.rvmrc)
y[es], n[o], v[iew], c[ancel]> n

可以通过下面的配置来解决:

编辑 rvm 配置文件(~/.rvmrc or /etc/rvmrc)

加上下面的一行

rvm_trust_rvmrcs_flag=1

这个还真不知道,学了

我都是把 rvmrc 放到 gitignore 里..

有这这个,世界会清静很多。

谢谢分享,创建了自己的 ~/.rvmrc 文件。

实际上 rvm 官方文档已经写了解决方法

#config/deploy.rb
namespace :rvm do
  task :trust_rvmrc do
    run "rvm rvmrc trust #{release_path}"
  end
end
after "deploy", "rvm:trust_rvmrc"


收藏此贴

rvm 真的很强大

我重来都不信任 .rvmrc 是个靠谱的方案,还是手动指定心里安心

谢谢分享。学习了

现在的 rvm 已经不推荐使用.rvmrc 了 rvm rvmrc to [.]ruby-version

ane 管理多个 ruby 使用不同的 rails。 提及了此话题。 04月03日 10:57
需要 登录 后方可回复, 如果你还没有账号请 注册新账号