因此,我正在尝试在不使用 capistrano 的情况下实现类似 heroku 的部署。 为了检查和安装 gems,我尝试使用 git hook 并将以下命令放入/hooks/post-receive:
bundle check || bundle install
但是当我运行 git push
时,我得到:
remote: hooks/post-receive: line 20: bundle: command not found.
我知道 hook 可能会从错误的环境中启动命令,并且我必须以某种方式从 hook 切换 rvm 环境。我尝试在接收后使用 rvm use 1.8.7@rails3 但它没有帮助。有什么想法吗?
最佳答案
您可能只需要确保在 Hook 顶部获取用户环境,例如:
$ source $HOME/.bash_profile # single user RVM setup
$ source /etc/profile # multi user RVM setup
关于ruby-on-rails - 如何使用来自 git hook post-receive 的特定 rvm gemset 进行 bundle 安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6165960/