From 74927fbfe0a0c5db37df239b04afce33856444b3 Mon Sep 17 00:00:00 2001 From: Sabarish Kumar R Date: Mon, 25 Nov 2013 15:30:25 +0530 Subject: [PATCH] Bundle version check only needed bundler installation check, other commands to be bound --- plugins/bundler/bundler.plugin.zsh | 47 ++++++++++++++++-------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index e390f8620..9bee8f009 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -34,26 +34,29 @@ _run-with-bundler() { if _bundler-installed; then bundler_version=`bundle version | cut -d' ' -f3` - if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$(uname)" == 'Darwin' ]] - then - local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" - else - local cores_num="$(nproc)" - fi - eval "alias bi='bundle install --jobs=$cores_num'" - else - alias bi='bundle install' - fi - - ## Main program - for cmd in $bundled_commands; do - eval "function unbundled_$cmd () { $cmd \$@ }" - eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" - alias $cmd=bundled_$cmd - - if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd - fi - done +else + bundler_version='0' fi + +if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then + if [[ "$(uname)" == 'Darwin' ]] + then + local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + else + local cores_num="$(nproc)" + fi + eval "alias bi='bundle install --jobs=$cores_num'" +else + alias bi='bundle install' +fi + +## Main program +for cmd in $bundled_commands; do + eval "function unbundled_$cmd () { $cmd \$@ }" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd + + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd=$cmd + fi +done