diff --git a/src/_gem b/src/_gem index 1391566..31f168e 100644 --- a/src/_gem +++ b/src/_gem @@ -509,8 +509,18 @@ _gem_which() { } _gem_extensions_caching_policy() { + if [[ -n $GEM_HOME ]]; then + gem_home=$GEM_HOME + else + gem_home=$(_call_program commands ${words[1]} env gemdir) + fi + + # Rebuild if gems directory is more recent than cache. + [[ $gem_home/gems -nt "$1" ]] && return 0 + + # Rebuild if cache is older than one week. local -a oldp - oldp=( "$1"(Nm+1) ) + oldp=( "$1"(Nmw+1) ) (( $#oldp )) }