Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NVM with sourcetree #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions hook
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ if [[ -z "$HAS_NODE" ]]; then
source_home_file ".bash_profile" || source_home_file ".zshrc" || source_home_file ".bashrc" || true
fi

[ "$NVM_DIR" = "" ] && export NVM_DIR="$HOME/.nvm"
if [ -f "$NVM_DIR/nvm.sh" ]; then
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi

NODE=`which node 2> /dev/null`
NODEJS=`which nodejs 2> /dev/null`
IOJS=`which iojs 2> /dev/null`
Expand All @@ -37,6 +43,10 @@ elif [[ -x "$LOCAL" ]]; then
BINARY="$LOCAL"
fi

if [ ! -f "$BINARY" ]; then
echo "something wrong: node not exist"
exit 1
fi
#
# Add --dry-run cli flag support so we can execute this hook without side affects
# and see if it works in the current environment
Expand Down