mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Add hooks for plugin uninstall
This commit is contained in:
parent
dcc3727cab
commit
9420ca1aec
@ -17,6 +17,9 @@ Features
|
||||
|
||||
pre_foo_bar = echo about to execute command bar from foo with args: ${@}
|
||||
post_foo_bar = echo just executed command bar from foo with args: ${@}
|
||||
|
||||
pre_asdf_uninstall_foo = echo will remove foo version ${1}
|
||||
post_asdf_uninstall_foo = echo removed foo version ${1}
|
||||
```
|
||||
* New shim version meta-data allows shims to not depend on a particular plugin
|
||||
nor on its relative executable path (#431)
|
||||
|
@ -23,6 +23,7 @@ uninstall_command() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
asdf_run_hook "pre_asdf_uninstall_${plugin_name}" "$full_version"
|
||||
remove_shims_for_version "$plugin_name" "$full_version"
|
||||
|
||||
if [ -f "${plugin_path}/bin/uninstall" ]; then
|
||||
@ -35,4 +36,6 @@ uninstall_command() {
|
||||
else
|
||||
rm -rf "$install_path"
|
||||
fi
|
||||
|
||||
asdf_run_hook "post_asdf_uninstall_${plugin_name}" "$full_version"
|
||||
}
|
||||
|
@ -86,3 +86,24 @@ teardown() {
|
||||
run uninstall_command dummy 1.0
|
||||
[ -f $ASDF_DIR/shims/gummy ]
|
||||
}
|
||||
|
||||
@test "uninstall command executes configured pre hook" {
|
||||
cat > $HOME/.asdfrc <<-'EOM'
|
||||
pre_asdf_uninstall_dummy = echo will uninstall dummy $1
|
||||
EOM
|
||||
|
||||
run install_command dummy 1.0
|
||||
run uninstall_command dummy 1.0
|
||||
[ "$output" == "will uninstall dummy 1.0" ]
|
||||
}
|
||||
|
||||
@test "uninstall command executes configured post hook" {
|
||||
cat > $HOME/.asdfrc <<-'EOM'
|
||||
post_asdf_uninstall_dummy = echo removed dummy $1
|
||||
EOM
|
||||
|
||||
run install_command dummy 1.0
|
||||
run uninstall_command dummy 1.0
|
||||
echo $output
|
||||
[ "$output" == "removed dummy 1.0" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user