Skip to content

Commit

Permalink
Use bundler if fit-commit was installed using it
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yasn77 committed Jan 7, 2017
1 parent d18d5c8 commit 059aa17
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions templates/hooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 059aa17

Please sign in to comment.