Commit 0de3b29f authored by Rob Loach's avatar Rob Loach Committed by Marc Cornellà
Browse files

composer: Fix bin directory when Composer is not available (#6240)

* 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.

* Fix Composer brackets in global bin directory

* composer: Apply feedback from ricpelo

This applies ricpelo's feedback at https://github.com/robbyrussell/oh-my-zsh/pull/6240#pullrequestreview-64253321

* composer: Fix path check syntax

* composer: test with $commands[] syntax
parent b743ce92
...@@ -51,5 +51,10 @@ alias cgrm='composer global remove' ...@@ -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.
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) if (( $+commands[composer] )); then
export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null)
else
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment