Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add plugin location when update the plugin #1602

Merged
merged 5 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/functions/plugins.bash
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ update_plugin() {
local prev_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}"

Expand Down
13 changes: 11 additions & 2 deletions test/plugin_update_command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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)" {
Expand All @@ -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)" {
Expand Down Expand Up @@ -221,3 +221,12 @@ EOM
UPDATE"
[[ "$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"* ]]
}
Loading