Fix for Composer's bin when Composer isn't global

When Composer isn't globally installed, the `composer global` call results in an error. This checks to see if Composer is available before making the call. When Composer isn't available, it will just manually set the directories.
This commit is contained in:
Rob Loach 2017-08-11 11:43:58 -04:00 committed by GitHub
parent d848c94804
commit 14043e73a8

View File

@ -51,5 +51,10 @@ alias cgrm='composer global remove'
# install composer in the current directory # install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php' alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH # Add Composer's global binaries to PATH, using Composer if available.
if hash composer 2>/dev/null; then
export PATH=$PATH:$(composer global config bin-dir --absolute) 2>/dev/null export PATH=$PATH:$(composer global config bin-dir --absolute) 2>/dev/null
else
export PATH=$PATH:~/.composer/vendor/bin
export PATH=$PATH:~/.config/composer/vendor/bin
fi