【发布时间】:2014-07-21 16:36:48
【问题描述】:
我已经为我的项目设置了一个更新后挂钩。我有一个我推送到的裸存储库 (/var/git/myproject) 和一个运行我的应用程序的实时存储库 (/var/www/myproject)。我还加入了bundle install 和bundle exec rake db:migrate 来安装gems 和更新数据库。
以下是我的更新后挂钩
#!/bin/bash
echo "Pulling changes into Live..."
cd /var/www/myproject || exit
unset GIT_DIR
git pull origin master
# check if ruby app
if [ -f /var/www/myproject/Gemfile ];
then
echo " Ruby app detected..."
bundle install --without development test
bundle exec rake db:migrate # migrate database
fi
exec git-update-server-info
当我推送更改时,我收到以下消息(注意“找不到捆绑命令”错误):
martyn@localhost:~/www/myproject$ git push -u origin master
martyn@192.168.0.100's password:
Counting objects: 832, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (783/783), done.
Writing objects: 100% (832/832), 487.70 KiB, done.
Total 832 (delta 434), reused 0 (delta 0)
remote: Pulling changes into Live...
remote: From /var/git/myproject
remote: * branch master -> FETCH_HEAD
remote: Ruby app detected...
remote: hooks/post-update: line 13: bundle: command not found
remote: hooks/post-update: line 14: bundle: command not found
To 192.168.24.100:/var/git/myproject.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
为什么捆绑软件没有运行?我 cd 到脚本中的实时应用程序目录。当我自己在终端时,我 cd 到实时目录并运行 bundle install 它可以工作,所以捆绑就在那里。
【问题讨论】:
标签: ruby-on-rails linux git bash