mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-01-31 09:43:04 -05:00
Adds configuration of auto answer on install and selfupdate.
This commit is contained in:
@@ -176,6 +176,7 @@ mkdir -p "${GVM_DIR}/vertx"
|
||||
|
||||
echo "Prime the config file..."
|
||||
touch "${gvm_config_file}"
|
||||
echo "gvm_auto_answer=false" >> "${gvm_config_file}"
|
||||
|
||||
echo "Download script archive..."
|
||||
curl -s "${GVM_SERVICE}/res?platform=${gvm_platform}&purpose=install" > "${gvm_zip_file}"
|
||||
|
||||
@@ -72,8 +72,10 @@ fi
|
||||
|
||||
echo "Prime the config file..."
|
||||
gvm_config_file="${GVM_DIR}/etc/config"
|
||||
rm "${gvm_config_file}"
|
||||
touch "${gvm_config_file}"
|
||||
if [[ -z $(cat ${gvm_config_file} | grep 'gvm_auto_answer') ]]; then
|
||||
echo "gvm_auto_answer=false" >> "${gvm_config_file}"
|
||||
fi
|
||||
|
||||
echo "Download new scripts to: ${gvm_tmp_zip}"
|
||||
curl -s "${GVM_SERVICE}/res?platform=${gvm_platform}&purpose=selfupdate" > "${gvm_tmp_zip}"
|
||||
|
||||
@@ -19,6 +19,17 @@ Feature: Self Update
|
||||
And the configuration is not present in the extensions folder
|
||||
And the configuration file is present in the etc folder
|
||||
|
||||
Scenario: Update an installation without an Auto Answer config
|
||||
Given an empty configuration file
|
||||
When I enter "gvm selfupdate"
|
||||
Then the configuration file contains "gvm_auto_answer=false"
|
||||
|
||||
Scenario: Update an installation already containing an Auto Answer config
|
||||
Given the configuration file has been primed with "gvm_auto_answer=true"
|
||||
When I enter "gvm selfupdate"
|
||||
Then the configuration file contains "gvm_auto_answer=true"
|
||||
And the configuration file does not contain "gvm_auto_answer=false"
|
||||
|
||||
Scenario: Rename the vertx Candidate on Upgrade
|
||||
Given the candidate "vert.x" version "1.3.0.final" is already installed and default
|
||||
When I enter "gvm selfupdate"
|
||||
|
||||
@@ -24,6 +24,11 @@ And(~'^the configuration file contains "([^"]*)"$') { String content ->
|
||||
assert configFile.text.contains(content)
|
||||
}
|
||||
|
||||
And(~'^the configuration file does not contain "([^"]*)"$') { String content ->
|
||||
def configFile = "$gvmDir/etc/config" as File
|
||||
assert ! configFile.text.contains(content)
|
||||
}
|
||||
|
||||
Given(~'^a configuration file in the extensions folder$') {->
|
||||
def configFile = "$gvmDir/ext/config" as File
|
||||
configFile.text = ""
|
||||
@@ -60,4 +65,8 @@ And(~'^the gvm module scripts are placed in the src folder$') {->
|
||||
|
||||
And(~'^the staging folder is cleaned up$') {->
|
||||
assert ! new File("$gvmDir/tmp/stage").exists()
|
||||
}
|
||||
Given(~'^an empty configuration file$') {->
|
||||
def configFile = "$gvmDir/ext/config" as File
|
||||
configFile.text = ""
|
||||
}
|
||||
Reference in New Issue
Block a user