Avoid looking at other plugin shims when reshiming

This commit is contained in:
Daniel Perez 2017-10-21 12:40:10 +09:00
parent 8a2fd85529
commit 4d146ea652

View File

@ -184,11 +184,12 @@ remove_obsolete_shims() {
local install_path local install_path
install_path=$(get_install_path "$plugin_name" "$install_type" "$version") install_path=$(get_install_path "$plugin_name" "$install_type" "$version")
for shim_path in "$shims_path"/*; do local target_shims
target_shims=($(grep -lr "# asdf-plugin: $plugin_name" $shims_path))
for shim_path in "${target_shims[@]}"; do
local shim_name local shim_name
shim_name="$(basename "$shim_path")" shim_name="$(basename "$shim_path")"
if grep "# asdf-plugin: $plugin_name" "$shim_path" > /dev/null && \ if grep "# asdf-plugin-version: $version" "$shim_path" > /dev/null && \
grep "# asdf-plugin-version: $version" "$shim_path" > /dev/null && \
! shim_still_exists "$shim_name" "$install_path" "$space_separated_list_of_bin_paths"; then ! shim_still_exists "$shim_name" "$install_path" "$space_separated_list_of_bin_paths"; then
remove_shim_for_version "$plugin_name" "$shim_name" "$version" remove_shim_for_version "$plugin_name" "$shim_name" "$version"
fi fi