Last active
December 12, 2015 04:49
-
-
Save aelesbao/4717353 to your computer and use it in GitHub Desktop.
git post-checkout hook that executes a "bundle install" if Gemfile has changes (using RVM if available)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash --login | |
orig_commit=$1 | |
dest_commit=$2 | |
root="$(git rev-parse --show-toplevel 2> /dev/null)" | |
is_not_rebasing() { | |
test -d ${root}/.git/rebase-merge | |
} | |
is_gemfile_clean() { | |
git --no-pager diff --exit-code --name-only ${orig_commit} ${dest_commit} \ | |
Gemfile Gemfile.lock > /dev/null | |
} | |
[[ -s .rvmrc ]] && . .rvmrc | |
is_not_rebasing && (is_gemfile_clean || bundle install) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment