From 14043e73a8b0be32006bc3c747429d24b981fdae Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 11 Aug 2017 11:43:58 -0400 Subject: [PATCH] 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. --- plugins/composer/composer.plugin.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 8cf50d50..899f2a79 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -51,5 +51,10 @@ alias cgrm='composer global remove' # install composer in the current directory alias cget='curl -s https://getcomposer.org/installer | php' -# Add Composer's global binaries to PATH -export PATH=$PATH:$(composer global config bin-dir --absolute) 2>/dev/null +# 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 +else + export PATH=$PATH:~/.composer/vendor/bin + export PATH=$PATH:~/.config/composer/vendor/bin +fi