简体   繁体   English

如何使用 git hook post-receive 中的特定 rvm gemset 进行捆绑安装?

[英]How to do bundle install using specific rvm gemset from git hook post-receive?

So, I'm trying to implement a heroku-like deployment without using capistrano.所以,我试图在不使用 capistrano 的情况下实现类似 heroku 的部署。 To check and install gems I'm trying to use git hook and put the following commands in /hooks/post-receive:要检查和安装 gem,我正在尝试使用 git 挂钩并将以下命令放入 /hooks/post-receive:

bundle check || bundle install

But when I run git push I get:但是当我运行git push我得到:

remote: hooks/post-receive: line 20: bundle: command not found. 

I understand that a hook probably launches commands from the wrong environment and somehow I have to switch rvm environment from hook.我知道钩子可能会从错误的环境中启动命令,并且我必须以某种方式从钩子中切换 rvm 环境。 I tried to use rvm use 1.8.7@rails3 in post-receive but it didn't help.我尝试在 post-receive 中使用 rvm use 1.8.7@rails3 但它没有帮助。 Any ideas?有任何想法吗?

You might just have to make sure you source the user's environment at the top of the hook, for example:您可能只需要确保在钩子顶部获取用户环境,例如:

$ source $HOME/.bash_profile # single user RVM setup
$ source /etc/profile        # multi user RVM setup

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM