mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix: clarify the wording when no version is set (#1088)
Co-authored-by: Chris Rose <offline@offby1.net> Co-authored-by: jthegedus <jthegedus@hey.com>
This commit is contained in:
parent
ca77d42758
commit
41162849cf
@ -31,7 +31,7 @@ plugin_current_command() {
|
||||
printf "$terminal_format" "$plugin" "$version" "$description" 1>&2
|
||||
return 1
|
||||
elif [ -z "$full_version" ]; then
|
||||
description="No version set. Run \"asdf <global|shell|local> $plugin <version>\""
|
||||
description="No version is set. Run \"asdf <global|shell|local> $plugin <version>\""
|
||||
printf "$terminal_format" "$plugin" "______" "$description" 1>&2
|
||||
return 126
|
||||
else
|
||||
|
@ -223,7 +223,7 @@ find_versions() {
|
||||
|
||||
display_no_version_set() {
|
||||
local plugin_name=$1
|
||||
printf "No version set for %s; please run \`asdf <global | shell | local> %s <version>\`\\n" "$plugin_name" "$plugin_name"
|
||||
printf "No version is set for %s; please run \`asdf <global | shell | local> %s <version>\`\\n" "$plugin_name" "$plugin_name"
|
||||
}
|
||||
|
||||
get_version_from_env() {
|
||||
@ -798,7 +798,7 @@ with_shim_executable() {
|
||||
done
|
||||
printf "\\n%s %s\\n" "or add one of the following versions in your config file at" "$closest_tool_version"
|
||||
else
|
||||
printf "%s %s\\n" "No version set for command" "$shim_name"
|
||||
printf "%s %s\\n" "No version is set for command" "$shim_name"
|
||||
printf "%s %s\\n" "Consider adding one of the following versions in your config file at" "$closest_tool_version"
|
||||
fi
|
||||
shim_plugin_versions "${shim_name}"
|
||||
|
@ -19,7 +19,7 @@ teardown() {
|
||||
|
||||
@test "current should derive from the current .tool-versions" {
|
||||
cd $PROJECT_DIR
|
||||
echo 'dummy 1.1.0' >> $PROJECT_DIR/.tool-versions
|
||||
echo 'dummy 1.1.0' >>$PROJECT_DIR/.tool-versions
|
||||
expected="dummy 1.1.0 $PROJECT_DIR/.tool-versions"
|
||||
|
||||
run asdf current "dummy"
|
||||
@ -29,7 +29,7 @@ teardown() {
|
||||
|
||||
@test "current should handle long version name" {
|
||||
cd $PROJECT_DIR
|
||||
echo "dummy nightly-2000-01-01" >> $PROJECT_DIR/.tool-versions
|
||||
echo "dummy nightly-2000-01-01" >>$PROJECT_DIR/.tool-versions
|
||||
expected="dummy nightly-2000-01-01 $PROJECT_DIR/.tool-versions"
|
||||
|
||||
run asdf current "dummy"
|
||||
@ -39,7 +39,7 @@ teardown() {
|
||||
|
||||
@test "current should handle multiple versions" {
|
||||
cd $PROJECT_DIR
|
||||
echo "dummy 1.2.0 1.1.0" >> $PROJECT_DIR/.tool-versions
|
||||
echo "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"
|
||||
@ -47,11 +47,10 @@ teardown() {
|
||||
[ "$output" = "$expected" ]
|
||||
}
|
||||
|
||||
|
||||
@test "current should derive from the legacy file if enabled" {
|
||||
cd $PROJECT_DIR
|
||||
echo 'legacy_version_file = yes' > $HOME/.asdfrc
|
||||
echo '1.2.0' >> $PROJECT_DIR/.dummy-version
|
||||
echo 'legacy_version_file = yes' >$HOME/.asdfrc
|
||||
echo '1.2.0' >>$PROJECT_DIR/.dummy-version
|
||||
expected="dummy 1.2.0 $PROJECT_DIR/.dummy-version"
|
||||
|
||||
run asdf current "dummy"
|
||||
@ -70,7 +69,7 @@ teardown() {
|
||||
|
||||
@test "current should error when no version is set" {
|
||||
cd $PROJECT_DIR
|
||||
expected="dummy ______ No version set. Run \"asdf <global|shell|local> dummy <version>\""
|
||||
expected="dummy ______ No version is set. Run \"asdf <global|shell|local> dummy <version>\""
|
||||
|
||||
run asdf current "dummy"
|
||||
[ "$status" -eq 126 ]
|
||||
@ -79,7 +78,7 @@ teardown() {
|
||||
|
||||
@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
|
||||
echo 'dummy 9.9.9' >>$PROJECT_DIR/.tool-versions
|
||||
expected="dummy 9.9.9 Not installed. Run \"asdf install dummy 9.9.9\""
|
||||
|
||||
run asdf current "dummy"
|
||||
@ -98,11 +97,11 @@ teardown() {
|
||||
install_mock_plugin "baz"
|
||||
|
||||
cd $PROJECT_DIR
|
||||
echo 'dummy 1.1.0' >> $PROJECT_DIR/.tool-versions
|
||||
echo 'foobar 1.0.0' >> $PROJECT_DIR/.tool-versions
|
||||
echo 'dummy 1.1.0' >>$PROJECT_DIR/.tool-versions
|
||||
echo 'foobar 1.0.0' >>$PROJECT_DIR/.tool-versions
|
||||
|
||||
run asdf current
|
||||
expected="baz ______ No version set. Run \"asdf <global|shell|local> baz <version>\"
|
||||
expected="baz ______ No version is set. Run \"asdf <global|shell|local> baz <version>\"
|
||||
dummy 1.1.0 $PROJECT_DIR/.tool-versions
|
||||
foobar 1.0.0 $PROJECT_DIR/.tool-versions"
|
||||
|
||||
@ -117,8 +116,8 @@ foobar 1.0.0 $PROJECT_DIR/.tool-versions"
|
||||
install_mock_plugin_version "y" "2.1.0"
|
||||
|
||||
cd $PROJECT_DIR
|
||||
echo 'dummy 1.1.0' >> $PROJECT_DIR/.tool-versions
|
||||
echo 'y 2.1.0' >> $PROJECT_DIR/.tool-versions
|
||||
echo 'dummy 1.1.0' >>$PROJECT_DIR/.tool-versions
|
||||
echo 'y 2.1.0' >>$PROJECT_DIR/.tool-versions
|
||||
|
||||
run asdf current "y"
|
||||
[ "$status" -eq 0 ]
|
||||
@ -136,7 +135,7 @@ foobar 1.0.0 $PROJECT_DIR/.tool-versions"
|
||||
|
||||
@test "current should handle comments" {
|
||||
cd $PROJECT_DIR
|
||||
echo "dummy 1.2.0 # this is a comment" >> $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.2.0 # this is a comment" >>$PROJECT_DIR/.tool-versions
|
||||
expected="dummy 1.2.0 $PROJECT_DIR/.tool-versions"
|
||||
|
||||
run asdf current "dummy"
|
||||
|
@ -25,7 +25,7 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "asdf exec should pass all arguments to executable" {
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
run asdf install
|
||||
|
||||
run asdf exec dummy world hello
|
||||
@ -34,7 +34,7 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "asdf exec should pass all arguments to executable even if shim is not in PATH" {
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
run asdf install
|
||||
|
||||
path=$(echo "$PATH" | sed -e "s|$(asdf_data_dir)/shims||g; s|::|:|g")
|
||||
@ -48,7 +48,7 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "shim exec should pass all arguments to executable" {
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
run asdf install
|
||||
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
@ -57,10 +57,10 @@ teardown() {
|
||||
}
|
||||
|
||||
@test "shim exec should pass stdin to executable" {
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
run asdf install
|
||||
|
||||
echo "tr [:lower:] [:upper:]" > $ASDF_DIR/installs/dummy/1.0/bin/upper
|
||||
echo "tr [:lower:] [:upper:]" >$ASDF_DIR/installs/dummy/1.0/bin/upper
|
||||
chmod +x $ASDF_DIR/installs/dummy/1.0/bin/upper
|
||||
|
||||
run asdf reshim dummy 1.0
|
||||
@ -77,7 +77,7 @@ teardown() {
|
||||
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
[ "$status" -eq 126 ]
|
||||
echo "$output" | grep -q "No version set for command dummy" 2>/dev/null
|
||||
echo "$output" | grep -q "No version is set for command dummy" 2>/dev/null
|
||||
}
|
||||
|
||||
@test "shim exec should suggest which plugin to use when no version is selected" {
|
||||
@ -89,7 +89,7 @@ teardown() {
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
[ "$status" -eq 126 ]
|
||||
|
||||
echo "$output" | grep -q "No version set for command dummy" 2>/dev/null
|
||||
echo "$output" | grep -q "No version is 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.0" 2>/dev/null
|
||||
@ -107,7 +107,7 @@ teardown() {
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
[ "$status" -eq 126 ]
|
||||
|
||||
echo "$output" | grep -q "No version set for command dummy" 2>/dev/null
|
||||
echo "$output" | grep -q "No version is 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 "mummy 3.0" 2>/dev/null
|
||||
@ -116,7 +116,7 @@ teardown() {
|
||||
@test "shim exec should suggest to install missing version" {
|
||||
run asdf install dummy 1.0
|
||||
|
||||
echo "dummy 2.0.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 ]
|
||||
@ -132,7 +132,7 @@ teardown() {
|
||||
run asdf install dummy 2.0.0
|
||||
run asdf install dummy 3.0
|
||||
|
||||
echo "dummy 1.0 3.0 2.0.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 ]
|
||||
@ -143,8 +143,8 @@ teardown() {
|
||||
@test "shim exec should only use the first version found for a plugin" {
|
||||
run asdf install dummy 3.0
|
||||
|
||||
echo "dummy 3.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >> $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 3.0" >$PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >>$PROJECT_DIR/.tool-versions
|
||||
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
[ "$status" -eq 0 ]
|
||||
@ -161,8 +161,8 @@ teardown() {
|
||||
run asdf install dummy 1.0
|
||||
|
||||
mkdir $PROJECT_DIR/{A,B}
|
||||
echo "dummy 1.0" > $PROJECT_DIR/A/.tool-versions
|
||||
echo "mummy 3.0" > $PROJECT_DIR/B/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/A/.tool-versions
|
||||
echo "mummy 3.0" >$PROJECT_DIR/B/.tool-versions
|
||||
|
||||
cd $PROJECT_DIR/A
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
@ -183,9 +183,9 @@ teardown() {
|
||||
run asdf install dummy 1.0
|
||||
run asdf install mummy 3.0
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
[ "$output" == "This is Mummy 3.0! hello world" ]
|
||||
@ -195,10 +195,10 @@ teardown() {
|
||||
@test "shim exec should fallback to system executable when specified version is system" {
|
||||
run asdf install dummy 1.0
|
||||
|
||||
echo "dummy system" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
||||
|
||||
mkdir $PROJECT_DIR/foo/
|
||||
echo "echo System" > $PROJECT_DIR/foo/dummy
|
||||
echo "echo System" >$PROJECT_DIR/foo/dummy
|
||||
chmod +x $PROJECT_DIR/foo/dummy
|
||||
|
||||
run env PATH=$PATH:$PROJECT_DIR/foo $ASDF_DIR/shims/dummy hello
|
||||
@ -211,10 +211,10 @@ teardown() {
|
||||
CUSTOM_DUMMY_PATH=$PROJECT_DIR/foo
|
||||
CUSTOM_DUMMY_BIN_PATH=$CUSTOM_DUMMY_PATH/bin
|
||||
mkdir -p $CUSTOM_DUMMY_BIN_PATH
|
||||
echo "echo System" > $CUSTOM_DUMMY_BIN_PATH/dummy
|
||||
echo "echo System" >$CUSTOM_DUMMY_BIN_PATH/dummy
|
||||
chmod +x $CUSTOM_DUMMY_BIN_PATH/dummy
|
||||
|
||||
echo "dummy path:$CUSTOM_DUMMY_PATH" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy path:$CUSTOM_DUMMY_PATH" >$PROJECT_DIR/.tool-versions
|
||||
|
||||
run $ASDF_DIR/shims/dummy hello
|
||||
[ "$output" == "System" ]
|
||||
@ -223,11 +223,11 @@ teardown() {
|
||||
@test "shim exec should execute system if set first" {
|
||||
run asdf install dummy 2.0.0
|
||||
|
||||
echo "dummy system" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 2.0.0" >> $PROJECT_DIR/.tool-versions
|
||||
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
||||
echo "dummy 2.0.0" >>$PROJECT_DIR/.tool-versions
|
||||
|
||||
mkdir $PROJECT_DIR/foo/
|
||||
echo "echo System" > $PROJECT_DIR/foo/dummy
|
||||
echo "echo System" >$PROJECT_DIR/foo/dummy
|
||||
chmod +x $PROJECT_DIR/foo/dummy
|
||||
|
||||
run env PATH=$PATH:$PROJECT_DIR/foo $ASDF_DIR/shims/dummy hello
|
||||
@ -236,42 +236,42 @@ teardown() {
|
||||
|
||||
@test "shim exec should use custom exec-env for tool" {
|
||||
run asdf install dummy 2.0.0
|
||||
echo "export FOO=sourced" > $ASDF_DIR/plugins/dummy/bin/exec-env
|
||||
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
|
||||
echo 'echo $FOO custom' >$ASDF_DIR/plugins/dummy/shims/foo
|
||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
||||
run asdf reshim dummy 2.0.0
|
||||
|
||||
echo "dummy 2.0.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.0
|
||||
echo 'export FOO=$ASDF_INSTALL_PATH/foo' > $ASDF_DIR/plugins/dummy/bin/exec-env
|
||||
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
|
||||
echo 'echo $FOO custom' >$ASDF_DIR/plugins/dummy/shims/foo
|
||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
||||
run asdf reshim dummy 2.0.0
|
||||
|
||||
echo "dummy 2.0.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.0/foo custom" ]
|
||||
}
|
||||
|
||||
@test "shim exec doest not use custom exec-env for system version" {
|
||||
run asdf install dummy 2.0.0
|
||||
echo "export FOO=sourced" > $ASDF_DIR/plugins/dummy/bin/exec-env
|
||||
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
|
||||
echo 'echo $FOO custom' >$ASDF_DIR/plugins/dummy/shims/foo
|
||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
||||
run asdf reshim dummy 2.0.0
|
||||
|
||||
echo "dummy system" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
||||
|
||||
mkdir $PROJECT_DIR/sys/
|
||||
echo 'echo x$FOO System' > $PROJECT_DIR/sys/foo
|
||||
echo 'echo x$FOO System' >$PROJECT_DIR/sys/foo
|
||||
chmod +x $PROJECT_DIR/sys/foo
|
||||
|
||||
run env PATH=$PATH:$PROJECT_DIR/sys $ASDF_DIR/shims/foo
|
||||
@ -282,11 +282,11 @@ teardown() {
|
||||
run asdf install dummy 2.0.0
|
||||
|
||||
mkdir $ASDF_DIR/plugins/dummy/shims
|
||||
echo 'which dummy' > $ASDF_DIR/plugins/dummy/shims/foo
|
||||
echo 'which dummy' >$ASDF_DIR/plugins/dummy/shims/foo
|
||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
||||
run asdf reshim dummy 2.0.0
|
||||
|
||||
echo "dummy 2.0.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.0/bin/dummy" ]
|
||||
@ -295,17 +295,17 @@ teardown() {
|
||||
@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.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "gummy 2.0.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
|
||||
|
||||
mkdir $ASDF_DIR/plugins/{dummy,gummy}/shims
|
||||
|
||||
echo 'which dummy' > $ASDF_DIR/plugins/dummy/shims/foo
|
||||
echo 'which dummy' >$ASDF_DIR/plugins/dummy/shims/foo
|
||||
chmod +x $ASDF_DIR/plugins/dummy/shims/foo
|
||||
|
||||
echo 'which gummy' > $ASDF_DIR/plugins/dummy/shims/bar
|
||||
echo 'which gummy' >$ASDF_DIR/plugins/dummy/shims/bar
|
||||
chmod +x $ASDF_DIR/plugins/dummy/shims/bar
|
||||
|
||||
touch $ASDF_DIR/plugins/gummy/shims/gummy
|
||||
@ -323,10 +323,10 @@ teardown() {
|
||||
@test "shim exec should remove shim_path from path on system version execution" {
|
||||
run asdf install dummy 2.0.0
|
||||
|
||||
echo "dummy system" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy system" >$PROJECT_DIR/.tool-versions
|
||||
|
||||
mkdir $PROJECT_DIR/sys/
|
||||
echo 'which dummy' > $PROJECT_DIR/sys/dummy
|
||||
echo 'which dummy' >$PROJECT_DIR/sys/dummy
|
||||
chmod +x $PROJECT_DIR/sys/dummy
|
||||
|
||||
run env PATH=$PATH:$PROJECT_DIR/sys $ASDF_DIR/shims/dummy
|
||||
@ -334,12 +334,11 @@ teardown() {
|
||||
[ "$output" == "$ASDF_DIR/shims/dummy" ]
|
||||
}
|
||||
|
||||
|
||||
@test "shim exec can take version from legacy file if configured" {
|
||||
run asdf install dummy 2.0.0
|
||||
|
||||
echo "legacy_version_file = yes" > $HOME/.asdfrc
|
||||
echo "2.0.0" > $PROJECT_DIR/.dummy-version
|
||||
echo "legacy_version_file = yes" >$HOME/.asdfrc
|
||||
echo "2.0.0" >$PROJECT_DIR/.dummy-version
|
||||
|
||||
run $ASDF_DIR/shims/dummy world hello
|
||||
[ "$output" == "This is Dummy 2.0.0! hello world" ]
|
||||
@ -355,14 +354,14 @@ teardown() {
|
||||
exec_path="$ASDF_DIR/plugins/dummy/bin/list-bin-paths"
|
||||
custom_path="$ASDF_DIR/installs/dummy/1.0/custom"
|
||||
|
||||
echo "echo bin custom" > $exec_path
|
||||
echo "echo bin custom" >$exec_path
|
||||
chmod +x $exec_path
|
||||
|
||||
run asdf install dummy 1.0
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
|
||||
mkdir $custom_path
|
||||
echo "echo CUSTOM" > $custom_path/foo
|
||||
echo "echo CUSTOM" >$custom_path/foo
|
||||
chmod +x $custom_path/foo
|
||||
|
||||
run asdf reshim dummy 1.0
|
||||
@ -377,14 +376,14 @@ teardown() {
|
||||
exec_path="$ASDF_DIR/plugins/dummy/bin/exec-path"
|
||||
custom_dummy="$ASDF_DIR/installs/dummy/1.0/custom/dummy"
|
||||
|
||||
echo "echo custom/dummy" > $exec_path
|
||||
echo "echo custom/dummy" >$exec_path
|
||||
chmod +x $exec_path
|
||||
|
||||
mkdir $(dirname $custom_dummy)
|
||||
echo "echo CUSTOM" > $custom_dummy
|
||||
echo "echo CUSTOM" >$custom_dummy
|
||||
chmod +x $custom_dummy
|
||||
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
|
||||
run $ASDF_DIR/shims/dummy
|
||||
[ "$output" == "CUSTOM" ]
|
||||
@ -395,10 +394,10 @@ teardown() {
|
||||
|
||||
exec_path="$ASDF_DIR/plugins/dummy/bin/exec-path"
|
||||
|
||||
echo 'echo $3 # always same path' > $exec_path
|
||||
echo 'echo $3 # always same path' >$exec_path
|
||||
chmod +x $exec_path
|
||||
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
|
||||
run $ASDF_DIR/shims/dummy
|
||||
[ "$output" == "This is Dummy 1.0!" ]
|
||||
@ -406,9 +405,9 @@ teardown() {
|
||||
|
||||
@test "shim exec executes configured pre-hook" {
|
||||
run asdf install dummy 1.0
|
||||
echo dummy 1.0 > $PROJECT_DIR/.tool-versions
|
||||
echo dummy 1.0 >$PROJECT_DIR/.tool-versions
|
||||
|
||||
cat > $HOME/.asdfrc <<-'EOM'
|
||||
cat >$HOME/.asdfrc <<-'EOM'
|
||||
pre_dummy_dummy = echo PRE $version $1 $2
|
||||
EOM
|
||||
|
||||
@ -420,14 +419,14 @@ EOM
|
||||
|
||||
@test "shim exec doesnt execute command if pre-hook failed" {
|
||||
run asdf install dummy 1.0
|
||||
echo dummy 1.0 > $PROJECT_DIR/.tool-versions
|
||||
echo dummy 1.0 >$PROJECT_DIR/.tool-versions
|
||||
|
||||
mkdir $HOME/hook
|
||||
pre_cmd="$HOME/hook/pre"
|
||||
echo 'echo $* && false' > "$pre_cmd"
|
||||
echo 'echo $* && false' >"$pre_cmd"
|
||||
chmod +x "$pre_cmd"
|
||||
|
||||
cat > $HOME/.asdfrc <<'EOM'
|
||||
cat >$HOME/.asdfrc <<'EOM'
|
||||
pre_dummy_dummy = pre $1 no $plugin_name $2
|
||||
EOM
|
||||
|
||||
@ -440,7 +439,7 @@ EOM
|
||||
@test "asdf exec should not crash when POSIXLY_CORRECT=1" {
|
||||
export POSIXLY_CORRECT=1
|
||||
|
||||
echo "dummy 1.0" > $PROJECT_DIR/.tool-versions
|
||||
echo "dummy 1.0" >$PROJECT_DIR/.tool-versions
|
||||
run asdf install
|
||||
|
||||
run asdf exec dummy world hello
|
||||
|
@ -27,7 +27,7 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "where shows install location of current version if no version specified" {
|
||||
echo 'dummy 2.1' >> $HOME/.tool-versions
|
||||
echo 'dummy 2.1' >>$HOME/.tool-versions
|
||||
|
||||
run asdf where 'dummy'
|
||||
|
||||
@ -36,7 +36,7 @@ function teardown() {
|
||||
}
|
||||
|
||||
@test "where shows install location of first current version if not version specified and multiple current versions" {
|
||||
echo 'dummy 2.1 1.0' >> $HOME/.tool-versions
|
||||
echo 'dummy 2.1 1.0' >>$HOME/.tool-versions
|
||||
run asdf where 'dummy'
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "$ASDF_DIR/installs/dummy/2.1" ]
|
||||
@ -64,7 +64,7 @@ function teardown() {
|
||||
run asdf where 'dummy'
|
||||
|
||||
local expected
|
||||
expected="No version set for dummy; please run \`asdf <global | shell | local> dummy <version>\`"
|
||||
expected="No version is set for dummy; please run \`asdf <global | shell | local> dummy <version>\`"
|
||||
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "$expected" ]
|
||||
|
Loading…
Reference in New Issue
Block a user