From 2f550ccc83cbaf0b6b461d8e89e7f9ba7131fd8c Mon Sep 17 00:00:00 2001 From: David Kuhta Date: Sat, 8 Oct 2016 14:00:03 -0500 Subject: [PATCH 01/13] "You" to "Your" in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c77132e..c49ffd96 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ echo 'source ~/.asdf/asdf.fish' >> ~/.config/fish/config.fish mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions ``` -> For most plugins, it is good if you have installed the following packages OR their equivalent on you OS +> For most plugins, it is good if you have installed the following packages OR their equivalent on your OS > * **OS X**: Install these via homebrew `automake autoconf openssl libyaml readline libxslt libtool unixodbc` > * **Ubuntu**: `automake autoconf libreadline-dev libncurses-dev libssl-dev libyaml-dev libxslt-dev libffi-dev libtool unixodbc-dev` From 1729c7ab42ee2e9afab75a6ca6bf02087e21fbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20de=20Arriba?= Date: Mon, 17 Oct 2016 07:56:11 +0200 Subject: [PATCH 02/13] Add asdf-php to list of plugins --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c49ffd96..321c5572 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Plugins are how asdf understands how to handle different packages. Below is a li | Lua | [Stratus3D/asdf-lua](https://github.com/Stratus3D/asdf-lua) | [![Build Status](https://travis-ci.org/Stratus3D/asdf-lua.svg?branch=master)](https://travis-ci.org/Stratus3D/asdf-lua) | OpenResty | [smashedtoatoms/asdf-openresty](https://github.com/smashedtoatoms/asdf-openresty) | [![Build Status](https://travis-ci.org/smashedtoatoms/asdf-openresty.svg?branch=master)](https://travis-ci.org/smashedtoatoms/asdf-openresty) | Node.js | [asdf-vm/asdf-nodejs](https://github.com/asdf-vm/asdf-nodejs) | [![Build Status](https://travis-ci.org/asdf-vm/asdf-nodejs.svg?branch=master)](https://travis-ci.org/asdf-vm/asdf-nodejs) +| PHP | [odarriba/asdf-php](https://github.com/odarriba/asdf-php) | [![Build Status](https://travis-ci.org/odarriba/asdf-php.svg?branch=master)](https://travis-ci.org/odarriba/asdf-php) | Postgres | [smashedtoatoms/asdf-postgres](https://github.com/smashedtoatoms/asdf-postgres) | [![Build Status](https://travis-ci.org/smashedtoatoms/asdf-postgres.svg?branch=master)](https://travis-ci.org/smashedtoatoms/asdf-postgres) | Python | [tuvistavie/asdf-python](https://github.com/tuvistavie/asdf-python) | [![Build Status](https://travis-ci.org/tuvistavie/asdf-python.svg?branch=master)](https://travis-ci.org/tuvistavie/asdf-python) | Redis | [smashedtoatoms/asdf-redis](https://github.com/smashedtoatoms/asdf-redis) | [![Build Status](https://travis-ci.org/smashedtoatoms/asdf-redis.svg?branch=master)](https://travis-ci.org/smashedtoatoms/asdf-redis) From a58f48f01fc6d1d02ab43c522361a7e8513174b6 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Sat, 22 Oct 2016 14:55:58 -0400 Subject: [PATCH 03/13] Prepare for 0.2.0 release * Add everything that was merged for 0.2.0 to the changelog. * Update install command in the readme with 0.2.0 tag. --- CHANGELOG.md | 8 ++++++++ README.md | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3542fe0b..5bf85ba6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,19 @@ ##0.2.0-dev +##0.2.0 + Features +* Improve plugin API for legacy file support (#87) * Unify `asdf local` and `asdf global` version getters as `asdf current` (#83) * Rename `asdf which` to `asdf current` (#78) +Fixed Bugs + +* Fix bug that caused the `local` command to crash when the directory contains whitespace (#90) +* Misc typo corrections (#93, #99) + ##0.1.0 * First tagged release diff --git a/README.md b/README.md index 5124db05..7be83a98 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Supported languages include Ruby, Node.js, Elixir and more. Supporting a new lan Copy-paste the following into command line: ```bash -git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.1.0 +git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.2.0 ``` From e2a9f88730e4038f9a0ac4cdb0acafdfa8459df4 Mon Sep 17 00:00:00 2001 From: Brian van Burken Date: Tue, 25 Oct 2016 17:47:22 +0200 Subject: [PATCH 04/13] Add MongoDB plugin to README Usage list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 321c5572..cdceff3a 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Plugins are how asdf understands how to handle different packages. Below is a li | Go | [kennyp/asdf-golang](https://github.com/kennyp/asdf-golang) | [![Build Status](https://travis-ci.org/kennyp/asdf-golang.svg?branch=master)](https://travis-ci.org/kennyp/asdf-golang) | Lua | [Stratus3D/asdf-lua](https://github.com/Stratus3D/asdf-lua) | [![Build Status](https://travis-ci.org/Stratus3D/asdf-lua.svg?branch=master)](https://travis-ci.org/Stratus3D/asdf-lua) | OpenResty | [smashedtoatoms/asdf-openresty](https://github.com/smashedtoatoms/asdf-openresty) | [![Build Status](https://travis-ci.org/smashedtoatoms/asdf-openresty.svg?branch=master)](https://travis-ci.org/smashedtoatoms/asdf-openresty) +| MongoDB | [sylph01/asdf-mongodb](https://github.com/sylph01/asdf-mongodb) | | Node.js | [asdf-vm/asdf-nodejs](https://github.com/asdf-vm/asdf-nodejs) | [![Build Status](https://travis-ci.org/asdf-vm/asdf-nodejs.svg?branch=master)](https://travis-ci.org/asdf-vm/asdf-nodejs) | PHP | [odarriba/asdf-php](https://github.com/odarriba/asdf-php) | [![Build Status](https://travis-ci.org/odarriba/asdf-php.svg?branch=master)](https://travis-ci.org/odarriba/asdf-php) | Postgres | [smashedtoatoms/asdf-postgres](https://github.com/smashedtoatoms/asdf-postgres) | [![Build Status](https://travis-ci.org/smashedtoatoms/asdf-postgres.svg?branch=master)](https://travis-ci.org/smashedtoatoms/asdf-postgres) From 8bc937689c59b930609fc60abab147653b96e92c Mon Sep 17 00:00:00 2001 From: Stratus3D Date: Tue, 25 Oct 2016 18:11:36 -0400 Subject: [PATCH 05/13] Add test for the install command in a directory name containing whitespace. --- test/install_command.bats | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/install_command.bats b/test/install_command.bats index 8ceafba0..98ce92ca 100644 --- a/test/install_command.bats +++ b/test/install_command.bats @@ -27,3 +27,15 @@ teardown() { run grep ASDF_CONCURRENCY $ASDF_DIR/installs/dummy/1.0/env [ "$status" -eq 0 ] } + +@test "install_command should work in directory containing whitespace" { + WHITESPACE_DIR="$PROJECT_DIR/whitespace\ dir" + mkdir -p "$WHITESPACE_DIR" + cd "$WHITESPACE_DIR" + echo 'dummy 1.2' >> "$WHITESPACE_DIR/.tool-versions" + + run install_command + + [ "$status" -eq 0 ] + [ $(cat $ASDF_DIR/installs/dummy/1.2/version) = "1.2" ] +} From 20ef5321e15f8bd6615778a9fb5031ff9f40ba58 Mon Sep 17 00:00:00 2001 From: Stratus3D Date: Tue, 25 Oct 2016 18:13:13 -0400 Subject: [PATCH 06/13] Update the install_command function so it works when invoked in directory whose name contains whitespace. --- lib/commands/install.sh | 6 +++--- test/install_command.bats | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/commands/install.sh b/lib/commands/install.sh index 14fa680b..19ea5019 100644 --- a/lib/commands/install.sh +++ b/lib/commands/install.sh @@ -22,8 +22,8 @@ get_concurrency() { } install_local_tool_versions() { - if [ -f $(pwd)/.tool-versions ]; then - local asdf_versions_path=$(pwd)/.tool-versions + if [ -f "$(pwd)/.tool-versions" ]; then + local asdf_versions_path="$(pwd)/.tool-versions" while read tool_line; do IFS=' ' read -a tool_info <<< $tool_line @@ -33,7 +33,7 @@ install_local_tool_versions() { if ! [[ -z "$tool_name" || -z "$tool_version" ]]; then install_tool_version $tool_name $tool_version fi - done < $asdf_versions_path + done < "$asdf_versions_path" else echo "Either specify a tool & version in the command" echo "OR add .tool-versions file in this directory" diff --git a/test/install_command.bats b/test/install_command.bats index 98ce92ca..ad30ef4a 100644 --- a/test/install_command.bats +++ b/test/install_command.bats @@ -8,6 +8,9 @@ load test_helpers setup() { setup_asdf_dir install_dummy_plugin + + PROJECT_DIR=$HOME/project + mkdir $PROJECT_DIR } teardown() { From 26532e79145ad0a75db1bc23b2aa6aee3e736680 Mon Sep 17 00:00:00 2001 From: Victor Borja Date: Sat, 29 Oct 2016 06:08:54 -0500 Subject: [PATCH 07/13] Determine version from global setting when project is outside home. Without this patch, asft was not able to determine the tool version for a project located outside the user's HOME directory. ``` /work/project/ /home/me/.tool-versions ``` This changeset lets asdf find the global version stored at $HOME/.tool-versions when the directory traversal from the project dir was not able to find a suitable version. --- lib/utils.sh | 41 +++++++++++++++++++++++++++-------------- test/utils.bats | 9 +++++++++ 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lib/utils.sh b/lib/utils.sh index 5f7cec6a..aba377dd 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -56,6 +56,28 @@ display_error() { echo >&2 $1 } +get_version_in_dir() { + local plugin_name=$1 + local search_path=$2 + local legacy_filenames=$3 + + local asdf_version=$(parse_asdf_version_file "$search_path/.tool-versions" $plugin_name) + + if [ -n "$asdf_version" ]; then + echo "$asdf_version:$search_path/.tool-versions" + return 0 + fi + + for filename in $legacy_filenames; do + local legacy_version=$(parse_legacy_version_file "$search_path/$filename" $plugin_name) + + if [ -n "$legacy_version" ]; then + echo "$legacy_version:$search_path/$filename" + return 0 + fi + done +} + find_version() { local plugin_name=$1 local search_path=$2 @@ -70,24 +92,15 @@ find_version() { fi while [ "$search_path" != "/" ]; do - local asdf_version=$(parse_asdf_version_file "$search_path/.tool-versions" $plugin_name) - - if [ -n "$asdf_version" ]; then - echo "$asdf_version:$search_path/.tool-versions" + local version=$(get_version_in_dir "$plugin_name" "$search_path" "$legacy_filenames") + if [ -n "$version" ]; then + echo "$version" return 0 fi - - for filename in $legacy_filenames; do - local legacy_version=$(parse_legacy_version_file "$search_path/$filename" $plugin_name) - - if [ -n "$legacy_version" ]; then - echo "$legacy_version:$search_path/$filename" - return 0 - fi - done - search_path=$(dirname "$search_path") done + + get_version_in_dir "$plugin_name" "$HOME" "$legacy_filenames" } parse_asdf_version_file() { diff --git a/test/utils.bats b/test/utils.bats index 5d5c8c66..34ff2fbe 100644 --- a/test/utils.bats +++ b/test/utils.bats @@ -92,3 +92,12 @@ teardown() { [ "$status" -eq 0 ] [ "$output" = "0.2.0" ] } + +@test "get_preset_version_for returns the global version from home when project is outside of home" { + echo "dummy 0.1.0" > $HOME/.tool-versions + PROJECT_DIR=$BASE_DIR/project + mkdir -p $PROJECT_DIR + run get_preset_version_for "dummy" + [ "$status" -eq 0 ] + [ "$output" = "0.1.0" ] +} From 5411e9f16f800896b3651ae4d5aab16e50baeabc Mon Sep 17 00:00:00 2001 From: Stratus3D Date: Thu, 3 Nov 2016 11:43:17 -0400 Subject: [PATCH 08/13] Add line to changelog listing recently merged PR. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bf85ba6..e36e9b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ##0.2.0-dev +Features + +* Determine global tool version even when used outside of home directory (#106) + ##0.2.0 Features From 2ebaa4b8c71a345224a45ed4303faf608d1038a9 Mon Sep 17 00:00:00 2001 From: Stratus3D Date: Tue, 25 Oct 2016 18:11:36 -0400 Subject: [PATCH 09/13] Add test for the install command in a directory name containing whitespace. --- test/install_command.bats | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/install_command.bats b/test/install_command.bats index 8ceafba0..98ce92ca 100644 --- a/test/install_command.bats +++ b/test/install_command.bats @@ -27,3 +27,15 @@ teardown() { run grep ASDF_CONCURRENCY $ASDF_DIR/installs/dummy/1.0/env [ "$status" -eq 0 ] } + +@test "install_command should work in directory containing whitespace" { + WHITESPACE_DIR="$PROJECT_DIR/whitespace\ dir" + mkdir -p "$WHITESPACE_DIR" + cd "$WHITESPACE_DIR" + echo 'dummy 1.2' >> "$WHITESPACE_DIR/.tool-versions" + + run install_command + + [ "$status" -eq 0 ] + [ $(cat $ASDF_DIR/installs/dummy/1.2/version) = "1.2" ] +} From 74fe3d6b20577c18d18af6e21d27d8f55bca5cdd Mon Sep 17 00:00:00 2001 From: Stratus3D Date: Tue, 25 Oct 2016 18:13:13 -0400 Subject: [PATCH 10/13] Update the install_command function so it works when invoked in directory whose name contains whitespace. --- lib/commands/install.sh | 6 +++--- test/install_command.bats | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/commands/install.sh b/lib/commands/install.sh index 14fa680b..19ea5019 100644 --- a/lib/commands/install.sh +++ b/lib/commands/install.sh @@ -22,8 +22,8 @@ get_concurrency() { } install_local_tool_versions() { - if [ -f $(pwd)/.tool-versions ]; then - local asdf_versions_path=$(pwd)/.tool-versions + if [ -f "$(pwd)/.tool-versions" ]; then + local asdf_versions_path="$(pwd)/.tool-versions" while read tool_line; do IFS=' ' read -a tool_info <<< $tool_line @@ -33,7 +33,7 @@ install_local_tool_versions() { if ! [[ -z "$tool_name" || -z "$tool_version" ]]; then install_tool_version $tool_name $tool_version fi - done < $asdf_versions_path + done < "$asdf_versions_path" else echo "Either specify a tool & version in the command" echo "OR add .tool-versions file in this directory" diff --git a/test/install_command.bats b/test/install_command.bats index 98ce92ca..ad30ef4a 100644 --- a/test/install_command.bats +++ b/test/install_command.bats @@ -8,6 +8,9 @@ load test_helpers setup() { setup_asdf_dir install_dummy_plugin + + PROJECT_DIR=$HOME/project + mkdir $PROJECT_DIR } teardown() { From 42f57d0074f52da91d3a016b35a859dbd1e8a005 Mon Sep 17 00:00:00 2001 From: Victor Borja Date: Sat, 29 Oct 2016 06:08:54 -0500 Subject: [PATCH 11/13] Determine version from global setting when project is outside home. Without this patch, asft was not able to determine the tool version for a project located outside the user's HOME directory. ``` /work/project/ /home/me/.tool-versions ``` This changeset lets asdf find the global version stored at $HOME/.tool-versions when the directory traversal from the project dir was not able to find a suitable version. --- lib/utils.sh | 41 +++++++++++++++++++++++++++-------------- test/utils.bats | 9 +++++++++ 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lib/utils.sh b/lib/utils.sh index 5f7cec6a..aba377dd 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -56,6 +56,28 @@ display_error() { echo >&2 $1 } +get_version_in_dir() { + local plugin_name=$1 + local search_path=$2 + local legacy_filenames=$3 + + local asdf_version=$(parse_asdf_version_file "$search_path/.tool-versions" $plugin_name) + + if [ -n "$asdf_version" ]; then + echo "$asdf_version:$search_path/.tool-versions" + return 0 + fi + + for filename in $legacy_filenames; do + local legacy_version=$(parse_legacy_version_file "$search_path/$filename" $plugin_name) + + if [ -n "$legacy_version" ]; then + echo "$legacy_version:$search_path/$filename" + return 0 + fi + done +} + find_version() { local plugin_name=$1 local search_path=$2 @@ -70,24 +92,15 @@ find_version() { fi while [ "$search_path" != "/" ]; do - local asdf_version=$(parse_asdf_version_file "$search_path/.tool-versions" $plugin_name) - - if [ -n "$asdf_version" ]; then - echo "$asdf_version:$search_path/.tool-versions" + local version=$(get_version_in_dir "$plugin_name" "$search_path" "$legacy_filenames") + if [ -n "$version" ]; then + echo "$version" return 0 fi - - for filename in $legacy_filenames; do - local legacy_version=$(parse_legacy_version_file "$search_path/$filename" $plugin_name) - - if [ -n "$legacy_version" ]; then - echo "$legacy_version:$search_path/$filename" - return 0 - fi - done - search_path=$(dirname "$search_path") done + + get_version_in_dir "$plugin_name" "$HOME" "$legacy_filenames" } parse_asdf_version_file() { diff --git a/test/utils.bats b/test/utils.bats index 5d5c8c66..34ff2fbe 100644 --- a/test/utils.bats +++ b/test/utils.bats @@ -92,3 +92,12 @@ teardown() { [ "$status" -eq 0 ] [ "$output" = "0.2.0" ] } + +@test "get_preset_version_for returns the global version from home when project is outside of home" { + echo "dummy 0.1.0" > $HOME/.tool-versions + PROJECT_DIR=$BASE_DIR/project + mkdir -p $PROJECT_DIR + run get_preset_version_for "dummy" + [ "$status" -eq 0 ] + [ "$output" = "0.1.0" ] +} From 2e54209bef72de245cd76723af8cb566889d7e44 Mon Sep 17 00:00:00 2001 From: Stratus3D Date: Thu, 3 Nov 2016 11:43:17 -0400 Subject: [PATCH 12/13] Add line to changelog listing recently merged PR. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bf85ba6..e36e9b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ##0.2.0-dev +Features + +* Determine global tool version even when used outside of home directory (#106) + ##0.2.0 Features From 4203844c2bb4d70dbb0b65076a566a40991bfa43 Mon Sep 17 00:00:00 2001 From: Stratus3D Date: Fri, 4 Nov 2016 12:06:25 -0400 Subject: [PATCH 13/13] Add MongoDB build link to readme. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4db79cea..8c9b6ad5 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Plugins are how asdf understands how to handle different packages. Below is a li | Go | [kennyp/asdf-golang](https://github.com/kennyp/asdf-golang) | [![Build Status](https://travis-ci.org/kennyp/asdf-golang.svg?branch=master)](https://travis-ci.org/kennyp/asdf-golang) | Lua | [Stratus3D/asdf-lua](https://github.com/Stratus3D/asdf-lua) | [![Build Status](https://travis-ci.org/Stratus3D/asdf-lua.svg?branch=master)](https://travis-ci.org/Stratus3D/asdf-lua) | OpenResty | [smashedtoatoms/asdf-openresty](https://github.com/smashedtoatoms/asdf-openresty) | [![Build Status](https://travis-ci.org/smashedtoatoms/asdf-openresty.svg?branch=master)](https://travis-ci.org/smashedtoatoms/asdf-openresty) -| MongoDB | [sylph01/asdf-mongodb](https://github.com/sylph01/asdf-mongodb) | +| MongoDB | [sylph01/asdf-mongodb](https://github.com/sylph01/asdf-mongodb) | [![Build Status](https://travis-ci.org/sylph01/asdf-mongodb.svg?branch=master)](https://travis-ci.org/sylph01/asdf-mongodb) | Node.js | [asdf-vm/asdf-nodejs](https://github.com/asdf-vm/asdf-nodejs) | [![Build Status](https://travis-ci.org/asdf-vm/asdf-nodejs.svg?branch=master)](https://travis-ci.org/asdf-vm/asdf-nodejs) | PHP | [odarriba/asdf-php](https://github.com/odarriba/asdf-php) | [![Build Status](https://travis-ci.org/odarriba/asdf-php.svg?branch=master)](https://travis-ci.org/odarriba/asdf-php) | Postgres | [smashedtoatoms/asdf-postgres](https://github.com/smashedtoatoms/asdf-postgres) | [![Build Status](https://travis-ci.org/smashedtoatoms/asdf-postgres.svg?branch=master)](https://travis-ci.org/smashedtoatoms/asdf-postgres)