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

fix: allow plugin callbacks to be in any language #995

Merged
merged 1 commit into from
Jul 29, 2021
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
8 changes: 4 additions & 4 deletions lib/commands/command-help.bash
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ print_plugin_help() {

# Eventually @jthegedus or someone else will format the output from these
# scripts in a certain way.
bash "${plugin_path}"/bin/help.overview
"${plugin_path}"/bin/help.overview

if [ -f "${plugin_path}"/bin/help.deps ]; then
bash "${plugin_path}"/bin/help.deps
"${plugin_path}"/bin/help.deps
fi

if [ -f "${plugin_path}"/bin/help.config ]; then
bash "${plugin_path}"/bin/help.config
"${plugin_path}"/bin/help.config
fi

if [ -f "${plugin_path}"/bin/help.links ]; then
bash "${plugin_path}"/bin/help.links
"${plugin_path}"/bin/help.links
fi
}

Expand Down
4 changes: 2 additions & 2 deletions lib/commands/command-install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ install_tool_version() {
export ASDF_DOWNLOAD_PATH=$download_path
mkdir "$download_path"
asdf_run_hook "pre_asdf_download_${plugin_name}" "$full_version"
bash "${plugin_path}"/bin/download
"${plugin_path}"/bin/download
)
fi

Expand All @@ -188,7 +188,7 @@ install_tool_version() {
export ASDF_CONCURRENCY=$concurrency
mkdir "$install_path"
asdf_run_hook "pre_asdf_install_${plugin_name}" "$full_version"
bash "${plugin_path}"/bin/install
"${plugin_path}"/bin/install
)
fi

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/command-latest.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ latest_command() {
local versions

if [ -f "${plugin_path}/bin/latest-stable" ]; then
versions=$(bash "${plugin_path}"/bin/latest-stable "$query")
versions=$("${plugin_path}"/bin/latest-stable "$query")
if [ -z "${versions}" ]; then
# this branch requires this print to mimic the error from the list-all branch
printf "No compatible versions available (%s %s)\n" "$plugin_name" "$query" >&2
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/command-list-all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ list_all_command() {
# Capture return code to allow error handling
std_out_file="$(mktemp "/tmp/asdf-command-list-all-${plugin_name}.stdout.XXXXXX")"
std_err_file="$(mktemp "/tmp/asdf-command-list-all-${plugin_name}.stderr.XXXXXX")"
return_code=0 && bash "${plugin_path}/bin/list-all" >"$std_out_file" 2>"$std_err_file" || return_code=$?
return_code=0 && "${plugin_path}/bin/list-all" >"$std_out_file" 2>"$std_err_file" || return_code=$?

if [[ $return_code -ne 0 ]]; then
# Printing all output to allow plugin to handle error formatting
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/command-plugin-add.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ plugin_add_command() {
(
export ASDF_PLUGIN_SOURCE_URL=$source_url
export ASDF_PLUGIN_PATH=$plugin_path
bash "${plugin_path}/bin/post-plugin-add"
"${plugin_path}/bin/post-plugin-add"
)
fi

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/command-plugin-remove.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugin_remove_command() {
if [ -f "${plugin_path}/bin/pre-plugin-remove" ]; then
(
export ASDF_PLUGIN_PATH=$plugin_path
bash "${plugin_path}/bin/pre-plugin-remove"
"${plugin_path}/bin/pre-plugin-remove"
)
fi

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/command-uninstall.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ uninstall_command() {
export ASDF_INSTALL_TYPE=$install_type
export ASDF_INSTALL_VERSION=$version
export ASDF_INSTALL_PATH=$install_path
bash "${plugin_path}/bin/uninstall"
"${plugin_path}/bin/uninstall"
)
else
rm -rf "$install_path"
Expand Down
6 changes: 3 additions & 3 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ find_versions() {
local legacy_filenames=""

if [ "$legacy_config" = "yes" ] && [ -f "$legacy_list_filenames_script" ]; then
legacy_filenames=$(bash "$legacy_list_filenames_script")
legacy_filenames=$($legacy_list_filenames_script)
fi

while [ "$search_path" != "/" ]; do
Expand Down Expand Up @@ -329,7 +329,7 @@ parse_legacy_version_file() {

if [ -f "$file_path" ]; then
if [ -f "$parse_legacy_script" ]; then
bash "$parse_legacy_script" "$file_path"
"$parse_legacy_script" "$file_path"
else
cat "$file_path"
fi
Expand Down Expand Up @@ -481,7 +481,7 @@ list_plugin_bin_paths() {
export ASDF_INSTALL_TYPE=$install_type
export ASDF_INSTALL_VERSION=$version
export ASDF_INSTALL_PATH=$install_path
bash "${plugin_path}/bin/list-bin-paths"
"${plugin_path}/bin/list-bin-paths"
)
else
local space_separated_list_of_bin_paths="bin"
Expand Down
Empty file modified test/fixtures/dummy_broken_plugin/bin/install
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_broken_plugin/bin/list-all
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_legacy_plugin/bin/install
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_legacy_plugin/bin/list-all
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_legacy_plugin/bin/list-legacy-filenames
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_legacy_plugin/bin/parse-legacy-file
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_plugin/bin/help.overview
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_plugin/bin/install
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_plugin/bin/list-all
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_plugin/bin/list-legacy-filenames
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_plugin/bin/parse-legacy-file
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_plugin/bin/post-plugin-add
100644 → 100755
Empty file.
Empty file modified test/fixtures/dummy_plugin/bin/pre-plugin-remove
100644 → 100755
Empty file.