From 059aa1765f7f8fef61914b90cbcf3d47585b5208 Mon Sep 17 00:00:00 2001 From: Yasser Nabi Date: Fri, 16 Dec 2016 16:57:07 +0000 Subject: [PATCH] Use bundler if fit-commit was installed using it Bundler will install gems to a different path, which most likely won't be picked up by ruby. So use `bundle exec` to run ruby to ensure gem path is correctly set for fit-commit. --- templates/hooks/commit-msg | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/hooks/commit-msg b/templates/hooks/commit-msg index a30fcb2..1601840 100755 --- a/templates/hooks/commit-msg +++ b/templates/hooks/commit-msg @@ -20,8 +20,11 @@ fi export GIT_BRANCH_NAME=`git symbolic-ref --short HEAD 2> /dev/null` -# find appropriate Ruby command -if which rbenv > /dev/null 2>&1; then +# Use bundler if fit-commit was installed using it +# or find appropriate Ruby command +if bundle show fit-commit > /dev/null 2>&1; then + cmd="bundle exec ruby" +elif which rbenv > /dev/null 2>&1; then cmd="rbenv exec ruby" elif which ruby-rvm-env > /dev/null 2>&1; then cmd="ruby-rvm-env"