feat: add plugin location when update the plugin (#1602)

This commit is contained in:
Edvard 2023-09-10 11:43:39 -03:00 committed by GitHub
parent 4d5f22ddb8
commit 36c7024baa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -140,6 +140,7 @@ update_plugin() {
local prev_ref= local prev_ref=
local post_ref= local post_ref=
{ {
printf "Location of %s plugin: %s\n" "$plugin_name" "$plugin_path"
asdf_run_hook "pre_asdf_plugin_update" "$plugin_name" asdf_run_hook "pre_asdf_plugin_update" "$plugin_name"
asdf_run_hook "pre_asdf_plugin_update_${plugin_name}" asdf_run_hook "pre_asdf_plugin_update_${plugin_name}"

View File

@ -169,7 +169,7 @@ EOM
new_ref="$(git --git-dir "$plugin_path/.git" --work-tree "$plugin_path" rev-parse --short HEAD)" new_ref="$(git --git-dir "$plugin_path/.git" --work-tree "$plugin_path" rev-parse --short HEAD)"
local expected_output="plugin updated path=${plugin_path} old git-ref=${old_ref} new git-ref=${new_ref}" local expected_output="plugin updated path=${plugin_path} old git-ref=${old_ref} new git-ref=${new_ref}"
[[ "$output" = "UPDATE dummy"*"${expected_output}" ]] [[ "$output" = *"UPDATE dummy"*"${expected_output}" ]]
} }
@test "asdf plugin-update executes configured pre hook (specific)" { @test "asdf plugin-update executes configured pre hook (specific)" {
@ -185,7 +185,7 @@ EOM
new_ref="$(git --git-dir "$plugin_path/.git" --work-tree "$plugin_path" rev-parse --short HEAD)" new_ref="$(git --git-dir "$plugin_path/.git" --work-tree "$plugin_path" rev-parse --short HEAD)"
local expected_output="plugin updated path=${plugin_path} old git-ref=${old_ref} new git-ref=${new_ref}" local expected_output="plugin updated path=${plugin_path} old git-ref=${old_ref} new git-ref=${new_ref}"
[[ "$output" = "UPDATE"*"${expected_output}" ]] [[ "$output" = *"UPDATE"*"${expected_output}" ]]
} }
@test "asdf plugin-update executes configured post hook (generic)" { @test "asdf plugin-update executes configured post hook (generic)" {
@ -221,3 +221,12 @@ EOM
UPDATE" UPDATE"
[[ "$output" = *"${expected_output}" ]] [[ "$output" = *"${expected_output}" ]]
} }
@test "asdf plugin-update prints the location of plugin (specific)" {
local plugin_path
plugin_path="$(get_plugin_path dummy)"
run asdf plugin-update dummy
local expected_output="Location of dummy plugin: $plugin_path"
[[ "$output" == *"$expected_output"* ]]
}