Skip to content

Instantly share code, notes, and snippets.

@bquorning
Last active December 17, 2015 21:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bquorning/5676617 to your computer and use it in GitHub Desktop.
Run bundler automatically when needed. Save file as .git/hooks/post-checkout in your project, and do a `chmod +x`. Heavily inspired by https://gist.github.com/whilefalse/1019087
#!/bin/bash
if [ ! `git diff --name-only HEAD@{1}..HEAD Gemfile Gemfile.lock | wc -l` -eq 0 ]
then
echo -e "\033[0;31m*** Gemfile change detected, running bundle check ***\033[0m"
(unset GIT_DIR ; bundle check || bundle install --local || bundle install)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment