From 22c9f6240ebd5b94b7721b99a15ab6b867025036 Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 30 Jun 2020 17:17:56 +0100 Subject: [PATCH] make ruby/yarn configuration optional --- aliases.sh | 6 ------ profile | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/aliases.sh b/aliases.sh index 623892a..e2cf6c0 100644 --- a/aliases.sh +++ b/aliases.sh @@ -53,12 +53,6 @@ alias dokku='ssh -t dokku@dokku.isnet.uk' alias pacman='~/.src/archnews/archnews_wrap' -alias npm_real=$(command -v npm) -function npm { - echo "Please use Yarn instead!!" - echo " If you must use npm use: 'npm_real'" -} - # lf gets confused by TERMINFO env var when running in tmux # https://github.com/gokcehan/lf/issues/138#issuecomment-464477665 if [ -n "$TERMINFO" ] ; then diff --git a/profile b/profile index 0d2a11d..8f73c78 100644 --- a/profile +++ b/profile @@ -2,8 +2,21 @@ export SHELL_CONFIG="$SHELL_CONFIG:.profile" export EDITOR=/usr/bin/vim export BROWSER=/usr/bin/qutebrowser -ruby_path=$(ruby -r rubygems -e "puts Gem.user_dir")/bin -yarn_path=$(yarn global bin) +if command -v ruby ; then + ruby_path=$(ruby -r rubygems -e "puts Gem.user_dir")/bin + export PATH="$ruby_path:$PATH" +fi &> /dev/null + +if command -v yarn ; then + yarn_path=$(yarn global bin) + export PATH="$yarn_path:$PATH" + + alias npm_real=$(command -v npm) + function npm { + echo "Please use Yarn instead!!" + echo " If you must use npm use: 'npm_real'" + } +fi &> /dev/null export PATH="$HOME/.bin:$HOME/.local/bin:$yarn_path:$ruby_path:$PATH"