diff --git a/lib/helpers.bash b/lib/helpers.bash index c5ae9cd1..ebd68119 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -365,10 +365,10 @@ all_groups () if ! type pathmunge > /dev/null 2>&1 then function pathmunge () { - _about 'prevent duplicate directories in you PATH variable' - _group 'lib helpers' - _example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH' - _example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir' + about 'prevent duplicate directories in you PATH variable' + group 'lib helpers' + example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH' + example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir' if ! [[ $PATH =~ (^|:)$1($|:) ]] ; then if [ "$2" = "after" ] ; then diff --git a/plugins/available/latex.plugin.bash b/plugins/available/latex.plugin.bash index eefec59d..6ebb70d3 100644 --- a/plugins/available/latex.plugin.bash +++ b/plugins/available/latex.plugin.bash @@ -4,6 +4,6 @@ about-plugin 'use mactex' # add mactex to the path if its present MACTEX_PATH=/usr/local/texlive/2009/bin/universal-darwin if [[ -d $MACTEX_PATH ]]; then - export PATH=$PATH:$MACTEX_PATH + pathmunge $MACTEX_PATH after fi unset MACTEX_PATH diff --git a/plugins/available/pipsi.plugin.bash b/plugins/available/pipsi.plugin.bash index 305e83cc..916d86d2 100644 --- a/plugins/available/pipsi.plugin.bash +++ b/plugins/available/pipsi.plugin.bash @@ -3,5 +3,5 @@ about-plugin 'load pipsi, if you are using it' if [[ -f "$HOME/.local/bin/pipsi" ]] then - export PATH=~/.local/bin:$PATH + pathmunge ~/.local/bin fi diff --git a/plugins/available/pyenv.plugin.bash b/plugins/available/pyenv.plugin.bash index 7ed2d3cd..8e4f1edd 100644 --- a/plugins/available/pyenv.plugin.bash +++ b/plugins/available/pyenv.plugin.bash @@ -2,7 +2,8 @@ cite about-plugin about-plugin 'load pyenv, if you are using it' export PYENV_ROOT="$HOME/.pyenv" -export PATH="$PYENV_ROOT/bin:$PATH" +pathmunge $PYENV_ROOT + [[ `which pyenv` ]] && eval "$(pyenv init -)" #Load pyenv virtualenv if the virtualenv plugin is installed. diff --git a/plugins/available/rbenv.plugin.bash b/plugins/available/rbenv.plugin.bash index 70fe62c3..a6c25559 100644 --- a/plugins/available/rbenv.plugin.bash +++ b/plugins/available/rbenv.plugin.bash @@ -3,7 +3,8 @@ cite about-plugin about-plugin 'load rbenv, if you are using it' -export PATH="$HOME/.rbenv/bin:$PATH" +pathmunge "${HOME}/.rbenv/bin" + [[ `which rbenv` ]] && eval "$(rbenv init -)" # Load the auto-completion script if rbenv was loaded. diff --git a/plugins/available/ruby.plugin.bash b/plugins/available/ruby.plugin.bash index b320cb30..4ab891d9 100644 --- a/plugins/available/ruby.plugin.bash +++ b/plugins/available/ruby.plugin.bash @@ -4,7 +4,7 @@ about-plugin 'ruby and rubygems specific functions and settings' # Make commands installed with 'gem install --user-install' available # ~/.gem/ruby/${RUBY_VERSION}/bin/ if which ruby >/dev/null && which gem >/dev/null; then - PATH="$PATH:$(ruby -e 'print Gem.user_dir')/bin"; + pathmunge "$(ruby -e 'print Gem.user_dir')/bin" after fi function remove_gem { diff --git a/plugins/available/todo.plugin.bash b/plugins/available/todo.plugin.bash index 28559def..ef9266e2 100755 --- a/plugins/available/todo.plugin.bash +++ b/plugins/available/todo.plugin.bash @@ -15,6 +15,7 @@ fi # respect ENV var set in .bash_profile, default is 't' alias $TODO='$TODO_SRC_DIR/todo.sh -d $TODO_SRC_DIR/todo.cfg' -export PATH=$PATH:$TODO_SRC_DIR +pathmunge $TODO_SRC_DIR after + source $TODO_SRC_DIR/todo_completion # bash completion for todo.sh complete -F _todo $TODO # enable completion for 't' alias diff --git a/test/plugins/ruby.plugin.bats b/test/plugins/ruby.plugin.bats index d3bbd70d..b9d9f56c 100755 --- a/test/plugins/ruby.plugin.bats +++ b/test/plugins/ruby.plugin.bats @@ -1,6 +1,7 @@ #!/usr/bin/env bats load ../test_helper +load ../../lib/helpers load ../../lib/composure load ../../plugins/available/ruby.plugin