From 1af1b1c3ce0abacd2091745d683c0eb822a59de6 Mon Sep 17 00:00:00 2001 From: edvardsanta Date: Thu, 20 Jul 2023 21:21:30 -0300 Subject: [PATCH 1/3] feat: add plugin location when update the plugin It is a feature created by recommendation of issue 1573. --- lib/functions/plugins.bash | 1 + test/plugin_update_command.bats | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/functions/plugins.bash b/lib/functions/plugins.bash index 247a22dfc..ec32c8af2 100644 --- a/lib/functions/plugins.bash +++ b/lib/functions/plugins.bash @@ -140,6 +140,7 @@ update_plugin() { local prev_ref= local post_ref= { + printf "Plugin %s location: %s\n" "$plugin_name" "$plugin_path" asdf_run_hook "pre_asdf_plugin_update" "$plugin_name" asdf_run_hook "pre_asdf_plugin_update_${plugin_name}" diff --git a/test/plugin_update_command.bats b/test/plugin_update_command.bats index e8ce1b0fa..8bd9e66c8 100644 --- a/test/plugin_update_command.bats +++ b/test/plugin_update_command.bats @@ -221,3 +221,9 @@ EOM UPDATE" [[ "$output" = *"${expected_output}" ]] } + +@test "asdf plugin-update prints the location of plugin (specific)" { + run asdf plugin-update dummy + local expected_output="Plugin dummy location: " + [[ "$output" == *"$expected_output"* ]] +} From b0a749d3333bb602a5120297ed2b8382e8af7c39 Mon Sep 17 00:00:00 2001 From: edvardsanta Date: Tue, 1 Aug 2023 22:34:52 -0300 Subject: [PATCH 2/3] plugin path renamed --- lib/functions/plugins.bash | 2 +- test/plugin_update_command.bats | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/functions/plugins.bash b/lib/functions/plugins.bash index ec32c8af2..dfef735f4 100644 --- a/lib/functions/plugins.bash +++ b/lib/functions/plugins.bash @@ -140,7 +140,7 @@ update_plugin() { local prev_ref= local post_ref= { - printf "Plugin %s location: %s\n" "$plugin_name" "$plugin_path" + 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}" diff --git a/test/plugin_update_command.bats b/test/plugin_update_command.bats index 8bd9e66c8..fe7c0cd52 100644 --- a/test/plugin_update_command.bats +++ b/test/plugin_update_command.bats @@ -169,7 +169,7 @@ EOM 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}" - [[ "$output" = "UPDATE dummy"*"${expected_output}" ]] + [[ "$output" = *"UPDATE dummy"*"${expected_output}" ]] } @test "asdf plugin-update executes configured pre hook (specific)" { @@ -223,7 +223,10 @@ UPDATE" } @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="Plugin dummy location: " + + local expected_output="Location of dummy plugin: $plugin_path" [[ "$output" == *"$expected_output"* ]] } From 774650fa9d31f4614957e1dea9c2d27694ce5307 Mon Sep 17 00:00:00 2001 From: edvardsanta Date: Thu, 31 Aug 2023 13:27:14 -0300 Subject: [PATCH 3/3] update: i fixed a test problem with my feat asdf plugin-update executes configured pre hook (specific) was failing --- test/plugin_update_command.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin_update_command.bats b/test/plugin_update_command.bats index fe7c0cd52..9bde04c8f 100644 --- a/test/plugin_update_command.bats +++ b/test/plugin_update_command.bats @@ -185,7 +185,7 @@ EOM 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}" - [[ "$output" = "UPDATE"*"${expected_output}" ]] + [[ "$output" = *"UPDATE"*"${expected_output}" ]] } @test "asdf plugin-update executes configured post hook (generic)" {