mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-01-30 17:23:02 -05:00
Validate path for local installation.
This commit is contained in:
@@ -90,9 +90,15 @@ function __sdkman_install_local_version {
|
||||
folder="$(pwd)/$folder"
|
||||
fi
|
||||
|
||||
__sdkman_echo_green "Linking ${candidate} ${version} to ${folder}"
|
||||
ln -s "$folder" "${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}"
|
||||
__sdkman_echo_green "Done installing!"
|
||||
if [[ -d "$folder" ]]; then
|
||||
__sdkman_echo_green "Linking ${candidate} ${version} to ${folder}"
|
||||
ln -s "$folder" "${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}"
|
||||
__sdkman_echo_green "Done installing!"
|
||||
|
||||
else
|
||||
__sdkman_echo_red "Invalid path! Refusing to link ${candidate} ${version} to ${folder}."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
}
|
||||
|
||||
|
||||
@@ -51,10 +51,17 @@ Feature: Local Development Versions
|
||||
Then I see "Using groovy version 2.1-SNAPSHOT in this shell"
|
||||
And the candidate "groovy" version "2.1-SNAPSHOT" should be in use
|
||||
|
||||
Scenario: Install a local development version from a relative path
|
||||
Scenario: Install a local development version from a valid relative path
|
||||
Given the candidate "groovy" version "2.1-SNAPSHOT" is not available for download
|
||||
And I have a local candidate "groovy" version "2.1-SNAPSHOT" at relative path "some/relative/path/to/groovy"
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk install groovy 2.1-SNAPSHOT some/relative/path/to/groovy"
|
||||
Then I see "Linking groovy 2.1-SNAPSHOT"
|
||||
And the candidate "groovy" version "2.1-SNAPSHOT" is linked to the relative path "some/relative/path/to/groovy"
|
||||
|
||||
Scenario: Prevent installation of a local development version for an invalid path
|
||||
Given the candidate "groovy" version "2.1-SNAPSHOT" is not available for download
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk install groovy 2.1-SNAPSHOT /some/bogus/path/to/groovy"
|
||||
Then I see "Invalid path! Refusing to link groovy 2.1-SNAPSHOT to /some/bogus/path/to/groovy."
|
||||
And the candidate "groovy" version "2.1-SNAPSHOT" is not installed
|
||||
|
||||
Reference in New Issue
Block a user