From b3f87c5f77f941cc616215fced2c81c6c777582f Mon Sep 17 00:00:00 2001 From: Edd Grant Date: Wed, 24 May 2017 14:56:11 +0100 Subject: [PATCH] Detect and initialise Rubymine to support running within non-interactive shells e.g. from within an IDE. --- templates/hooks/commit-msg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/hooks/commit-msg b/templates/hooks/commit-msg index 1601840..5f9c22b 100755 --- a/templates/hooks/commit-msg +++ b/templates/hooks/commit-msg @@ -20,6 +20,14 @@ fi export GIT_BRANCH_NAME=`git symbolic-ref --short HEAD 2> /dev/null` +# If this script is being run from a non interactive shell +# (i.e. from within RubyMine) then we might need to +# detect and initialise rbenv. +if [ -d $HOME/.rbenv ]; then + export PATH="$HOME/.rbenv/bin:$PATH" + eval "$(rbenv init -)" +fi + # Use bundler if fit-commit was installed using it # or find appropriate Ruby command if bundle show fit-commit > /dev/null 2>&1; then