From 01ac9bf14e3fee318748a66e16146376b94b4e97 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 24 Jul 2012 11:07:42 -0400 Subject: [PATCH] more workarounds for apple's stupid default git client --- lib/penchant/version.rb | 2 +- script/hooks/commit-msg | 12 ++++++++++++ template/script/hooks/commit-msg | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/penchant/version.rb b/lib/penchant/version.rb index fad59b2..da58f0a 100644 --- a/lib/penchant/version.rb +++ b/lib/penchant/version.rb @@ -1,3 +1,3 @@ module Penchant - VERSION = "0.2.12" + VERSION = "0.2.13" end diff --git a/script/hooks/commit-msg b/script/hooks/commit-msg index 538118e..3290898 100755 --- a/script/hooks/commit-msg +++ b/script/hooks/commit-msg @@ -7,6 +7,18 @@ if [ ! -z "$MY_RUBY_HOME" ]; then PATH="$MY_RUBY_HOME/bin:$PATH" fi +if [ ! -z "$GEM_PATH" ]; then + oifs="$IFS" + while IFS=":" read -ra GEM_PATHS; do + FIXED_GEM_PATH="" + for i in "${GEM_PATHS[@]}"; do + FIXED_GEM_PATH="$FIXED_GEM_PATH:${i}/bin" + done + done <<< "$GEM_PATH" + IFS="$oifs" + PATH="$FIXED_GEM_PATH:$PATH" +fi + if [[ "${msg}" != *"[ci skip]"* ]]; then bundle exec rake --trace R=$? diff --git a/template/script/hooks/commit-msg b/template/script/hooks/commit-msg index d3f37c8..84d062f 100755 --- a/template/script/hooks/commit-msg +++ b/template/script/hooks/commit-msg @@ -4,6 +4,24 @@ msg=$(cat $1) OLD_GIT_DIR=$GIT_DIR +# lion appears to insert git paths before everything else. ensure rvm can +# bust through, at the very least. +if [ ! -z "$MY_RUBY_HOME" ]; then + PATH="$MY_RUBY_HOME/bin:$PATH" +fi + +if [ ! -z "$GEM_PATH" ]; then + oifs="$IFS" + while IFS=":" read -ra GEM_PATHS; do + FIXED_GEM_PATH="" + for i in "${GEM_PATHS[@]}"; do + FIXED_GEM_PATH="$FIXED_GEM_PATH:${i}/bin" + done + done <<< "$GEM_PATH" + IFS="$oifs" + PATH="$FIXED_GEM_PATH:$PATH" +fi + if [[ "${msg}" != *"[ci skip]"* ]]; then if [ "$(penchant gemfile-env)" != "remote" ]; then unset GIT_DIR