ruby - 如何在 Makefile 中使用 rvm?

标签 ruby rvm nvm

致力于此项目:https://github.com/cucumber/bool

有一个 makefile 来构造各种项目,我想使用 RVM 能够在 ruby​​ 目录中的内容之间切换 rubies,但是,当我给出 makefile 命令来切换 rubies 时,我得到一个令人讨厌的错误

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

当然,如果我在命令行上发出rvm use 1.9.3,它就可以正常工作,所以这是其他原因的症状,但我不确定是什么。

最佳答案

当您从 cron(或我期望的 Makefile)调用 RVM 时,设置正确的环境非常重要。 Scout 团队有一篇很棒的博客文章解释了这一点:

http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production

重要的是确保您拥有完整的登录 shell,以便您可以访问 RVM。

/bin/bash -l -c 'the_command_inside_makefile"

关于ruby - 如何在 Makefile 中使用 rvm?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14675563/

相关文章:

mysql - 努力通过关系添加 has_many

ruby - 在 Ruby 脚本中需要 Ruby Gem 会中断 Cron 作业执行

ruby - rvm use 1.9.2 让我使用 ruby​​ 1.8.7

node.js - Ubuntu:Node 将不会更新到最新版本

ruby-on-rails - Rails 5 - 使用多态关联 - 呈现 View

arrays - 使用 Ruby 合并基于相似位置的数组哈希

javascript - Node.js nvm 和 npm 目录结构

javascript - PM2 没有安装最新版本的 nodejs

ruby-on-rails - Rails 4 中的命名路由助手与数组

ruby-on-rails - 使用RVM安装Ruby 1.9.2时出现Curl证书错误