mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-05-19 14:06:45 -04:00
feat: remove offline mode; introduce sdkman_healthcheck_enable config
- Remove `sdk offline` command and all associated code - Delete offline_mode.feature entirely - Replace SDKMAN_OFFLINE_MODE env var with sdkman_healthcheck_enable config flag - When sdkman_healthcheck_enable=false, skip the startup healthcheck entirely (SDKMAN_AVAILABLE stays true; commands proceed and fail naturally if offline) - Update INTERNET NOT REACHABLE warning to reference new config option - Rename __sdkman_display_offline_warning -> __sdkman_display_network_warning - Remove withOfflineMode() from SdkmanBashEnvBuilder and test step definitions - Update service_unavailable.feature: drop offline-list fallback scenarios, update error message strings to match new wording - Remove offline from bash completion script - Fixes #1484 (sdk offline was triggering network traffic before mode engaged) - Closes #1517
This commit is contained in:
@@ -23,7 +23,7 @@ __sdkman_complete_command() {
|
||||
|
||||
case $command in
|
||||
sdk)
|
||||
candidates=("install" "uninstall" "list" "use" "config" "default" "home" "env" "current" "upgrade" "version" "help" "offline" "selfupdate" "update" "flush")
|
||||
candidates=("install" "uninstall" "list" "use" "config" "default" "home" "env" "current" "upgrade" "version" "help" "selfupdate" "update" "flush")
|
||||
;;
|
||||
current|c|default|d|home|h|uninstall|rm|upgrade|ug|use|u)
|
||||
local -r candidate_paths=("${SDKMAN_CANDIDATES_DIR}"/*)
|
||||
@@ -38,9 +38,6 @@ __sdkman_complete_command() {
|
||||
env|e)
|
||||
candidates=("init" "install" "clear")
|
||||
;;
|
||||
offline)
|
||||
candidates=("enable" "disable")
|
||||
;;
|
||||
selfupdate)
|
||||
candidates=("force")
|
||||
;;
|
||||
|
||||
@@ -17,16 +17,15 @@
|
||||
#
|
||||
|
||||
function __sdkman_update_service_availability() {
|
||||
if [[ "$sdkman_healthcheck_enable" == "false" ]]; then
|
||||
return
|
||||
fi
|
||||
local healthcheck_status=$(__sdkman_determine_healthcheck_status)
|
||||
__sdkman_set_availability "$healthcheck_status"
|
||||
}
|
||||
|
||||
function __sdkman_determine_healthcheck_status() {
|
||||
if [[ "$SDKMAN_OFFLINE_MODE" == "true" || "$COMMAND" == "offline" && "$QUALIFIER" == "enable" ]]; then
|
||||
echo ""
|
||||
else
|
||||
echo $(__sdkman_secure_curl_with_timeouts "${SDKMAN_CANDIDATES_API}/healthcheck")
|
||||
fi
|
||||
echo $(__sdkman_secure_curl_with_timeouts "${SDKMAN_CANDIDATES_API}/healthcheck")
|
||||
}
|
||||
|
||||
function __sdkman_set_availability() {
|
||||
@@ -34,7 +33,7 @@ function __sdkman_set_availability() {
|
||||
local detect_html="$(echo "$healthcheck_status" | tr '[:upper:]' '[:lower:]' | grep 'html')"
|
||||
if [[ -z "$healthcheck_status" ]]; then
|
||||
SDKMAN_AVAILABLE="false"
|
||||
__sdkman_display_offline_warning "$healthcheck_status"
|
||||
__sdkman_display_network_warning "$healthcheck_status"
|
||||
elif [[ -n "$detect_html" ]]; then
|
||||
SDKMAN_AVAILABLE="false"
|
||||
__sdkman_display_proxy_warning
|
||||
@@ -43,15 +42,15 @@ function __sdkman_set_availability() {
|
||||
fi
|
||||
}
|
||||
|
||||
function __sdkman_display_offline_warning() {
|
||||
function __sdkman_display_network_warning() {
|
||||
local healthcheck_status="$1"
|
||||
if [[ -z "$healthcheck_status" && "$COMMAND" != "offline" && "$SDKMAN_OFFLINE_MODE" != "true" ]]; then
|
||||
if [[ -z "$healthcheck_status" ]]; then
|
||||
__sdkman_echo_red "==== INTERNET NOT REACHABLE! ==================================================="
|
||||
__sdkman_echo_red ""
|
||||
__sdkman_echo_red " Some functionality is disabled or only partially available."
|
||||
__sdkman_echo_red " If this persists, please enable the offline mode:"
|
||||
__sdkman_echo_red " If this persists, disable the healthcheck in ~/.sdkman/etc/config:"
|
||||
__sdkman_echo_red ""
|
||||
__sdkman_echo_red " $ sdk offline"
|
||||
__sdkman_echo_red " sdkman_healthcheck_enable=false"
|
||||
__sdkman_echo_red ""
|
||||
__sdkman_echo_red "================================================================================"
|
||||
echo ""
|
||||
|
||||
@@ -52,11 +52,11 @@ function __sdkman_determine_version() {
|
||||
VERSION=$(readlink "${SDKMAN_CANDIDATES_DIR}/${candidate}/current" | sed "s!${SDKMAN_CANDIDATES_DIR}/${candidate}/!!g")
|
||||
|
||||
elif [[ "$SDKMAN_AVAILABLE" == "false" && -n "$version" ]]; then
|
||||
__sdkman_echo_red "Stop! ${candidate} ${version} is not available while offline."
|
||||
__sdkman_echo_red "Stop! ${candidate} ${version} is not available. Internet unreachable."
|
||||
return 1
|
||||
|
||||
elif [[ "$SDKMAN_AVAILABLE" == "false" && -z "$version" ]]; then
|
||||
__sdkman_echo_red "This command is not available while offline."
|
||||
__sdkman_echo_red "This command is not available. Internet unreachable."
|
||||
return 1
|
||||
|
||||
else
|
||||
|
||||
@@ -20,7 +20,6 @@ function __sdk_help() {
|
||||
__sdkman_deprecation_notice "help"
|
||||
__sdkman_echo_no_colour ""
|
||||
__sdkman_echo_no_colour "Usage: sdk <command> [candidate] [version]"
|
||||
__sdkman_echo_no_colour " sdk offline <enable|disable>"
|
||||
__sdkman_echo_no_colour ""
|
||||
__sdkman_echo_no_colour " commands:"
|
||||
__sdkman_echo_no_colour " install or i <candidate> [version] [local-path]"
|
||||
@@ -35,7 +34,6 @@ function __sdk_help() {
|
||||
__sdkman_echo_no_colour " upgrade or ug [candidate]"
|
||||
__sdkman_echo_no_colour " version or v"
|
||||
__sdkman_echo_no_colour " help"
|
||||
__sdkman_echo_no_colour " offline [enable|disable]"
|
||||
|
||||
if [[ "$sdkman_selfupdate_feature" == "true" ]]; then
|
||||
__sdkman_echo_no_colour " selfupdate [force]"
|
||||
|
||||
@@ -28,7 +28,7 @@ function __sdk_list() {
|
||||
|
||||
function __sdkman_list_candidates() {
|
||||
if [[ "$SDKMAN_AVAILABLE" == "false" ]]; then
|
||||
__sdkman_echo_red "This command is not available while offline."
|
||||
__sdkman_echo_red "This command is not available. Internet unreachable."
|
||||
else
|
||||
__sdkman_echo_paged "$(__sdkman_secure_curl "${SDKMAN_CANDIDATES_API}/candidates/list")"
|
||||
fi
|
||||
@@ -42,7 +42,7 @@ function __sdkman_list_versions() {
|
||||
__sdkman_determine_current_version "$candidate"
|
||||
|
||||
if [[ "$SDKMAN_AVAILABLE" == "false" ]]; then
|
||||
__sdkman_offline_list "$candidate" "$versions_csv"
|
||||
__sdkman_echo_red "This command is not available. Internet unreachable."
|
||||
else
|
||||
__sdkman_echo_paged "$(__sdkman_secure_curl "${SDKMAN_CANDIDATES_API}/candidates/${candidate}/${SDKMAN_PLATFORM}/versions/list?current=${CURRENT}&installed=${versions_csv}")"
|
||||
fi
|
||||
@@ -65,33 +65,4 @@ function __sdkman_build_version_csv() {
|
||||
echo "$versions_csv"
|
||||
}
|
||||
|
||||
function __sdkman_offline_list() {
|
||||
local candidate versions_csv
|
||||
|
||||
candidate="$1"
|
||||
versions_csv="$2"
|
||||
|
||||
__sdkman_echo_no_colour "--------------------------------------------------------------------------------"
|
||||
__sdkman_echo_yellow "Offline: only showing installed ${candidate} versions"
|
||||
__sdkman_echo_no_colour "--------------------------------------------------------------------------------"
|
||||
|
||||
local versions=($(echo ${versions_csv//,/ }))
|
||||
for ((i = ${#versions} - 1; i >= 0; i--)); do
|
||||
if [[ -n "${versions[${i}]}" ]]; then
|
||||
if [[ "${versions[${i}]}" == "$CURRENT" ]]; then
|
||||
__sdkman_echo_no_colour " > ${versions[${i}]}"
|
||||
else
|
||||
__sdkman_echo_no_colour " * ${versions[${i}]}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "${versions[@]}" ]]; then
|
||||
__sdkman_echo_yellow " None installed!"
|
||||
fi
|
||||
|
||||
__sdkman_echo_no_colour "--------------------------------------------------------------------------------"
|
||||
__sdkman_echo_no_colour "* - installed "
|
||||
__sdkman_echo_no_colour "> - currently in use "
|
||||
__sdkman_echo_no_colour "--------------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
@@ -76,9 +76,6 @@ function sdk() {
|
||||
|
||||
# Always presume internet availability
|
||||
SDKMAN_AVAILABLE="true"
|
||||
if [ -z "$SDKMAN_OFFLINE_MODE" ]; then
|
||||
SDKMAN_OFFLINE_MODE="false"
|
||||
fi
|
||||
|
||||
# ...unless proven otherwise
|
||||
__sdkman_update_service_availability
|
||||
@@ -117,12 +114,6 @@ function sdk() {
|
||||
___sdkman_help
|
||||
fi
|
||||
|
||||
# Validate offline qualifier
|
||||
if [[ "$COMMAND" == "offline" && -n "$QUALIFIER" && -z $(echo "enable disable" | grep -w "$QUALIFIER") ]]; then
|
||||
echo ""
|
||||
__sdkman_echo_red "Stop! $QUALIFIER is not a valid offline mode."
|
||||
fi
|
||||
|
||||
# Store the return code of the requested command
|
||||
local final_rc=0
|
||||
|
||||
@@ -135,7 +126,7 @@ function sdk() {
|
||||
elif [ -n "$CMD_FOUND" ]; then
|
||||
|
||||
# Check whether the candidate exists
|
||||
if [[ -n "$QUALIFIER" && "$COMMAND" != "help" && "$COMMAND" != "offline" && "$COMMAND" != "flush" && "$COMMAND" != "selfupdate" && "$COMMAND" != "env" && "$COMMAND" != "completion" && "$COMMAND" != "edit" && "$COMMAND" != "home" && -z $(echo ${SDKMAN_CANDIDATES[@]} | grep -w "$QUALIFIER") ]]; then
|
||||
if [[ -n "$QUALIFIER" && "$COMMAND" != "help" && "$COMMAND" != "flush" && "$COMMAND" != "selfupdate" && "$COMMAND" != "env" && "$COMMAND" != "completion" && "$COMMAND" != "edit" && "$COMMAND" != "home" && -z $(echo ${SDKMAN_CANDIDATES[@]} | grep -w "$QUALIFIER") ]]; then
|
||||
echo ""
|
||||
__sdkman_echo_red "Stop! $QUALIFIER is not a valid candidate."
|
||||
return 1
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright 2021 Marco Vermeulen
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
function __sdk_offline() {
|
||||
local mode="$1"
|
||||
if [[ -z "$mode" || "$mode" == "enable" ]]; then
|
||||
SDKMAN_OFFLINE_MODE="true"
|
||||
__sdkman_echo_green "Offline mode enabled."
|
||||
fi
|
||||
|
||||
if [[ "$mode" == "disable" ]]; then
|
||||
SDKMAN_OFFLINE_MODE="false"
|
||||
__sdkman_echo_green "Online mode re-enabled!"
|
||||
fi
|
||||
}
|
||||
@@ -22,7 +22,7 @@ function __sdk_selfupdate() {
|
||||
local sdkman_native_version_api
|
||||
|
||||
if [[ "$SDKMAN_AVAILABLE" == "false" ]]; then
|
||||
echo "This command is not available while offline."
|
||||
echo "This command is not available. Internet unreachable."
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ class SdkmanBashEnvBuilder {
|
||||
private Optional<UnameStub> unameStub = Optional.empty()
|
||||
private List candidates = ['groovy', 'grails', 'java']
|
||||
private String platform = UnixUtils.inferPlatform()
|
||||
private boolean offlineMode = false
|
||||
private String candidatesApi = "http://localhost:8080/2"
|
||||
private String brokerApi = "http://localhost:8080/2"
|
||||
private String jdkHome = "/path/to/my/jdk"
|
||||
@@ -73,11 +72,6 @@ class SdkmanBashEnvBuilder {
|
||||
this
|
||||
}
|
||||
|
||||
SdkmanBashEnvBuilder withOfflineMode(boolean offlineMode) {
|
||||
this.offlineMode = offlineMode
|
||||
this
|
||||
}
|
||||
|
||||
SdkmanBashEnvBuilder withCandidatesApi(String service) {
|
||||
this.candidatesApi = service
|
||||
this
|
||||
@@ -142,7 +136,6 @@ class SdkmanBashEnvBuilder {
|
||||
def env = [
|
||||
SDKMAN_DIR : sdkmanDir.absolutePath,
|
||||
SDKMAN_CANDIDATES_DIR: sdkmanCandidatesDir.absolutePath,
|
||||
SDKMAN_OFFLINE_MODE : "$offlineMode",
|
||||
SDKMAN_CANDIDATES_API: candidatesApi,
|
||||
SDKMAN_BROKER_API : brokerApi,
|
||||
sdkman_debug_mode : Boolean.toString(debugMode),
|
||||
|
||||
@@ -19,7 +19,7 @@ class CompletionSpec extends SdkmanEnvSpecification {
|
||||
bash.execute('echo "\${COMPREPLY[@]}"')
|
||||
|
||||
then:
|
||||
bash.output.contains("install uninstall list use config default home env current upgrade version help offline selfupdate update flush")
|
||||
bash.output.contains("install uninstall list use config default home env current upgrade version help selfupdate update flush")
|
||||
}
|
||||
|
||||
def "should complete the list of candidates"() {
|
||||
|
||||
@@ -40,35 +40,11 @@ And(~'^the internet is reachable$') { ->
|
||||
primeEndpointWithString("/healthcheck", "12345")
|
||||
primeSelfupdate()
|
||||
|
||||
offlineMode = false
|
||||
serviceUrlEnv = SERVICE_UP_URL
|
||||
javaHome = FAKE_JDK_PATH
|
||||
}
|
||||
|
||||
And(~'^the internet is not reachable$') { ->
|
||||
offlineMode = false
|
||||
serviceUrlEnv = SERVICE_DOWN_URL
|
||||
javaHome = FAKE_JDK_PATH
|
||||
}
|
||||
|
||||
And(~'^offline mode is disabled with reachable internet$') { ->
|
||||
primeEndpointWithString("/healthcheck", "12345")
|
||||
|
||||
offlineMode = false
|
||||
serviceUrlEnv = SERVICE_UP_URL
|
||||
javaHome = FAKE_JDK_PATH
|
||||
}
|
||||
|
||||
And(~'^offline mode is enabled with reachable internet$') { ->
|
||||
primeEndpointWithString("/healthcheck", "12345")
|
||||
|
||||
offlineMode = true
|
||||
serviceUrlEnv = SERVICE_UP_URL
|
||||
javaHome = FAKE_JDK_PATH
|
||||
}
|
||||
|
||||
And(~'^offline mode is enabled with unreachable internet$') { ->
|
||||
offlineMode = true
|
||||
serviceUrlEnv = SERVICE_DOWN_URL
|
||||
javaHome = FAKE_JDK_PATH
|
||||
}
|
||||
@@ -83,7 +59,6 @@ And(~'^an "(.*)" machine with "(.*)" installed$') { String machine, String kerne
|
||||
|
||||
And(~'^an initialised environment$') { ->
|
||||
bash = SdkmanBashEnvBuilder.create(sdkmanBaseDir)
|
||||
.withOfflineMode(offlineMode)
|
||||
.withCandidatesApi(serviceUrlEnv)
|
||||
.withBrokerApi(serviceUrlEnv)
|
||||
.withJdkHome(javaHome)
|
||||
@@ -96,7 +71,6 @@ And(~'^an initialised environment$') { ->
|
||||
|
||||
And(~'^an initialised environment without debug prints$') { ->
|
||||
bash = SdkmanBashEnvBuilder.create(sdkmanBaseDir)
|
||||
.withOfflineMode(offlineMode)
|
||||
.withCandidatesApi(serviceUrlEnv)
|
||||
.withBrokerApi(serviceUrlEnv)
|
||||
.withJdkHome(javaHome)
|
||||
|
||||
@@ -8,7 +8,6 @@ Feature: Command Line Interop
|
||||
Scenario: Enter sdk
|
||||
When I enter "sdk"
|
||||
Then I see "Usage: sdk <command> [candidate] [version]"
|
||||
And I see "sdk offline <enable|disable>"
|
||||
|
||||
Scenario: Ask for help
|
||||
When I enter "sdk help"
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
Feature: Offline Mode
|
||||
|
||||
# offline modes
|
||||
|
||||
Scenario: Enter an invalid offline mode
|
||||
Given offline mode is disabled with reachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk offline grails"
|
||||
Then I see "Stop! grails is not a valid offline mode."
|
||||
|
||||
Scenario: Issue Offline command without qualification
|
||||
Given offline mode is disabled with reachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk offline"
|
||||
Then I see "Offline mode enabled."
|
||||
|
||||
Scenario: Enable Offline Mode with internet reachable
|
||||
Given offline mode is disabled with reachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk offline enable"
|
||||
Then I see "Offline mode enabled."
|
||||
And I do not see "INTERNET NOT REACHABLE!"
|
||||
When I enter "sdk install grails 2.1.0"
|
||||
Then I do not see "INTERNET NOT REACHABLE!"
|
||||
And I see "Stop! grails 2.1.0 is not available while offline."
|
||||
|
||||
Scenario: Disable Offline Mode with internet reachable
|
||||
Given offline mode is enabled with reachable internet
|
||||
And the candidate "grails" version "2.1.0" is available for download
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk offline disable"
|
||||
Then I see "Online mode re-enabled!"
|
||||
When I enter "sdk install grails 2.1.0" and answer "Y"
|
||||
Then I see "Done installing!"
|
||||
And the candidate "grails" version "2.1.0" is installed
|
||||
|
||||
Scenario: Disable Offline Mode with internet unreachable
|
||||
Given offline mode is enabled with unreachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk offline disable"
|
||||
Then I see "Online mode re-enabled!"
|
||||
When I enter "sdk install grails 2.1.0"
|
||||
Then I see "INTERNET NOT REACHABLE!"
|
||||
And I see "Stop! grails 2.1.0 is not available while offline."
|
||||
|
||||
# sdk version
|
||||
|
||||
Scenario: Determine the sdkman version while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk version"
|
||||
Then I see the current sdkman version
|
||||
|
||||
# list candidate version
|
||||
|
||||
Scenario: List candidate versions found while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk list grails"
|
||||
Then I see "Offline: only showing installed grails versions"
|
||||
|
||||
# default version
|
||||
|
||||
Scenario: Set the default to an uninstalled candidate version while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And the candidate "grails" version "1.3.9" is already installed and default
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk default grails 2.1.0"
|
||||
Then I see "Stop! grails 2.1.0 is not available while offline."
|
||||
|
||||
# install command
|
||||
|
||||
Scenario: Install a candidate version that is not installed while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And the candidate "grails" version "2.1.0" is not installed
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk install grails 2.1.0"
|
||||
Then I see "Stop! grails 2.1.0 is not available while offline."
|
||||
|
||||
# uninstall command
|
||||
|
||||
Scenario: Uninstall a candidate version while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And the candidate "grails" version "2.1.0" is already installed and default
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk uninstall grails 2.1.0"
|
||||
And the candidate "grails" version "2.1.0" is not installed
|
||||
|
||||
# current command
|
||||
|
||||
Scenario: Display the current version of a candidate while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And the candidate "grails" version "2.1.0" is already installed and default
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk current grails"
|
||||
Then I see "Using grails version 2.1.0"
|
||||
|
||||
# help command
|
||||
|
||||
Scenario: Request help while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk help"
|
||||
Then I see "Usage: sdk <command> [candidate] [version]"
|
||||
|
||||
# selfupdate command
|
||||
|
||||
Scenario: Attempt self-update while in Offline Mode
|
||||
Given offline mode is enabled with reachable internet
|
||||
And an initialised environment
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk selfupdate"
|
||||
Then I see "This command is not available while offline."
|
||||
@@ -6,29 +6,21 @@ Feature: Service Unavailable
|
||||
|
||||
# list commands
|
||||
|
||||
Scenario: List candidate versions found while Offline
|
||||
Scenario: List candidate versions found while internet unreachable
|
||||
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 list grails"
|
||||
Then I see "Offline: only showing installed grails versions"
|
||||
And I see "> 2.1.0"
|
||||
And I see "* 1.3.9"
|
||||
Then I see "This command is not available. Internet unreachable."
|
||||
|
||||
Scenario: List candidate versions not found while Offline
|
||||
Given the system is bootstrapped
|
||||
When I enter "sdk list grails"
|
||||
Then I see "Offline: only showing installed grails versions"
|
||||
And I see "None installed!"
|
||||
|
||||
Scenario: List Available Candidates while Offline
|
||||
Scenario: List Available Candidates while internet unreachable
|
||||
Given the system is bootstrapped
|
||||
When I enter "sdk list"
|
||||
Then I see "This command is not available while offline."
|
||||
Then I see "This command is not available. Internet unreachable."
|
||||
|
||||
# use command
|
||||
|
||||
Scenario: Use an installed candidate version while Offline
|
||||
Scenario: Use an installed candidate version while internet unreachable
|
||||
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
|
||||
@@ -37,19 +29,19 @@ Feature: Service Unavailable
|
||||
|
||||
# default command
|
||||
|
||||
Scenario: Set the default to an uninstalled candidate version while Offline
|
||||
Scenario: Set the default to an uninstalled candidate version while internet unreachable
|
||||
Given the candidate "grails" version "1.3.9" is already installed and default
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk default grails 2.1.0"
|
||||
Then I see "Stop! grails 2.1.0 is not available while offline."
|
||||
Then I see "Stop! grails 2.1.0 is not available. Internet unreachable."
|
||||
|
||||
Scenario: Set the default to an invalid candidate version while Offline
|
||||
Scenario: Set the default to an invalid candidate version while internet unreachable
|
||||
Given the candidate "grails" version "1.3.9" is already installed and default
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk default grails 999"
|
||||
Then I see "Stop! grails 999 is not available while offline."
|
||||
Then I see "Stop! grails 999 is not available. Internet unreachable."
|
||||
|
||||
Scenario: Set the default to an installed candidate version while Offline
|
||||
Scenario: Set the default to an installed candidate version while internet unreachable
|
||||
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
|
||||
@@ -58,13 +50,13 @@ Feature: Service Unavailable
|
||||
|
||||
# install command
|
||||
|
||||
Scenario: Install a candidate version that is not installed while Offline
|
||||
Scenario: Install a candidate version that is not installed while internet unreachable
|
||||
Given the candidate "grails" version "2.1.0" is not installed
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk install grails 2.1.0"
|
||||
Then I see "Stop! grails 2.1.0 is not available while offline."
|
||||
Then I see "Stop! grails 2.1.0 is not available. Internet unreachable."
|
||||
|
||||
Scenario: Install a candidate version that is already installed while Offline
|
||||
Scenario: Install a candidate version that is already installed while internet unreachable
|
||||
Given the candidate "grails" version "2.1.0" is already installed and default
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk install grails 2.1.0"
|
||||
@@ -73,7 +65,7 @@ Feature: Service Unavailable
|
||||
|
||||
# uninstall command
|
||||
|
||||
Scenario: Uninstall a candidate version while Offline
|
||||
Scenario: Uninstall a candidate version while internet unreachable
|
||||
Given the candidate "grails" version "2.1.0" is already installed and default
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk uninstall grails 2.1.0"
|
||||
@@ -82,7 +74,7 @@ Feature: Service Unavailable
|
||||
And the candidate "grails" version "2.1.0" is not in use
|
||||
And the candidate "grails" version "2.1.0" is not installed
|
||||
|
||||
Scenario: Uninstall a candidate version that is not installed while Offline
|
||||
Scenario: Uninstall a candidate version that is not installed while internet unreachable
|
||||
Given the candidate "grails" version "2.1.0" is not installed
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk uninstall grails 2.1.0"
|
||||
@@ -90,13 +82,13 @@ Feature: Service Unavailable
|
||||
|
||||
# current command
|
||||
|
||||
Scenario: Display the current version of a candidate while Offline
|
||||
Scenario: Display the current version of a candidate while internet unreachable
|
||||
Given the candidate "grails" version "2.1.0" is already installed and default
|
||||
And the system is bootstrapped
|
||||
When I enter "sdk current grails"
|
||||
Then I see "Using grails version 2.1.0"
|
||||
|
||||
Scenario: Display the current version of all candidates while Offline
|
||||
Scenario: Display the current version of all candidates while internet unreachable
|
||||
Given the candidate "grails" version "2.1.0" is already installed and default
|
||||
And the candidate "groovy" version "2.0.5" is already installed and default
|
||||
And the system is bootstrapped
|
||||
@@ -107,21 +99,21 @@ Feature: Service Unavailable
|
||||
|
||||
# version command
|
||||
|
||||
Scenario: Determine the sdkman version when Offline
|
||||
Scenario: Determine the sdkman version when internet unreachable
|
||||
Given the system is bootstrapped
|
||||
When I enter "sdk version"
|
||||
Then I see the current sdkman version
|
||||
|
||||
# help command
|
||||
|
||||
Scenario: Request help while Offline
|
||||
Scenario: Request help while internet unreachable
|
||||
Given the system is bootstrapped
|
||||
When I enter "sdk help"
|
||||
Then I see "Usage: sdk <command> [candidate] [version]"
|
||||
|
||||
# selfupdate command
|
||||
|
||||
Scenario: Attempt self-update while Offline
|
||||
Scenario: Attempt self-update while internet unreachable
|
||||
Given the system is bootstrapped
|
||||
When I enter "sdk selfupdate"
|
||||
Then I see "This command is not available while offline."
|
||||
Then I see "This command is not available. Internet unreachable."
|
||||
|
||||
Reference in New Issue
Block a user