mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
Merge branch 'master' of https://github.com/asdf-vm/asdf
This commit is contained in:
commit
d46d6ca6df
12
CHANGELOG.md
12
CHANGELOG.md
@ -4,9 +4,21 @@
|
||||
|
||||
Features
|
||||
|
||||
* Determine global tool version even when used outside of home directory (#106)
|
||||
|
||||
##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
|
||||
|
@ -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
|
||||
|
||||
```
|
||||
|
||||
@ -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`
|
||||
@ -56,7 +56,9 @@ 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) | [![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)
|
||||
| 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)
|
||||
|
@ -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"
|
||||
|
35
lib/utils.sh
35
lib/utils.sh
@ -56,20 +56,11 @@ display_error() {
|
||||
echo >&2 $1
|
||||
}
|
||||
|
||||
find_version() {
|
||||
get_version_in_dir() {
|
||||
local plugin_name=$1
|
||||
local search_path=$2
|
||||
local legacy_filenames=$3
|
||||
|
||||
local plugin_path=$(get_plugin_path "$plugin_name")
|
||||
local legacy_config=$(get_asdf_config_value "legacy_version_file")
|
||||
local legacy_list_filenames_script="${plugin_path}/bin/list-legacy-filenames"
|
||||
local legacy_filenames=""
|
||||
|
||||
if [ "$legacy_config" = "yes" ] && [ -f $legacy_list_filenames_script ]; then
|
||||
legacy_filenames=$(bash "$legacy_list_filenames_script")
|
||||
fi
|
||||
|
||||
while [ "$search_path" != "/" ]; do
|
||||
local asdf_version=$(parse_asdf_version_file "$search_path/.tool-versions" $plugin_name)
|
||||
|
||||
if [ -n "$asdf_version" ]; then
|
||||
@ -85,9 +76,31 @@ find_version() {
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
find_version() {
|
||||
local plugin_name=$1
|
||||
local search_path=$2
|
||||
|
||||
local plugin_path=$(get_plugin_path "$plugin_name")
|
||||
local legacy_config=$(get_asdf_config_value "legacy_version_file")
|
||||
local legacy_list_filenames_script="${plugin_path}/bin/list-legacy-filenames"
|
||||
local legacy_filenames=""
|
||||
|
||||
if [ "$legacy_config" = "yes" ] && [ -f $legacy_list_filenames_script ]; then
|
||||
legacy_filenames=$(bash "$legacy_list_filenames_script")
|
||||
fi
|
||||
|
||||
while [ "$search_path" != "/" ]; do
|
||||
local version=$(get_version_in_dir "$plugin_name" "$search_path" "$legacy_filenames")
|
||||
if [ -n "$version" ]; then
|
||||
echo "$version"
|
||||
return 0
|
||||
fi
|
||||
search_path=$(dirname "$search_path")
|
||||
done
|
||||
|
||||
get_version_in_dir "$plugin_name" "$HOME" "$legacy_filenames"
|
||||
}
|
||||
|
||||
parse_asdf_version_file() {
|
||||
|
@ -8,6 +8,9 @@ load test_helpers
|
||||
setup() {
|
||||
setup_asdf_dir
|
||||
install_dummy_plugin
|
||||
|
||||
PROJECT_DIR=$HOME/project
|
||||
mkdir $PROJECT_DIR
|
||||
}
|
||||
|
||||
teardown() {
|
||||
@ -27,3 +30,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" ]
|
||||
}
|
||||
|
@ -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" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user