Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # requires that you use "set :deploy_via, :remote_cache" in deploy.rb
- while read oldrev newrev ref
- do
- if [ "$ref" = "refs/heads/master" ] ; then
- echo "Master branch pushed, deploying to staging"
- # seams to be set to "." for hooks, unset to make things more normal
- unset GIT_DIR
- # deploy path, where "current", "releases", "shared" etc are
- DEPLOYDIR="/home/user/deploy/staging"
- # default path for :deploy_via :remote_cache is shared/cached-copy
- cd "$DEPLOYDIR/shared/cached-copy"
- # update cache to pushed revision, will be done by capistrano too
- git fetch origin && git fetch --tags origin && git reset --hard "$newrev"
- # load rvm
- source ~/.rvm/scripts/rvm
- rvm use 1.9.2
- # make sure we have a .bundle directory to make bundle exec happy.
- # lend the one from current deployed version
- cp -a "$DEPLOYDIR/current/.bundle" .
- # run capistrano
- # if you use deploy:migrations instead of deploy you should probably add
- # after "deploy:migrations", "deploy:cleanup"
- # to your deploy.rb
- bundle exec cap staging deploy:migrations
- fi
- done
Add Comment
Please, Sign In to add comment