From b178cb07a7e9e446bea9e2e3e9090dde52994141 Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Wed, 2 Sep 2020 09:11:07 +1000 Subject: [PATCH 01/13] fix: rm asdf current header row for now (#793) --- lib/commands/command-current.bash | 2 +- test/current_command.bats | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/lib/commands/command-current.bash b/lib/commands/command-current.bash index 10b90c98..c6bf1c7f 100644 --- a/lib/commands/command-current.bash +++ b/lib/commands/command-current.bash @@ -45,7 +45,7 @@ current_command() { local terminal_format="%-15s %-15s %-10s\\n" local exit_status=0 - printf "$terminal_format" "PLUGIN" "VERSION" "SET BY CONFIG" + # printf "$terminal_format" "PLUGIN" "VERSION" "SET BY CONFIG" # disbale this until we release headings across the board if [ $# -eq 0 ]; then for plugin in $(asdf plugin list); do plugin_current_command "$plugin" "$terminal_format" diff --git a/test/current_command.bats b/test/current_command.bats index 4a10b2d2..bbf22860 100644 --- a/test/current_command.bats +++ b/test/current_command.bats @@ -20,8 +20,7 @@ teardown() { @test "current should derive from the current .tool-versions" { cd $PROJECT_DIR echo 'dummy 1.1.0' >> $PROJECT_DIR/.tool-versions - expected="PLUGIN VERSION SET BY CONFIG -dummy 1.1.0 $PROJECT_DIR/.tool-versions" + expected="dummy 1.1.0 $PROJECT_DIR/.tool-versions" run asdf current "dummy" [ "$status" -eq 0 ] @@ -31,8 +30,7 @@ dummy 1.1.0 $PROJECT_DIR/.tool-versions" @test "current should handle long version name" { cd $PROJECT_DIR echo "dummy nightly-2000-01-01" >> $PROJECT_DIR/.tool-versions - expected="PLUGIN VERSION SET BY CONFIG -dummy nightly-2000-01-01 $PROJECT_DIR/.tool-versions" + expected="dummy nightly-2000-01-01 $PROJECT_DIR/.tool-versions" run asdf current "dummy" [ "$status" -eq 0 ] @@ -42,8 +40,7 @@ dummy nightly-2000-01-01 $PROJECT_DIR/.tool-versions" @test "current should handle multiple versions" { cd $PROJECT_DIR echo "dummy 1.2.0 1.1.0" >> $PROJECT_DIR/.tool-versions - expected="PLUGIN VERSION SET BY CONFIG -dummy 1.2.0 1.1.0 $PROJECT_DIR/.tool-versions" + expected="dummy 1.2.0 1.1.0 $PROJECT_DIR/.tool-versions" run asdf current "dummy" [ "$status" -eq 0 ] @@ -55,8 +52,7 @@ dummy 1.2.0 1.1.0 $PROJECT_DIR/.tool-versions" cd $PROJECT_DIR echo 'legacy_version_file = yes' > $HOME/.asdfrc echo '1.2.0' >> $PROJECT_DIR/.dummy-version - expected="PLUGIN VERSION SET BY CONFIG -dummy 1.2.0 $PROJECT_DIR/.dummy-version" + expected="dummy 1.2.0 $PROJECT_DIR/.dummy-version" run asdf current "dummy" [ "$status" -eq 0 ] @@ -65,8 +61,7 @@ dummy 1.2.0 $PROJECT_DIR/.dummy-version" # TODO: Need to fix plugin error as well @test "current should error when the plugin doesn't exist" { - expected="PLUGIN VERSION SET BY CONFIG -No such plugin: foobar" + expected="No such plugin: foobar" run asdf current "foobar" [ "$status" -eq 1 ] @@ -75,8 +70,7 @@ No such plugin: foobar" @test "current should error when no version is set" { cd $PROJECT_DIR - expected="PLUGIN VERSION SET BY CONFIG -dummy ______ No version set. Run \"asdf dummy \"" + expected="dummy ______ No version set. Run \"asdf dummy \"" run asdf current "dummy" [ "$status" -eq 126 ] @@ -86,8 +80,7 @@ dummy ______ No version set. Run \"asdf @test "current should error when a version is set that isn't installed" { cd $PROJECT_DIR echo 'dummy 9.9.9' >> $PROJECT_DIR/.tool-versions - expected="PLUGIN VERSION SET BY CONFIG -dummy 9.9.9 Not installed. Run \"asdf install dummy 9.9.9\"" + expected="dummy 9.9.9 Not installed. Run \"asdf install dummy 9.9.9\"" run asdf current "dummy" [ "$status" -eq 1 ] @@ -109,8 +102,7 @@ dummy 9.9.9 Not installed. Run \"asdf install dummy 9.9.9\"" echo 'foobar 1.0.0' >> $PROJECT_DIR/.tool-versions run asdf current - expected="PLUGIN VERSION SET BY CONFIG -baz ______ No version set. Run \"asdf baz \" + expected="baz ______ No version set. Run \"asdf baz \" dummy 1.1.0 $PROJECT_DIR/.tool-versions foobar 1.0.0 $PROJECT_DIR/.tool-versions" @@ -135,8 +127,7 @@ foobar 1.0.0 $PROJECT_DIR/.tool-versions" @test "with no plugins prints an error" { clean_asdf_dir - expected="PLUGIN VERSION SET BY CONFIG -Oohes nooes ~! No plugins installed" + expected="Oohes nooes ~! No plugins installed" run asdf current [ "$status" -eq 0 ] @@ -146,8 +137,7 @@ Oohes nooes ~! No plugins installed" @test "current should handle comments" { cd $PROJECT_DIR echo "dummy 1.2.0 # this is a comment" >> $PROJECT_DIR/.tool-versions - expected="PLUGIN VERSION SET BY CONFIG -dummy 1.2.0 $PROJECT_DIR/.tool-versions" + expected="dummy 1.2.0 $PROJECT_DIR/.tool-versions" run asdf current "dummy" [ "$status" -eq 0 ] From 8745ae8a62de2ff2586e55cfd3717e311c1ae4c3 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 7 Sep 2020 11:00:52 -0400 Subject: [PATCH 02/13] Add details on implementing backwards compatible plugins to documentation Fixes #768 --- docs/plugins-create.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/plugins-create.md b/docs/plugins-create.md index 7fc51fbd..7e8a5c47 100644 --- a/docs/plugins-create.md +++ b/docs/plugins-create.md @@ -55,6 +55,8 @@ The install script should exit with a status of `0` when the installation is suc If possible the script should only place files in the `ASDF_INSTALL_PATH` directory once the build and installation of the tool is deemed successful by the install script. asdf [checks for the existence](https://github.com/asdf-vm/asdf/blob/242d132afbf710fe3c7ec23c68cec7bdd2c78ab5/lib/utils.sh#L44) of the `ASDF_INSTALL_PATH` directory in order to determine if that version of the tool is installed. If the `ASDF_INSTALL_PATH` directory is populated at the beginning of the installation process other asdf commands run in other terminals during the installation may consider that version of the tool installed, even when it is not fully installed. +If you want your plugin to work with asdf version 0.7.* and earlier and version 0.8.* and newer check for the presence of the `ASDF_DOWNLOAD_PATH` environment variable. If it is not set download the source code in the bin/install callback. If it is set assume the `bin/download` script already downloaded it. + ## Optional Scripts #### bin/help scripts From 96b87f4c961b28ba1f16ed7273da2e2babc098cf Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Tue, 8 Sep 2020 09:07:17 +1000 Subject: [PATCH 03/13] docs: link to Homebrew common issues from documentation site (#795) --- docs/core-manage-asdf-vm.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/core-manage-asdf-vm.md b/docs/core-manage-asdf-vm.md index e15449ca..fb804a8a 100644 --- a/docs/core-manage-asdf-vm.md +++ b/docs/core-manage-asdf-vm.md @@ -75,6 +75,8 @@ git checkout "$(git describe --abbrev=0 --tags)" ### --Homebrew-- +!> See `asdf` and Homebrew compatibility [issues in #785](https://github.com/asdf-vm/asdf/issues/785) before continuing. + Install using the Homebrew package manager: ```shell From c4e2eaf935a8315a3f2d21c27abe6def3d15f5a1 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 7 Sep 2020 19:47:18 -0400 Subject: [PATCH 04/13] Update changelog again for 0.8.0 release --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e133cce..7834f886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 0.8.1-dev -## 0.8.0-rc1 +## 0.8.0 Features @@ -11,9 +11,12 @@ Features * Improve introduction and install sections of documentation (#699, #740) * Add dependencies for openSUSE and ArchLinux to documentation (#714) * Add support for keeping downloaded tool source code (#74, #669) +* Add `asdf info` command to print debug information (#786, #787) Fixed Bugs +* Fix typo that caused plugin-test to erroneously fail (#780) +* Make sure shims are only appended to `PATH` once in Fish shell (#767, #777, #778) * Print `.tool-versions` file path on shim error (#749, #750) * Add `column` and `sort -V` to list of banned commands for the asdf codebase (#661, #754, #755) * Use editorconfig for shell formatting (#751) From 5479c6b50016cb676ab3a9f066d01ca7ebc5255b Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 7 Sep 2020 20:14:34 -0400 Subject: [PATCH 05/13] Fix existing tag check in tag.sh script --- release/tag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/tag.sh b/release/tag.sh index 912d77b9..8f884490 100755 --- a/release/tag.sh +++ b/release/tag.sh @@ -61,7 +61,7 @@ if ! [[ "${new_version:0:1}" =~ ^[0-9]+$ ]]; then fi # Make sure the version the user provided hasn't already been tagged -if git tag | grep "$new_tag_name" >/dev/null; then +if git tag | grep "^$new_tag_name$" >/dev/null; then echo >&2 "ERROR: git tag with that version already exists" exit 1 fi From c6145d08d01691a6e16c990e7d1c8778733e8c76 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Mon, 7 Sep 2020 20:16:35 -0400 Subject: [PATCH 06/13] Update version to 0.8.0 --- VERSION | 2 +- docs/core-manage-asdf-vm.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index b7f296b5..b19b5211 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.8.0-rc1 +v0.8.0 diff --git a/docs/core-manage-asdf-vm.md b/docs/core-manage-asdf-vm.md index fb804a8a..f7cab1bd 100644 --- a/docs/core-manage-asdf-vm.md +++ b/docs/core-manage-asdf-vm.md @@ -62,7 +62,7 @@ No match for _Operating System_ and _Installation Method_ selections. Please try Clone only the latest branch: ```shell -git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0-rc1 +git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0 ``` Alternately, you can clone the whole repo and checkout the latest branch: From 0efc04bca5095e8d561f88f1ec289b060a668a10 Mon Sep 17 00:00:00 2001 From: Joel Parker Henderson Date: Wed, 16 Sep 2020 21:00:35 -0700 Subject: [PATCH 07/13] Fix plugin-update --all when there are no plugins Issue: when asdf is first installed, there are no plugins, and running `asdf plugin-update --all` crashes because the plugin directory doesn't exist; similarly, the command crashes if the plugins directory exists yet doesn't contain any subdirectories. Solution: This patch changes the directory loop from using a wildcard `plugins/*` to a more robust approach: first verify the plugins directory exists, then use the`find` command to list subdirectories and correctly handle the corner case of no subdirectories. Future: Consider printing an error message and/or advice message. Consider automatically creating the plugins directory as needed. Consider prompting the user to install some popular plugins. --- lib/commands/command-plugin-update.bash | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/commands/command-plugin-update.bash b/lib/commands/command-plugin-update.bash index 7ed45def..8646e450 100644 --- a/lib/commands/command-plugin-update.bash +++ b/lib/commands/command-plugin-update.bash @@ -9,10 +9,12 @@ plugin_update_command() { local plugin_name="$1" local gitref="${2:-master}" if [ "$plugin_name" = "--all" ]; then - for dir in "$(asdf_data_dir)"/plugins/*; do - echo "Updating $(basename "$dir")..." - (cd "$dir" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref") - done + if [ -d "$(asdf_data_dir)"/plugins ]; then + for dir in $(find "$(asdf_data_dir)"/plugins -type d -mindepth 1 -maxdepth 1); + echo "Updating $(basename "$dir")..." + (cd "$dir" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref") + done + fi else local plugin_path plugin_path="$(get_plugin_path "$plugin_name")" From d93a2b6fe186cb0f2ce4fc60522bc72a62e94368 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Fri, 18 Sep 2020 11:41:56 -0400 Subject: [PATCH 08/13] Fix syntax for plugin update loop --- lib/commands/command-plugin-update.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/commands/command-plugin-update.bash b/lib/commands/command-plugin-update.bash index 8646e450..5bc0dee0 100644 --- a/lib/commands/command-plugin-update.bash +++ b/lib/commands/command-plugin-update.bash @@ -10,10 +10,10 @@ plugin_update_command() { local gitref="${2:-master}" if [ "$plugin_name" = "--all" ]; then if [ -d "$(asdf_data_dir)"/plugins ]; then - for dir in $(find "$(asdf_data_dir)"/plugins -type d -mindepth 1 -maxdepth 1); + while IFS= read -r -d '' dir; do echo "Updating $(basename "$dir")..." (cd "$dir" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref") - done + done < <(find "$(asdf_data_dir)"/plugins -type d -mindepth 1 -maxdepth 1) fi else local plugin_path From 0edb50547c21b3c7f4f1379b898b7fef7e9a2da3 Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Sat, 19 Sep 2020 07:37:52 +0200 Subject: [PATCH 09/13] feat: support for "latest" in shell, local, and global (#802) --- .../command-export-shell-version.bash | 3 + lib/commands/version_commands.bash | 9 +- test/fixtures/dummy_plugin/bin/list-all | 2 +- test/install_command.bats | 118 +++++++++--------- test/latest_command.bats | 4 +- test/list_command.bats | 22 ++-- test/shim_exec.bats | 64 +++++----- test/uninstall_command.bats | 56 ++++----- test/update_command.bats | 10 +- test/version_commands.bats | 22 ++++ 10 files changed, 170 insertions(+), 140 deletions(-) diff --git a/lib/commands/command-export-shell-version.bash b/lib/commands/command-export-shell-version.bash index c3a73398..afd21bc5 100644 --- a/lib/commands/command-export-shell-version.bash +++ b/lib/commands/command-export-shell-version.bash @@ -29,6 +29,9 @@ shell_command() { esac exit 0 fi + if [ "$version" = "latest" ]; then + version=$(asdf latest "$plugin") + fi if ! (check_if_version_exists "$plugin" "$version"); then version_not_installed_text "$plugin" "$version" 1>&2 echo 'false' diff --git a/lib/commands/version_commands.bash b/lib/commands/version_commands.bash index c2324960..0d47f526 100644 --- a/lib/commands/version_commands.bash +++ b/lib/commands/version_commands.bash @@ -32,18 +32,23 @@ version_command() { check_if_plugin_exists "$plugin_name" + declare -a resolved_versions local version for version in "${versions[@]}"; do + if [ "$version" = "latest" ]; then + version=$(asdf latest "$plugin_name") + fi if ! (check_if_version_exists "$plugin_name" "$version"); then version_not_installed_text "$plugin_name" "$version" 1>&2 exit 1 fi + resolved_versions+=("$version") done if [ -f "$file" ] && grep "^$plugin_name " "$file" >/dev/null; then - sed -i.bak -e "s|^$plugin_name .*$|$plugin_name ${versions[*]}|" "$file" + sed -i.bak -e "s|^$plugin_name .*$|$plugin_name ${resolved_versions[*]}|" "$file" rm "$file".bak else - echo "$plugin_name ${versions[*]}" >>"$file" + echo "$plugin_name ${resolved_versions[*]}" >>"$file" fi } diff --git a/test/fixtures/dummy_plugin/bin/list-all b/test/fixtures/dummy_plugin/bin/list-all index a9f42af2..1b9e8dd9 100644 --- a/test/fixtures/dummy_plugin/bin/list-all +++ b/test/fixtures/dummy_plugin/bin/list-all @@ -1,4 +1,4 @@ #!/usr/bin/env bash -versions_list=(1.0 1.1 2.0) +versions_list=(1.0.0 1.1.0 2.0.0) echo "${versions_list[@]}" diff --git a/test/install_command.bats b/test/install_command.bats index 2332841b..5c334182 100644 --- a/test/install_command.bats +++ b/test/install_command.bats @@ -16,38 +16,38 @@ teardown() { } @test "install_command installs the correct version" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ] + [ $(cat $ASDF_DIR/installs/dummy/1.1.0/version) = "1.1.0" ] } @test "install_command installs the correct version for plugins without download script" { - run asdf install legacy-dummy 1.1 + run asdf install legacy-dummy 1.1.0 [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/legacy-dummy/1.1/version) = "1.1" ] + [ $(cat $ASDF_DIR/installs/legacy-dummy/1.1.0/version) = "1.1.0" ] } @test "install_command without arguments installs even if the user is terrible and does not use newlines" { cd $PROJECT_DIR - echo -n 'dummy 1.2' > ".tool-versions" + echo -n 'dummy 1.2.0' > ".tool-versions" run asdf install [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.2/version) = "1.2" ] + [ $(cat $ASDF_DIR/installs/dummy/1.2.0/version) = "1.2.0" ] } @test "install_command with only name installs the version in .tool-versions" { cd $PROJECT_DIR - echo -n 'dummy 1.2' > ".tool-versions" + echo -n 'dummy 1.2.0' > ".tool-versions" run asdf install dummy [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.2/version) = "1.2" ] + [ $(cat $ASDF_DIR/installs/dummy/1.2.0/version) = "1.2.0" ] } @test "install_command set ASDF_CONCURRENCY" { - run asdf install dummy 1.0 + run asdf install dummy 1.0.0 [ "$status" -eq 0 ] - [ -f $ASDF_DIR/installs/dummy/1.0/env ] - run grep ASDF_CONCURRENCY $ASDF_DIR/installs/dummy/1.0/env + [ -f $ASDF_DIR/installs/dummy/1.0.0/env ] + run grep ASDF_CONCURRENCY $ASDF_DIR/installs/dummy/1.0.0/env [ "$status" -eq 0 ] } @@ -55,55 +55,55 @@ teardown() { WHITESPACE_DIR="$PROJECT_DIR/whitespace\ dir" mkdir -p "$WHITESPACE_DIR" cd "$WHITESPACE_DIR" - echo 'dummy 1.2' >> "$WHITESPACE_DIR/.tool-versions" + echo 'dummy 1.2.0' >> "$WHITESPACE_DIR/.tool-versions" run asdf install [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.2/version) = "1.2" ] + [ $(cat $ASDF_DIR/installs/dummy/1.2.0/version) = "1.2.0" ] } @test "install_command should create a shim with asdf-plugin metadata" { - run asdf install dummy 1.0 + run asdf install dummy 1.0.0 [ "$status" -eq 0 ] - [ -f $ASDF_DIR/installs/dummy/1.0/env ] - run grep "asdf-plugin: dummy 1.0" $ASDF_DIR/shims/dummy + [ -f $ASDF_DIR/installs/dummy/1.0.0/env ] + run grep "asdf-plugin: dummy 1.0.0" $ASDF_DIR/shims/dummy [ "$status" -eq 0 ] } @test "install_command should create a shim with asdf-plugin metadata for plugins without download script" { - run asdf install legacy-dummy 1.0 + run asdf install legacy-dummy 1.0.0 [ "$status" -eq 0 ] - [ -f $ASDF_DIR/installs/legacy-dummy/1.0/env ] - run grep "asdf-plugin: legacy-dummy 1.0" $ASDF_DIR/shims/dummy + [ -f $ASDF_DIR/installs/legacy-dummy/1.0.0/env ] + run grep "asdf-plugin: legacy-dummy 1.0.0" $ASDF_DIR/shims/dummy [ "$status" -eq 0 ] } @test "install_command on two versions should create a shim with asdf-plugin metadata" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ "$status" -eq 0 ] - run grep "asdf-plugin: dummy 1.1" $ASDF_DIR/shims/dummy + run grep "asdf-plugin: dummy 1.1.0" $ASDF_DIR/shims/dummy [ "$status" -eq 0 ] - run grep "asdf-plugin: dummy 1.0" $ASDF_DIR/shims/dummy + run grep "asdf-plugin: dummy 1.0.0" $ASDF_DIR/shims/dummy [ "$status" -eq 1 ] - run asdf install dummy 1.0 + run asdf install dummy 1.0.0 [ "$status" -eq 0 ] - run grep "asdf-plugin: dummy 1.0" $ASDF_DIR/shims/dummy + run grep "asdf-plugin: dummy 1.0.0" $ASDF_DIR/shims/dummy [ "$status" -eq 0 ] - run grep "# asdf-plugin: dummy 1.0"$'\n'"# asdf-plugin: dummy 1.1" $ASDF_DIR/shims/dummy + run grep "# asdf-plugin: dummy 1.0.0"$'\n'"# asdf-plugin: dummy 1.1.0" $ASDF_DIR/shims/dummy [ "$status" -eq 0 ] - lines_count=$(grep "asdf-plugin: dummy 1.1" $ASDF_DIR/shims/dummy | wc -l) + lines_count=$(grep "asdf-plugin: dummy 1.1.0" $ASDF_DIR/shims/dummy | wc -l) [ "$lines_count" -eq "1" ] } @test "install_command without arguments should not generate shim for subdir" { cd $PROJECT_DIR - echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions + echo 'dummy 1.0.0' > $PROJECT_DIR/.tool-versions run asdf install [ "$status" -eq 0 ] @@ -116,44 +116,44 @@ teardown() { cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/ cd $PROJECT_DIR - echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions + echo 'dummy 1.0.0' > $PROJECT_DIR/.tool-versions run asdf install # execute the generated shim run $ASDF_DIR/shims/dummy world hello [ "$status" -eq 0 ] - [ "$output" == "This is Dummy 1.0! hello world" ] + [ "$output" == "This is Dummy 1.0.0! hello world" ] } @test "install_command fails when tool is specified but no version of the tool is configured" { run asdf install dummy [ "$status" -eq 1 ] [ "$output" = "No versions specified for dummy in config files or environment" ] - [ ! -f $ASDF_DIR/installs/dummy/1.1/version ] + [ ! -f $ASDF_DIR/installs/dummy/1.1.0/version ] } @test "install_command fails when tool is specified but no version of the tool is configured in config file" { - echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions + echo 'dummy 1.0.0' > $PROJECT_DIR/.tool-versions run asdf install other-dummy [ "$status" -eq 1 ] [ "$output" = "No versions specified for other-dummy in config files or environment" ] - [ ! -f $ASDF_DIR/installs/dummy/1.0/version ] + [ ! -f $ASDF_DIR/installs/dummy/1.0.0/version ] } @test "install_command fails when two tools are specified with no versions" { - printf 'dummy 1.0\nother-dummy 2.0' > $PROJECT_DIR/.tool-versions + printf 'dummy 1.0.0\nother-dummy 2.0.0' > $PROJECT_DIR/.tool-versions run asdf install dummy other-dummy [ "$status" -eq 1 ] [ "$output" = "Dummy couldn't install version: other-dummy (on purpose)" ] - [ ! -f $ASDF_DIR/installs/dummy/1.0/version ] - [ ! -f $ASDF_DIR/installs/other-dummy/2.0/version ] + [ ! -f $ASDF_DIR/installs/dummy/1.0.0/version ] + [ ! -f $ASDF_DIR/installs/other-dummy/2.0.0/version ] } @test "install_command without arguments uses a parent directory .tool-versions file if present" { # asdf lib needed to run generated shims cp -rf $BATS_TEST_DIRNAME/../{bin,lib} $ASDF_DIR/ - echo 'dummy 1.0' > $PROJECT_DIR/.tool-versions + echo 'dummy 1.0.0' > $PROJECT_DIR/.tool-versions mkdir -p $PROJECT_DIR/child cd $PROJECT_DIR/child @@ -161,20 +161,20 @@ teardown() { run asdf install # execute the generated shim - [ "$($ASDF_DIR/shims/dummy world hello)" == "This is Dummy 1.0! hello world" ] + [ "$($ASDF_DIR/shims/dummy world hello)" == "This is Dummy 1.0.0! hello world" ] [ "$status" -eq 0 ] } @test "install_command installs multiple tool versions when they are specified in a .tool-versions file" { - echo 'dummy 1.0 1.2' > $PROJECT_DIR/.tool-versions + echo 'dummy 1.0.0 1.2.0' > $PROJECT_DIR/.tool-versions cd $PROJECT_DIR run asdf install echo $output [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.0/version) = "1.0" ] - [ $(cat $ASDF_DIR/installs/dummy/1.2/version) = "1.2" ] + [ $(cat $ASDF_DIR/installs/dummy/1.0.0/version) = "1.0.0" ] + [ $(cat $ASDF_DIR/installs/dummy/1.2.0/version) = "1.2.0" ] } @test "install_command doesn't install system version" { @@ -188,8 +188,8 @@ teardown() { pre_asdf_install_dummy = echo will install dummy $1 EOM - run asdf install dummy 1.0 - [ "$output" == "will install dummy 1.0" ] + run asdf install dummy 1.0.0 + [ "$output" == "will install dummy 1.0.0" ] } @test "install command executes configured post plugin install hook" { @@ -197,23 +197,23 @@ EOM post_asdf_install_dummy = echo HEY $version FROM $plugin_name EOM - run asdf install dummy 1.0 - [ "$output" == "HEY 1.0 FROM dummy" ] + run asdf install dummy 1.0.0 + [ "$output" == "HEY 1.0.0 FROM dummy" ] } @test "install command without arguments installs versions from legacy files" { echo 'legacy_version_file = yes' > $HOME/.asdfrc - echo '1.2' >> $PROJECT_DIR/.dummy-version + echo '1.2.0' >> $PROJECT_DIR/.dummy-version cd $PROJECT_DIR run asdf install [ "$status" -eq 0 ] [ "$output" == "" ] - [ -f $ASDF_DIR/installs/dummy/1.2/version ] + [ -f $ASDF_DIR/installs/dummy/1.2.0/version ] } @test "install command without arguments installs versions from legacy files in parent directories" { echo 'legacy_version_file = yes' > $HOME/.asdfrc - echo '1.2' >> $PROJECT_DIR/.dummy-version + echo '1.2.0' >> $PROJECT_DIR/.dummy-version mkdir -p $PROJECT_DIR/child cd $PROJECT_DIR/child @@ -221,40 +221,40 @@ EOM run asdf install [ "$status" -eq 0 ] [ "$output" == "" ] - [ -f $ASDF_DIR/installs/dummy/1.2/version ] + [ -f $ASDF_DIR/installs/dummy/1.2.0/version ] } @test "install_command latest installs latest stable version" { run asdf install dummy latest [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/2.0/version) = "2.0" ] + [ $(cat $ASDF_DIR/installs/dummy/2.0.0/version) = "2.0.0" ] } @test "install_command latest:version installs latest stable version that matches the given string" { run asdf install dummy latest:1 [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ] + [ $(cat $ASDF_DIR/installs/dummy/1.1.0/version) = "1.1.0" ] } @test "install_command deletes the download directory" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ "$status" -eq 0 ] - [ ! -d $ASDF_DIR/downloads/dummy/1.1 ] - [ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ] + [ ! -d $ASDF_DIR/downloads/dummy/1.1.0 ] + [ $(cat $ASDF_DIR/installs/dummy/1.1.0/version) = "1.1.0" ] } @test "install_command keeps the download directory when --keep-download flag is provided" { - run asdf install dummy 1.1 --keep-download + run asdf install dummy 1.1.0 --keep-download [ "$status" -eq 0 ] - [ -d $ASDF_DIR/downloads/dummy/1.1 ] - [ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ] + [ -d $ASDF_DIR/downloads/dummy/1.1.0 ] + [ $(cat $ASDF_DIR/installs/dummy/1.1.0/version) = "1.1.0" ] } @test "install_command keeps the download directory when always_keep_download setting is true" { echo 'always_keep_download = yes' > $HOME/.asdfrc - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 echo $output [ "$status" -eq 0 ] - [ -d $ASDF_DIR/downloads/dummy/1.1 ] - [ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ] + [ -d $ASDF_DIR/downloads/dummy/1.1.0 ] + [ $(cat $ASDF_DIR/installs/dummy/1.1.0/version) = "1.1.0" ] } diff --git a/test/latest_command.bats b/test/latest_command.bats index 90e2a286..8dd06fcc 100644 --- a/test/latest_command.bats +++ b/test/latest_command.bats @@ -13,12 +13,12 @@ teardown() { @test "latest_command shows latest stable version" { run asdf latest dummy - [ "$(echo -e "2.0")" == "$output" ] + [ "$(echo -e "2.0.0")" == "$output" ] [ "$status" -eq 0 ] } @test "latest_command with version shows latest stable version that matches the given string" { run asdf latest dummy 1 - [ "$(echo -e "1.1")" == "$output" ] + [ "$(echo -e "1.1.0")" == "$output" ] [ "$status" -eq 0 ] } diff --git a/test/list_command.bats b/test/list_command.bats index f06d573c..6ee094b4 100644 --- a/test/list_command.bats +++ b/test/list_command.bats @@ -12,10 +12,10 @@ teardown() { } @test "list_command should list plugins with installed versions" { - run asdf install dummy 1.0 - run asdf install dummy 1.1 + run asdf install dummy 1.0.0 + run asdf install dummy 1.1.0 run asdf list - [ "$(echo -e "dummy\n 1.0\n 1.1")" == "$output" ] + [ "$(echo -e "dummy\n 1.0.0\n 1.1.0")" == "$output" ] [ "$status" -eq 0 ] } @@ -23,29 +23,29 @@ teardown() { run install_mock_plugin "dummy" run install_mock_plugin "mummy" run install_mock_plugin "tummy" - run asdf install dummy 1.0 - run asdf install tummy 2.0 + run asdf install dummy 1.0.0 + run asdf install tummy 2.0.0 run asdf list - [ "$(echo -e "dummy\n 1.0\nmummy\n No versions installed\ntummy\n 2.0")" == "$output" ] + [ "$(echo -e "dummy\n 1.0.0\nmummy\n No versions installed\ntummy\n 2.0.0")" == "$output" ] [ "$status" -eq 0 ] } @test "list_command with plugin should list installed versions" { - run asdf install dummy 1.0 - run asdf install dummy 1.1 + run asdf install dummy 1.0.0 + run asdf install dummy 1.1.0 run asdf list dummy - [ "$(echo -e " 1.0\n 1.1")" == "$output" ] + [ "$(echo -e " 1.0.0\n 1.1.0")" == "$output" ] [ "$status" -eq 0 ] } @test "list_all_command lists available versions" { run asdf list-all dummy - [ "$(echo -e "1.0\n1.1\n2.0")" == "$output" ] + [ "$(echo -e "1.0.0\n1.1.0\n2.0.0")" == "$output" ] [ "$status" -eq 0 ] } @test "list_all_command with version filters available versions" { run asdf list-all dummy 1 - [ "$(echo -e "1.0\n1.1")" == "$output" ] + [ "$(echo -e "1.0.0\n1.1.0")" == "$output" ] [ "$status" -eq 0 ] } diff --git a/test/shim_exec.bats b/test/shim_exec.bats index 61382fad..ffa5bd39 100644 --- a/test/shim_exec.bats +++ b/test/shim_exec.bats @@ -82,7 +82,7 @@ teardown() { @test "shim exec should suggest which plugin to use when no version is selected" { run asdf install dummy 1.0 - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 touch $PROJECT_DIR/.tool-versions @@ -92,7 +92,7 @@ teardown() { echo "$output" | grep -q "No version set for command dummy" 2>/dev/null echo "$output" | grep -q "Consider adding one of the following versions in your config file at $PROJECT_DIR/.tool-versions" 2>/dev/null echo "$output" | grep -q "dummy 1.0" 2>/dev/null - echo "$output" | grep -q "dummy 2.0" 2>/dev/null + echo "$output" | grep -q "dummy 2.0.0" 2>/dev/null } @test "shim exec should suggest different plugins providing same tool when no version is selected" { @@ -116,23 +116,23 @@ teardown() { @test "shim exec should suggest to install missing version" { run asdf install dummy 1.0 - echo "dummy 2.0 1.3" > $PROJECT_DIR/.tool-versions + echo "dummy 2.0.0 1.3" > $PROJECT_DIR/.tool-versions run $ASDF_DIR/shims/dummy world hello [ "$status" -eq 126 ] echo "$output" | grep -q "No preset version installed for command dummy" 2>/dev/null echo "$output" | grep -q "Please install a version by running one of the following:" 2>/dev/null - echo "$output" | grep -q "asdf install dummy 2.0" 2>/dev/null + echo "$output" | grep -q "asdf install dummy 2.0.0" 2>/dev/null echo "$output" | grep -q "asdf install dummy 1.3" 2>/dev/null echo "$output" | grep -q "or add one of the following versions in your config file at $PROJECT_DIR/.tool-versions" 2>/dev/null echo "$output" | grep -q "dummy 1.0" 2>/dev/null } @test "shim exec should execute first plugin that is installed and set" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 run asdf install dummy 3.0 - echo "dummy 1.0 3.0 2.0" > $PROJECT_DIR/.tool-versions + echo "dummy 1.0 3.0 2.0.0" > $PROJECT_DIR/.tool-versions run $ASDF_DIR/shims/dummy world hello [ "$status" -eq 0 ] @@ -183,7 +183,7 @@ teardown() { run asdf install dummy 1.0 run asdf install mummy 3.0 - echo "dummy 2.0" > $PROJECT_DIR/.tool-versions + echo "dummy 2.0.0" > $PROJECT_DIR/.tool-versions echo "mummy 3.0" >> $PROJECT_DIR/.tool-versions echo "dummy 1.0" >> $PROJECT_DIR/.tool-versions @@ -221,10 +221,10 @@ teardown() { } @test "shim exec should execute system if set first" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 echo "dummy system" > $PROJECT_DIR/.tool-versions - echo "dummy 2.0" >> $PROJECT_DIR/.tool-versions + echo "dummy 2.0.0" >> $PROJECT_DIR/.tool-versions mkdir $PROJECT_DIR/foo/ echo "echo System" > $PROJECT_DIR/foo/dummy @@ -235,38 +235,38 @@ teardown() { } @test "shim exec should use custom exec-env for tool" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 echo "export FOO=sourced" > $ASDF_DIR/plugins/dummy/bin/exec-env mkdir $ASDF_DIR/plugins/dummy/shims echo 'echo $FOO custom' > $ASDF_DIR/plugins/dummy/shims/foo chmod +x $ASDF_DIR/plugins/dummy/shims/foo - run asdf reshim dummy 2.0 + run asdf reshim dummy 2.0.0 - echo "dummy 2.0" > $PROJECT_DIR/.tool-versions + echo "dummy 2.0.0" > $PROJECT_DIR/.tool-versions run $ASDF_DIR/shims/foo [ "$output" == "sourced custom" ] } @test "shim exec with custom exec-env using ASDF_INSTALL_PATH" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 echo 'export FOO=$ASDF_INSTALL_PATH/foo' > $ASDF_DIR/plugins/dummy/bin/exec-env mkdir $ASDF_DIR/plugins/dummy/shims echo 'echo $FOO custom' > $ASDF_DIR/plugins/dummy/shims/foo chmod +x $ASDF_DIR/plugins/dummy/shims/foo - run asdf reshim dummy 2.0 + run asdf reshim dummy 2.0.0 - echo "dummy 2.0" > $PROJECT_DIR/.tool-versions + echo "dummy 2.0.0" > $PROJECT_DIR/.tool-versions run $ASDF_DIR/shims/foo - [ "$output" == "$ASDF_DIR/installs/dummy/2.0/foo custom" ] + [ "$output" == "$ASDF_DIR/installs/dummy/2.0.0/foo custom" ] } @test "shim exec doest not use custom exec-env for system version" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 echo "export FOO=sourced" > $ASDF_DIR/plugins/dummy/bin/exec-env mkdir $ASDF_DIR/plugins/dummy/shims echo 'echo $FOO custom' > $ASDF_DIR/plugins/dummy/shims/foo chmod +x $ASDF_DIR/plugins/dummy/shims/foo - run asdf reshim dummy 2.0 + run asdf reshim dummy 2.0.0 echo "dummy system" > $PROJECT_DIR/.tool-versions @@ -279,24 +279,24 @@ teardown() { } @test "shim exec should prepend the plugin paths on execution" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 mkdir $ASDF_DIR/plugins/dummy/shims echo 'which dummy' > $ASDF_DIR/plugins/dummy/shims/foo chmod +x $ASDF_DIR/plugins/dummy/shims/foo - run asdf reshim dummy 2.0 + run asdf reshim dummy 2.0.0 - echo "dummy 2.0" > $PROJECT_DIR/.tool-versions + echo "dummy 2.0.0" > $PROJECT_DIR/.tool-versions run $ASDF_DIR/shims/foo - [ "$output" == "$ASDF_DIR/installs/dummy/2.0/bin/dummy" ] + [ "$output" == "$ASDF_DIR/installs/dummy/2.0.0/bin/dummy" ] } @test "shim exec should be able to find other shims in path" { cp -rf $ASDF_DIR/plugins/dummy $ASDF_DIR/plugins/gummy - echo "dummy 2.0" > $PROJECT_DIR/.tool-versions - echo "gummy 2.0" >> $PROJECT_DIR/.tool-versions + echo "dummy 2.0.0" > $PROJECT_DIR/.tool-versions + echo "gummy 2.0.0" >> $PROJECT_DIR/.tool-versions run asdf install @@ -314,14 +314,14 @@ teardown() { run asdf reshim run $ASDF_DIR/shims/foo - [ "$output" == "$ASDF_DIR/installs/dummy/2.0/bin/dummy" ] + [ "$output" == "$ASDF_DIR/installs/dummy/2.0.0/bin/dummy" ] run $ASDF_DIR/shims/bar [ "$output" == "$ASDF_DIR/shims/gummy" ] } @test "shim exec should remove shim_path from path on system version execution" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 echo "dummy system" > $PROJECT_DIR/.tool-versions @@ -336,19 +336,19 @@ teardown() { @test "shim exec can take version from legacy file if configured" { - run asdf install dummy 2.0 + run asdf install dummy 2.0.0 echo "legacy_version_file = yes" > $HOME/.asdfrc - echo "2.0" > $PROJECT_DIR/.dummy-version + echo "2.0.0" > $PROJECT_DIR/.dummy-version run $ASDF_DIR/shims/dummy world hello - [ "$output" == "This is Dummy 2.0! hello world" ] + [ "$output" == "This is Dummy 2.0.0! hello world" ] } @test "shim exec can take version from environment variable" { - run asdf install dummy 2.0 - run env ASDF_DUMMY_VERSION=2.0 $ASDF_DIR/shims/dummy world hello - [ "$output" == "This is Dummy 2.0! hello world" ] + run asdf install dummy 2.0.0 + run env ASDF_DUMMY_VERSION=2.0.0 $ASDF_DIR/shims/dummy world hello + [ "$output" == "This is Dummy 2.0.0! hello world" ] } @test "shim exec uses plugin list-bin-paths" { diff --git a/test/uninstall_command.bats b/test/uninstall_command.bats index 2745ba2e..10201e32 100644 --- a/test/uninstall_command.bats +++ b/test/uninstall_command.bats @@ -21,65 +21,65 @@ teardown() { } @test "uninstall_command should remove the plugin with that version from asdf" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ] - run asdf uninstall dummy 1.1 - [ ! -f $ASDF_DIR/installs/dummy/1.1/version ] + [ $(cat $ASDF_DIR/installs/dummy/1.1.0/version) = "1.1.0" ] + run asdf uninstall dummy 1.1.0 + [ ! -f $ASDF_DIR/installs/dummy/1.1.0/version ] } @test "uninstall_command should invoke the plugin bin/uninstall if available" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ "$status" -eq 0 ] mkdir -p $ASDF_DIR/plugins/dummy/bin echo "echo custom uninstall" > $ASDF_DIR/plugins/dummy/bin/uninstall chmod 755 $ASDF_DIR/plugins/dummy/bin/uninstall - run asdf uninstall dummy 1.1 + run asdf uninstall dummy 1.1.0 [ "$output" == "custom uninstall" ] [ "$status" -eq 0 ] } @test "uninstall_command should remove the plugin shims if no other version is installed" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ -f $ASDF_DIR/shims/dummy ] - run asdf uninstall dummy 1.1 + run asdf uninstall dummy 1.1.0 [ ! -f $ASDF_DIR/shims/dummy ] } @test "uninstall_command should leave the plugin shims if other version is installed" { - run asdf install dummy 1.0 - [ -f $ASDF_DIR/installs/dummy/1.0/bin/dummy ] + run asdf install dummy 1.0.0 + [ -f $ASDF_DIR/installs/dummy/1.0.0/bin/dummy ] - run asdf install dummy 1.1 - [ -f $ASDF_DIR/installs/dummy/1.1/bin/dummy ] + run asdf install dummy 1.1.0 + [ -f $ASDF_DIR/installs/dummy/1.1.0/bin/dummy ] [ -f $ASDF_DIR/shims/dummy ] - run asdf uninstall dummy 1.0 + run asdf uninstall dummy 1.0.0 [ -f $ASDF_DIR/shims/dummy ] } @test "uninstall_command should remove relevant asdf-plugin metadata" { - run asdf install dummy 1.0 - [ -f $ASDF_DIR/installs/dummy/1.0/bin/dummy ] + run asdf install dummy 1.0.0 + [ -f $ASDF_DIR/installs/dummy/1.0.0/bin/dummy ] - run asdf install dummy 1.1 - [ -f $ASDF_DIR/installs/dummy/1.1/bin/dummy ] + run asdf install dummy 1.1.0 + [ -f $ASDF_DIR/installs/dummy/1.1.0/bin/dummy ] - run asdf uninstall dummy 1.0 - run grep "asdf-plugin: dummy 1.1" $ASDF_DIR/shims/dummy + run asdf uninstall dummy 1.0.0 + run grep "asdf-plugin: dummy 1.1.0" $ASDF_DIR/shims/dummy [ "$status" -eq 0 ] - run grep "asdf-plugin: dummy 1.0" $ASDF_DIR/shims/dummy + run grep "asdf-plugin: dummy 1.0.0" $ASDF_DIR/shims/dummy [ "$status" -eq 1 ] } @test "uninstall_command should not remove other unrelated shims" { - run asdf install dummy 1.0 + run asdf install dummy 1.0.0 [ -f $ASDF_DIR/shims/dummy ] touch $ASDF_DIR/shims/gummy [ -f $ASDF_DIR/shims/gummy ] - run asdf uninstall dummy 1.0 + run asdf uninstall dummy 1.0.0 [ -f $ASDF_DIR/shims/gummy ] } @@ -88,9 +88,9 @@ teardown() { pre_asdf_uninstall_dummy = echo will uninstall dummy $1 EOM - run asdf install dummy 1.0 - run asdf uninstall dummy 1.0 - [ "$output" == "will uninstall dummy 1.0" ] + run asdf install dummy 1.0.0 + run asdf uninstall dummy 1.0.0 + [ "$output" == "will uninstall dummy 1.0.0" ] } @test "uninstall command executes configured post hook" { @@ -98,8 +98,8 @@ EOM post_asdf_uninstall_dummy = echo removed dummy $1 EOM - run asdf install dummy 1.0 - run asdf uninstall dummy 1.0 + run asdf install dummy 1.0.0 + run asdf uninstall dummy 1.0.0 echo $output - [ "$output" == "removed dummy 1.0" ] + [ "$output" == "removed dummy 1.0.0" ] } diff --git a/test/update_command.bats b/test/update_command.bats index 27fc6155..ac6d6403 100644 --- a/test/update_command.bats +++ b/test/update_command.bats @@ -74,15 +74,15 @@ teardown() { } @test "asdf update should not remove plugin versions" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ "$status" -eq 0 ] - [ $(cat $ASDF_DIR/installs/dummy/1.1/version) = "1.1" ] + [ $(cat $ASDF_DIR/installs/dummy/1.1.0/version) = "1.1.0" ] run asdf update [ "$status" -eq 0 ] - [ -f $ASDF_DIR/installs/dummy/1.1/version ] + [ -f $ASDF_DIR/installs/dummy/1.1.0/version ] run asdf update --head [ "$status" -eq 0 ] - [ -f $ASDF_DIR/installs/dummy/1.1/version ] + [ -f $ASDF_DIR/installs/dummy/1.1.0/version ] } @test "asdf update should not remove plugins" { @@ -96,7 +96,7 @@ teardown() { } @test "asdf update should not remove shims" { - run asdf install dummy 1.1 + run asdf install dummy 1.1.0 [ -f $ASDF_DIR/shims/dummy ] run asdf update [ "$status" -eq 0 ] diff --git a/test/version_commands.bats b/test/version_commands.bats index 96e775a0..e055213a 100644 --- a/test/version_commands.bats +++ b/test/version_commands.bats @@ -7,6 +7,7 @@ setup() { install_dummy_plugin install_dummy_version "1.0.0" install_dummy_version "1.1.0" + install_dummy_version "2.0.0" PROJECT_DIR=$HOME/project mkdir -p $PROJECT_DIR @@ -303,3 +304,24 @@ false" [ "$status" -eq 0 ] [ "$output" = "set -e ASDF_DUMMY_VERSION" ] } + +@test "shell wrapper function should support latest" { + source $(dirname "$BATS_TEST_DIRNAME")/asdf.sh + asdf shell "dummy" "latest" + [ $(echo $ASDF_DUMMY_VERSION) = "2.0.0" ] + unset ASDF_DUMMY_VERSION +} + +@test "global should support latest" { + echo 'dummy 1.0.0' >> $HOME/.tool-versions + run asdf global "dummy" "1.0.0" "latest" + [ "$status" -eq 0 ] + [ "$(cat $HOME/.tool-versions)" = "dummy 1.0.0 2.0.0" ] +} + +@test "local should support latest" { + echo 'dummy 1.0.0' >> $PROJECT_DIR/.tool-versions + run asdf local "dummy" "1.0.0" "latest" + [ "$status" -eq 0 ] + [ "$(cat $PROJECT_DIR/.tool-versions)" = "dummy 1.0.0 2.0.0" ] +} From 11b5403abb89fcd67fda3cc9693ed19321d4030e Mon Sep 17 00:00:00 2001 From: James Hegedus Date: Sat, 19 Sep 2020 15:40:11 +1000 Subject: [PATCH 10/13] chore: remove -vm from common usage as the tool is just asdf (#798) --- README.md | 13 +++++++------ docs/README.md | 4 ++-- docs/_coverpage.md | 6 +++--- docs/_sidebar.md | 4 ++-- ...ng-core-asdf-vm.md => contributing-core-asdf.md} | 0 docs/contributing-doc-site.md | 2 +- .../{core-manage-asdf-vm.md => core-manage-asdf.md} | 2 +- docs/core-manage-plugins.md | 4 ++-- docs/core-manage-versions.md | 4 ++-- docs/index.html | 4 ++-- 10 files changed, 22 insertions(+), 21 deletions(-) rename docs/{contributing-core-asdf-vm.md => contributing-core-asdf.md} (100%) rename docs/{core-manage-asdf-vm.md => core-manage-asdf.md} (98%) diff --git a/README.md b/README.md index 70567bc4..f4f3b3bb 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# asdf-vm [![Main workflow](https://github.com/asdf-vm/asdf/workflows/Main%20workflow/badge.svg)](https://github.com/asdf-vm/asdf/actions) +# asdf [![Main workflow](https://github.com/asdf-vm/asdf/workflows/Main%20workflow/badge.svg)](https://github.com/asdf-vm/asdf/actions) **Manage multiple runtime versions with a single CLI tool, extendable via plugins** - [docs at asdf-vm.com](https://asdf-vm.github.io/asdf/) -asdf-vm is a CLI tool that can manage multiple language runtime versions on a per-project basis. It is like `gvm`, `nvm`, `rbenv` & `pyenv` (and more) all in one! Simply install your language's plugin! +asdf is a CLI tool that can manage multiple language runtime versions on a per-project basis. It is like `gvm`, `nvm`, `rbenv` & `pyenv` (and more) all in one! Simply install your language's plugin! -## Why use asdf-vm? +## Why use asdf? - single CLI for multiple languages - consistent commands to manage all your languages @@ -19,7 +19,7 @@ asdf-vm is a CLI tool that can manage multiple language runtime versions on a pe [Please head over the documentation site for more information](https://asdf-vm.github.io/asdf/)! -- [Getting Started](https://asdf-vm.github.io/asdf/#/core-manage-asdf-vm) +- [Getting Started](https://asdf-vm.github.io/asdf/#/core-manage-asdf) - [All Commands](https://asdf-vm.github.io/asdf/#/core-commands) - [All Plugins](https://asdf-vm.github.io/asdf/#/plugins-all) - [Create a Plugin](https://asdf-vm.github.io/asdf/#/plugins-create) with our [asdf-plugin-template](https://github.com/asdf-vm/asdf-plugin-template) @@ -32,5 +32,6 @@ See [CONTRIBUTING.md in the repo](https://github.com/asdf-vm/asdf/blob/master/CO ## Community & Questions -- [![Github Issues](https://icongram.jgog.in/simple/github.svg?color=808080&size=16)Github Issues](https://github.com/asdf-vm/asdf/issues): report a bug or raise a feature request to the `asdf` core team -- [![StackOverflow Tag](https://icongr.am/fontawesome/stack-overflow.svg?size=16&color=808080)StackOverflow Tag](https://stackoverflow.com/questions/tagged/asdf-vm): see existing Q&A for `asdf`. Some of the core team watch this tag in addition to our helpful community + +- [![Github Issues](https://icongram.jgog.in/simple/github.svg?color=808080&size=16) Github Issues](https://github.com/asdf-vm/asdf/issues): report a bug or raise a feature request to the `asdf` core team +- [![StackOverflow Tag](https://icongr.am/fontawesome/stack-overflow.svg?size=16&color=808080) StackOverflow Tag](https://stackoverflow.com/questions/tagged/asdf-vm): see existing Q&A for `asdf`. Some of the core team watch this tag in addition to our helpful community diff --git a/docs/README.md b/docs/README.md index b4804fc6..28d2542a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,7 +1,7 @@ - + [](https://raw.githubusercontent.com/asdf-vm/asdf/master/README.md ':include') - + [](https://raw.githubusercontent.com/asdf-vm/asdf/master/ballad-of-asdf.md ':include') diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 3ae9d0f7..460192c7 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@ - + -# asdf-vm +# asdf > Manage multiple runtime versions with a single CLI tool @@ -11,4 +11,4 @@ - Extend with a simple plugin system [GitHub](https://github.com/asdf-vm/asdf) -[Get Started](core-manage-asdf-vm) +[Get Started](core-manage-asdf) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index d3c8753e..64e75dc3 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,7 +1,7 @@ - **Core** -- [Manage asdf-vm](core-manage-asdf-vm) +- [Manage asdf](core-manage-asdf) - [Manage Plugins](core-manage-plugins) - [Manage Versions](core-manage-versions) - [Configuration](core-configuration) @@ -11,7 +11,7 @@ - [Creating Plugins](plugins-create) - [All Plugins](plugins-all) - **Contributing** -- [Core asdf vm](contributing-core-asdf-vm) +- [Core asdf](contributing-core-asdf) - [Documentation Site](contributing-doc-site) - [Thanks](thanks) - **Community & Questions** diff --git a/docs/contributing-core-asdf-vm.md b/docs/contributing-core-asdf.md similarity index 100% rename from docs/contributing-core-asdf-vm.md rename to docs/contributing-core-asdf.md diff --git a/docs/contributing-doc-site.md b/docs/contributing-doc-site.md index e2c3f63e..9ad8788d 100644 --- a/docs/contributing-doc-site.md +++ b/docs/contributing-doc-site.md @@ -9,7 +9,7 @@ Here is a list of improvements we are looking at making to the documentation. If - change the typography - get a logo? - improve "edit on GitHub" button/link -- add asdf-vm to awesome-docsify showcase +- add asdf to awesome-docsify showcase ## Setup Your Environment diff --git a/docs/core-manage-asdf-vm.md b/docs/core-manage-asdf.md similarity index 98% rename from docs/core-manage-asdf-vm.md rename to docs/core-manage-asdf.md index f7cab1bd..ca73c641 100644 --- a/docs/core-manage-asdf-vm.md +++ b/docs/core-manage-asdf.md @@ -1,4 +1,4 @@ -1. [Manage asdf-vm](/core-manage-asdf-vm): install `asdf` **and** add `asdf` to your shell +1. [Manage asdf](/core-manage-asdf): install `asdf` **and** add `asdf` to your shell 2. [Manage Plugins](/core-manage-plugins): add a plugin for your tool `asdf plugin add nodejs` 3. [Manage Versions](/core-manage-versions): install a version of that tool `asdf install nodejs 13.14.0` 4. [Configuration](/core-configuration): set global and project tool versions via `.tool-versions` config diff --git a/docs/core-manage-plugins.md b/docs/core-manage-plugins.md index e9acd41f..f3b5d58f 100644 --- a/docs/core-manage-plugins.md +++ b/docs/core-manage-plugins.md @@ -1,6 +1,6 @@ -Plugins are how asdf-vm understands handling different packages. +Plugins are how asdf understands handling different packages. -See [All plugins](plugins-all) for the plugins repository which lists all asdf-vm plugins we know. +See [All plugins](plugins-all) for the plugins repository which lists all asdf plugins we know. See [Creating Plugins](plugins-create) for the super-simple API for supporting more languages. diff --git a/docs/core-manage-versions.md b/docs/core-manage-versions.md index 435a742b..1de9b03f 100644 --- a/docs/core-manage-versions.md +++ b/docs/core-manage-versions.md @@ -106,13 +106,13 @@ asdf uninstall ## Shims -When asdf-vm installs a package it creates shims for every executable program in that package in a `$ASDF_DATA_DIR/shims` directory (default `~/.asdf/shims`). This directory being on the `$PATH` (by means of `asdf.sh` or `asdf.fish`) is how the installed programs are made available in the environment. +When asdf installs a package it creates shims for every executable program in that package in a `$ASDF_DATA_DIR/shims` directory (default `~/.asdf/shims`). This directory being on the `$PATH` (by means of `asdf.sh` or `asdf.fish`) is how the installed programs are made available in the environment. The shims themselves are really simple wrappers that `exec` a helper program `asdf exec` passing it the name of the plugin and path to the executable in the installed package that the shim is wrapping. The `asdf exec` helper determines the version of the package to use (as specified in `.tool-versions` file, selected by `asdf local ...` or `asdf global ...`), the final path to the executable in the package installation directory (this can be manipulated by the `exec-path` callback in the plugin) and the environment to execute in (also provided by the plugin - `exec-env` script), and finally it executes it. -!> Note that because this system uses `exec` calls, any scripts in the package that are meant to be sourced by the shell instead of executed need to be accessed directly instead of via the shim wrapper. The two asdf-vm commands: `which` and `where` can help with this by returning the path to the installed package: +!> Note that because this system uses `exec` calls, any scripts in the package that are meant to be sourced by the shell instead of executed need to be accessed directly instead of via the shim wrapper. The two asdf commands: `which` and `where` can help with this by returning the path to the installed package: ```shell # returns path to main executable in current version diff --git a/docs/index.html b/docs/index.html index 1a65c9ab..317ac6e1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@ - asdf vm - An extendable version manager + asdf - An extendable version manager