Skip to content

Instantly share code, notes, and snippets.

@murtuzakz
Last active August 29, 2015 14:06
Show Gist options
  • Save murtuzakz/b32a708f9894c48ca857 to your computer and use it in GitHub Desktop.
Save murtuzakz/b32a708f9894c48ca857 to your computer and use it in GitHub Desktop.
Heroku ish Post Recive Hook
#!/bin/sh
# This checks out the code into remoteFolderWithCode after the bare repo gets the push.
git --work-tree=/var/www/remoteFolderWithCode --git-dir=/var/repo/RemoteBare.git checkout -f
cd /var/www/remoteFolderWithCode
# Detects its a Ruby app due to the presence of Gemfile and Gemfile.lock
# Remove files unnecessary for deployment (Mentioned in .slugignore )
rm -rf ./.git ./.gitmodules ./log ./tmp ./spec ./fixtures
# Bundle install
bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
# Heroku at this point, overwrites the DATABASE_URL into your database.yml file
rake assets:precompile
rake assets:clean
#May or may not have a Procfile, but if you do, this script needs to run the command mentioned for each process in the ProcFile
#Package the final slug archive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment