From f125741fb5d1cdbb9700fc1b857a77cce22d404d Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 21 May 2021 12:03:06 -0400 Subject: [PATCH] Update code to use . instead of source --- asdf.fish | 4 ++-- bin/asdf | 6 +++--- bin/private/asdf-exec | 2 +- lib/asdf.fish | 2 +- lib/commands/command-global.bash | 2 +- lib/commands/command-local.bash | 2 +- lib/commands/command-plugin-test.bash | 2 +- lib/commands/command-reshim.bash | 2 +- lib/commands/command-uninstall.bash | 2 +- lib/utils.bash | 4 ++-- test/asdf_fish.bats | 10 +++++----- test/version_commands.bats | 8 ++++---- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/asdf.fish b/asdf.fish index eb33f090..15736301 100644 --- a/asdf.fish +++ b/asdf.fish @@ -9,7 +9,7 @@ set -l asdf_user_shims ( ) # Add asdf to PATH -set -l asdf_bin_dirs $ASDF_DIR/bin $asdf_user_shims +set -l asdf_bin_dirs $ASDF_DIR/bin $asdf_user_shims for x in $asdf_bin_dirs if test -d $x @@ -24,4 +24,4 @@ for x in $asdf_bin_dirs end # Load the asdf wrapper function -source $ASDF_DIR/lib/asdf.fish +. $ASDF_DIR/lib/asdf.fish diff --git a/bin/asdf b/bin/asdf index a5020436..0693133d 100755 --- a/bin/asdf +++ b/bin/asdf @@ -1,7 +1,7 @@ #!/usr/bin/env bash # shellcheck source=lib/utils.bash -source "$(dirname "$(dirname "$0")")/lib/utils.bash" +. "$(dirname "$(dirname "$0")")/lib/utils.bash" find_cmd() { local cmd_dir="$1" @@ -74,12 +74,12 @@ asdf_cmd() { exec "$ASDF_CMD_FILE" "${@:${args_offset}}" elif [ -f "$ASDF_CMD_FILE" ]; then set -- "${@:${args_offset}}" - source "$ASDF_CMD_FILE" + . "$ASDF_CMD_FILE" else local asdf_cmd_dir asdf_cmd_dir="$(asdf_dir)/lib/commands" printf "%s\\n" "Unknown command: \`asdf ${*}\`" >&2 - source "$asdf_cmd_dir/command-help.bash" >&2 + . "$asdf_cmd_dir/command-help.bash" >&2 return 127 fi } diff --git a/bin/private/asdf-exec b/bin/private/asdf-exec index d24830cc..eec8b74e 100755 --- a/bin/private/asdf-exec +++ b/bin/private/asdf-exec @@ -5,7 +5,7 @@ printf "asdf is self upgrading shims to new asdf exec ...\\n" asdf_dir="$(dirname "$(dirname "$(dirname "$0")")")" # shellcheck source=lib/utils.bash -source "$asdf_dir/lib/utils.bash" +. "$asdf_dir/lib/utils.bash" rm "$(asdf_data_dir)"/shims/* "$asdf_dir"/bin/asdf reshim shim_name=$(basename "$2") diff --git a/lib/asdf.fish b/lib/asdf.fish index 34a67886..698b5444 100644 --- a/lib/asdf.fish +++ b/lib/asdf.fish @@ -7,7 +7,7 @@ function asdf switch "$command" case "shell" # source commands that need to export variables - source (asdf export-shell-version fish $argv | psub) + . (asdf export-shell-version fish $argv | psub) case '*' # forward other commands to asdf script command asdf "$command" $argv diff --git a/lib/commands/command-global.bash b/lib/commands/command-global.bash index 0bfaa06f..89f52518 100644 --- a/lib/commands/command-global.bash +++ b/lib/commands/command-global.bash @@ -1,5 +1,5 @@ # -*- sh -*- # shellcheck source=lib/commands/version_commands.bash -source "$(dirname "$ASDF_CMD_FILE")/version_commands.bash" +. "$(dirname "$ASDF_CMD_FILE")/version_commands.bash" version_command global "$@" diff --git a/lib/commands/command-local.bash b/lib/commands/command-local.bash index 50bf390b..78443d49 100644 --- a/lib/commands/command-local.bash +++ b/lib/commands/command-local.bash @@ -1,7 +1,7 @@ # -*- sh -*- # shellcheck source=lib/commands/version_commands.bash -source "$(dirname "$ASDF_CMD_FILE")/version_commands.bash" +. "$(dirname "$ASDF_CMD_FILE")/version_commands.bash" local_command() { local parent=false diff --git a/lib/commands/command-plugin-test.bash b/lib/commands/command-plugin-test.bash index 32cff4a0..e95e63a7 100644 --- a/lib/commands/command-plugin-test.bash +++ b/lib/commands/command-plugin-test.bash @@ -55,7 +55,7 @@ plugin_test_command() { export ASDF_DATA_DIR=$TEST_DIR # shellcheck disable=SC1090 - source "$ASDF_DIR/asdf.sh" + . "$ASDF_DIR/asdf.sh" if ! (asdf plugin-add "$plugin_name" "$plugin_url"); then fail_test "could not install $plugin_name from $plugin_url" diff --git a/lib/commands/command-reshim.bash b/lib/commands/command-reshim.bash index b54b68c9..92720e34 100644 --- a/lib/commands/command-reshim.bash +++ b/lib/commands/command-reshim.bash @@ -1,7 +1,7 @@ # -*- sh -*- # shellcheck source=lib/commands/reshim.bash -source "$(dirname "$ASDF_CMD_FILE")/reshim.bash" +. "$(dirname "$ASDF_CMD_FILE")/reshim.bash" reshim_command() { local plugin_name=$1 diff --git a/lib/commands/command-uninstall.bash b/lib/commands/command-uninstall.bash index a4553cd7..37ae44dd 100644 --- a/lib/commands/command-uninstall.bash +++ b/lib/commands/command-uninstall.bash @@ -1,7 +1,7 @@ # -*- sh -*- # shellcheck source=lib/commands/reshim.bash -source "$(dirname "$ASDF_CMD_FILE")/reshim.bash" +. "$(dirname "$ASDF_CMD_FILE")/reshim.bash" uninstall_command() { local plugin_name=$1 diff --git a/lib/utils.bash b/lib/utils.bash index 51d35888..58757d66 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -566,7 +566,7 @@ with_plugin_env() { ASDF_INSTALL_TYPE=$install_type \ ASDF_INSTALL_VERSION=$version \ ASDF_INSTALL_PATH=$install_path \ - source "${plugin_path}/bin/exec-env" + . "${plugin_path}/bin/exec-env" PATH=$path "$callback" } @@ -658,7 +658,7 @@ get_shim_versions() { preset_versions() { shim_name=$1 - shim_plugin_versions "${shim_name}" | cut -d' ' -f 1 | uniq | xargs -IPLUGIN bash -c "source $(asdf_dir)/lib/utils.bash; printf \"%s %s\\n\" PLUGIN \$(get_preset_version_for PLUGIN)" + shim_plugin_versions "${shim_name}" | cut -d' ' -f 1 | uniq | xargs -IPLUGIN bash -c ". $(asdf_dir)/lib/utils.bash; printf \"%s %s\\n\" PLUGIN \$(get_preset_version_for PLUGIN)" } select_from_preset_version() { diff --git a/test/asdf_fish.bats b/test/asdf_fish.bats index 16f07492..745f52e7 100644 --- a/test/asdf_fish.bats +++ b/test/asdf_fish.bats @@ -17,7 +17,7 @@ cleaned_path() { set -e ASDF_DATA_DIR set PATH $(cleaned_path) - source asdf.fish + . asdf.fish echo \$ASDF_DIR ") @@ -32,7 +32,7 @@ cleaned_path() { set -e ASDF_DATA_DIR set PATH $(cleaned_path) - source (pwd)/asdf.fish # if the full path is not passed, status -f will return the relative path + . (pwd)/asdf.fish # if the full path is not passed, status -f will return the relative path echo \$PATH ") @@ -48,8 +48,8 @@ cleaned_path() { set -e ASDF_DATA_DIR set PATH $(cleaned_path) - source asdf.fish - source asdf.fish + . asdf.fish + . asdf.fish echo \$PATH ") @@ -64,7 +64,7 @@ cleaned_path() { set -e ASDF_DIR set PATH $(cleaned_path) - source asdf.fish + . asdf.fish type asdf ") diff --git a/test/version_commands.bats b/test/version_commands.bats index f0cbb360..94b53770 100644 --- a/test/version_commands.bats +++ b/test/version_commands.bats @@ -231,14 +231,14 @@ teardown() { } @test "shell wrapper function should export ENV var" { - source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh + . $(dirname "$BATS_TEST_DIRNAME")/asdf.sh asdf shell "dummy" "1.1.0" [ $(echo $ASDF_DUMMY_VERSION) = "1.1.0" ] unset ASDF_DUMMY_VERSION } @test "shell wrapper function with --unset should unset ENV var" { - source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh + . $(dirname "$BATS_TEST_DIRNAME")/asdf.sh asdf shell "dummy" "1.1.0" [ $(echo $ASDF_DUMMY_VERSION) = "1.1.0" ] asdf shell "dummy" --unset @@ -247,7 +247,7 @@ teardown() { } @test "shell wrapper function should return an error for missing plugins" { - source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh + . $(dirname "$BATS_TEST_DIRNAME")/asdf.sh expected="No such plugin: nonexistent version 1.0.0 is not installed for nonexistent" @@ -306,7 +306,7 @@ false" } @test "shell wrapper function should support latest" { - source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh + . $(dirname "$BATS_TEST_DIRNAME")/asdf.sh asdf shell "dummy" "latest" [ $(echo $ASDF_DUMMY_VERSION) = "2.0.0" ] unset ASDF_DUMMY_VERSION