mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 09:38:16 -07:00
Add metadata to shims
When a shim is created, add plugin metadata so we can later know which shims belong to which plugins, this will help aid with removing unused shims on uninstall. See #67 ``` # asdf-plugin: ${plugin_name}” ``` Thanks to @duijf for the metadata proposal.
This commit is contained in:
parent
e4501c7d6a
commit
2826f66849
@ -48,9 +48,11 @@ write_shim_script() {
|
||||
if [ -f $plugin_shims_path/$executable_name ]; then
|
||||
cp $plugin_shims_path/$executable_name $shim_path
|
||||
else
|
||||
echo """#!/usr/bin/env bash
|
||||
cat <<EOF > $shim_path
|
||||
#!/usr/bin/env bash
|
||||
# asdf-plugin: ${plugin_name}
|
||||
exec $(asdf_dir)/bin/private/asdf-exec ${plugin_name} ${executable_path} \"\$@\"
|
||||
""" > $shim_path
|
||||
EOF
|
||||
fi
|
||||
|
||||
chmod +x $shim_path
|
||||
|
7
test/fixtures/dummy_plugin/bin/install
vendored
7
test/fixtures/dummy_plugin/bin/install
vendored
@ -3,3 +3,10 @@
|
||||
mkdir -p $ASDF_INSTALL_PATH
|
||||
env > $ASDF_INSTALL_PATH/env
|
||||
echo $ASDF_INSTALL_VERSION > $ASDF_INSTALL_PATH/version
|
||||
|
||||
# create the dummy executable
|
||||
mkdir -p $ASDF_INSTALL_PATH/bin
|
||||
cat <<EOF > $ASDF_INSTALL_PATH/bin/dummy
|
||||
exec echo dummy
|
||||
EOF
|
||||
chmod 755 $ASDF_INSTALL_PATH/bin/dummy
|
||||
|
@ -42,3 +42,11 @@ teardown() {
|
||||
[ "$status" -eq 0 ]
|
||||
[ $(cat $ASDF_DIR/installs/dummy/1.2/version) = "1.2" ]
|
||||
}
|
||||
|
||||
@test "install_command should create a shim with metadada" {
|
||||
run install_command dummy 1.0
|
||||
[ "$status" -eq 0 ]
|
||||
[ -f $ASDF_DIR/installs/dummy/1.0/env ]
|
||||
run grep "# asdf-plugin: dummy" $ASDF_DIR/shims/dummy
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user