Skip to content

Commit

Permalink
Merge branch 'master' of github.com:asdf-vm/asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
threkk committed Sep 18, 2021
2 parents 53e49cd + 7e1f2a0 commit 3ea4f4d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/commands/command-latest.bash
Expand Up @@ -25,7 +25,7 @@ latest_command() {
# pattern from xxenv-latest (https://github.com/momo-lab/xxenv-latest)
versions=$(asdf list-all "$plugin_name" "$query" |
grep -vE "(^Available versions:|-src|-dev|-latest|-stm|[-\\.]rc|-alpha|-beta|[-\\.]pre|-next|(a|b|c)[0-9]+|snapshot|master)" |
sed 's/^\s\+//' |
sed 's/^[[:space:]]\+//' |
tail -1)
if [ -z "${versions}" ]; then
exit 1
Expand Down
6 changes: 4 additions & 2 deletions lib/commands/command-plugin-update.bash
Expand Up @@ -8,12 +8,14 @@ plugin_update_command() {

local plugin_name="$1"
local gitref="${2}"
local plugins=

if [ "$plugin_name" = "--all" ]; then
if [ -d "$(asdf_data_dir)"/plugins ]; then
find "$(asdf_data_dir)"/plugins -mindepth 1 -maxdepth 1 -type d | while IFS= read -r dir; do
plugins=$(find "$(asdf_data_dir)"/plugins -mindepth 1 -maxdepth 1 -type d)
while IFS= read -r dir; do
update_plugin "$(basename "$dir")" "$dir" "$gitref" &
done
done <<<"$plugins"
wait
fi
else
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.bash
Expand Up @@ -681,7 +681,7 @@ select_from_preset_version() {
shim_versions=$(get_shim_versions "$shim_name")
if [ -n "$shim_versions" ]; then
preset_versions=$(preset_versions "$shim_name")
grep -f "$shim_versions" "$preset_versions" | head -n 1 | xargs -IVERSION printf "%s\\n" VERSION
grep -F "$shim_versions" <<<"$preset_versions" | head -n 1 | xargs -IVERSION printf "%s\\n" VERSION
fi
}

Expand Down
7 changes: 7 additions & 0 deletions test/plugin_update_command.bats
Expand Up @@ -112,3 +112,10 @@ teardown() {
[ "$status" -eq 0 ]
[ -f $ASDF_DIR/shims/dummy ]
}

@test "asdf plugin-update done for all plugins" {
local command="asdf plugin-update --all"
# Count the number of update processes remaining after the update command is completed.
run bash -c "${command} >/dev/null && ps -o 'ppid,args' | awk '{if(\$1==1 && \$0 ~ /${command}/ ) print}' | wc -l"
[[ 0 -eq "$output" ]]
}

0 comments on commit 3ea4f4d

Please sign in to comment.