mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-04-17 13:38:03 -04:00
Simplification and improvements to use command.
* For version explicit version in use command * Do not offer to install version on use command
This commit is contained in:
@@ -25,7 +25,7 @@ function __sdk_help {
|
||||
__sdkman_echo_no_colour " install or i <candidate> [version] [local-path]"
|
||||
__sdkman_echo_no_colour " uninstall or rm <candidate> <version>"
|
||||
__sdkman_echo_no_colour " list or ls [candidate]"
|
||||
__sdkman_echo_no_colour " use or u <candidate> [version]"
|
||||
__sdkman_echo_no_colour " use or u <candidate> <version>"
|
||||
__sdkman_echo_no_colour " default or d <candidate> [version]"
|
||||
__sdkman_echo_no_colour " current or c [candidate]"
|
||||
__sdkman_echo_no_colour " upgrade or ug [candidate]"
|
||||
|
||||
@@ -21,23 +21,14 @@ function __sdk_use {
|
||||
|
||||
candidate="$1"
|
||||
version="$2"
|
||||
__sdkman_check_version_present "$version" || return 1
|
||||
__sdkman_check_candidate_present "$candidate" || return 1
|
||||
__sdkman_determine_version "$candidate" "$version" || return 1
|
||||
|
||||
if [[ ! -d "${SDKMAN_CANDIDATES_DIR}/${candidate}/${VERSION}" ]]; then
|
||||
echo ""
|
||||
__sdkman_echo_red "Stop! ${candidate} ${VERSION} is not installed."
|
||||
if [[ "$sdkman_auto_answer" != 'true' ]]; then
|
||||
echo ""
|
||||
__sdkman_echo_confirm "Do you want to install it now? (Y/n): "
|
||||
read install
|
||||
fi
|
||||
if [[ -z "$install" || "$install" == "y" || "$install" == "Y" ]]; then
|
||||
__sdkman_install_candidate_version "$candidate" "$VERSION"
|
||||
__sdkman_add_to_path "$candidate"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Just update the *_HOME and PATH for this shell.
|
||||
|
||||
@@ -28,19 +28,12 @@ Feature: Service Unavailable
|
||||
|
||||
# use command
|
||||
|
||||
Scenario: Use the default candidate version while Offline
|
||||
Given the candidate "grails" version "2.1.0" is already installed and default
|
||||
And the candidate "grails" version "1.3.9" is already installed but not default
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk use grails"
|
||||
Then I see "Using grails version 2.1.0 in this shell."
|
||||
|
||||
Scenario: Use the default candidate version when non selected while Offline
|
||||
Given the candidate "grails" version "1.3.9" is already installed but not default
|
||||
And the candidate "grails" version "2.1.0" is already installed but not default
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk use grails"
|
||||
Then I see "This command is not available while offline."
|
||||
Then I see "No candidate version provided."
|
||||
|
||||
Scenario: Use an uninstalled candidate version while Offline
|
||||
Given the candidate "grails" version "1.3.9" is already installed and default
|
||||
|
||||
@@ -22,18 +22,9 @@ Feature: Use Version
|
||||
Scenario: Use a candidate version that is not installed
|
||||
Given the candidate "grails" version "1.3.9" is available for download
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk use grails 1.3.9" and answer "Y"
|
||||
Then I see "Using grails version 1.3.9 in this shell."
|
||||
And the candidate "grails" version "1.3.9" should be in use
|
||||
|
||||
Scenario: Use a candidate version that is automatically installed
|
||||
Given I have configured "sdkman_auto_answer" to "true"
|
||||
And the candidate "grails" version "1.3.9" is available for download
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk use grails 1.3.9"
|
||||
Then I see "Stop! grails 1.3.9 is not installed."
|
||||
Then I see "Using grails version 1.3.9 in this shell."
|
||||
And the candidate "grails" version "1.3.9" should be in use
|
||||
And the exit code is 1
|
||||
|
||||
Scenario: Use a candidate version that does not exist
|
||||
Given the candidate "groovy" version "1.9.9" is not available for download
|
||||
@@ -48,26 +39,6 @@ Feature: Use Version
|
||||
When I enter "sdk use grails 2.0.0.M1"
|
||||
Then I see "Using grails version 2.0.0.M1 in this shell."
|
||||
|
||||
Scenario: Use an uninstalled candidate version of an uninstalled candidate and it becomes default
|
||||
Given the candidate "grails" version "1.3.9" is available for download
|
||||
And the candidate "grails" does not exist locally
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk use grails 1.3.9" and answer "Y"
|
||||
Then I see "Setting grails version 1.3.9 as default."
|
||||
And I see "Using grails version 1.3.9 in this shell."
|
||||
And the candidate "grails" version "1.3.9" is installed
|
||||
And the candidate "grails" version "1.3.9" should be the default
|
||||
|
||||
Scenario: Use an uninstalled candidate version of an installed candidate and it does not become default
|
||||
Given the candidate "grails" version "1.3.9" is already installed and default
|
||||
And the candidate "grails" version "2.1.0" is available for download
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk use grails 2.1.0" and answer "Y"
|
||||
Then I do not see "Setting grails version 1.3.9 as default."
|
||||
And I see "Using grails version 2.1.0 in this shell."
|
||||
And the candidate "grails" version "2.1.0" is installed
|
||||
And the candidate "grails" version "1.3.9" should be the default
|
||||
|
||||
#scenarios related to updating _HOME variable
|
||||
|
||||
Scenario: Use an installed version of an installed candidate updates the candidate _HOME variable
|
||||
@@ -79,20 +50,3 @@ Feature: Use Version
|
||||
When I enter "sdk use grails 2.1.0"
|
||||
And I see "Using grails version 2.1.0 in this shell."
|
||||
Then the "GRAILS_HOME" variable contains "grails/2.1.0"
|
||||
|
||||
Scenario: Use an uninstalled version of an uninstalled candidate updates the candidate _HOME variable
|
||||
Given the candidate "grails" does not exist locally
|
||||
And the candidate "grails" version "2.1.0" is available for download
|
||||
And the system is bootstrapped
|
||||
And the "GRAILS_HOME" variable is not set
|
||||
When I enter "sdk use grails 2.1.0" and answer "Y"
|
||||
Then the "GRAILS_HOME" variable contains "grails/2.1.0"
|
||||
|
||||
Scenario: Use an uninstalled version of an installed candidate updates the candidate _HOME variable
|
||||
Given the candidate "grails" version "1.3.9" is already installed and default
|
||||
And the candidate "grails" version "2.1.0" is available for download
|
||||
And the system is bootstrapped
|
||||
And the "GRAILS_HOME" variable contains "grails/current"
|
||||
When I enter "sdk use grails 2.1.0" and answer "Y"
|
||||
Then the "GRAILS_HOME" variable contains "grails/2.1.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user