File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change 1818
1919function ___sdkman_check_candidates_cache() {
2020 local candidates_cache=" $1 "
21- if [[ -f " $candidates_cache " && -n " $( < " $candidates_cache " ) " && -n " $( find " $candidates_cache " -mmin +$(( 24 * 60 * 30 )) ) " ]]; then
22- __sdkman_echo_yellow ' We periodically need to update the local cache. Please run:'
23- echo ' '
24- __sdkman_echo_no_colour ' $ sdk update'
25- echo ' '
26- return 0
27- elif [[ -f " $candidates_cache " && -z " $( < " $candidates_cache " ) " ]]; then
21+ if [[ -f " $candidates_cache " && -z " $( < " $candidates_cache " ) " ]]; then
2822 __sdkman_echo_red ' WARNING: Cache is corrupt. SDKMAN cannot be used until updated.'
2923 echo ' '
3024 __sdkman_echo_no_colour ' $ sdk update'
3125 echo ' '
3226 return 1
3327 else
34- __sdkman_echo_debug " No update at this time. Using existing cache: $SDKMAN_CANDIDATES_CSV "
28+ __sdkman_echo_debug " Using existing cache: $SDKMAN_CANDIDATES_CSV "
3529 return 0
3630 fi
3731}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class CandidatesCacheUpdateSpec extends SdkmanEnvSpecification {
3939 ! bash. output. contains(" SDKMAN 5.0.0" )
4040 }
4141
42- void " should issue a warning if cache is older than a month" () {
42+ void " should NOT issue a warning if cache is older than a month" () {
4343 given :
4444 bash = sdkmanBashEnvBuilder
4545 .withCandidates([' groovy' ])
@@ -56,11 +56,11 @@ class CandidatesCacheUpdateSpec extends SdkmanEnvSpecification {
5656 bash. execute(" sdk help" )
5757
5858 then :
59- bash. output. contains(' We periodically need to update the local cache.' )
60- bash. output. contains(' $ sdk update' )
59+ ! bash. output. contains(' We periodically need to update the local cache.' )
60+ ! bash. output. contains(' $ sdk update' )
6161 }
6262
63- void " should log a success message in debug mode when no update needed " () {
63+ void " should log a success message if cache exists " () {
6464 given :
6565 bash = sdkmanBashEnvBuilder
6666 .withCandidates([' groovy' ])
@@ -74,7 +74,7 @@ class CandidatesCacheUpdateSpec extends SdkmanEnvSpecification {
7474 bash. execute(" sdk help" )
7575
7676 then :
77- bash. output. contains(' No update at this time. Using existing cache' )
77+ bash. output. contains(' Using existing cache' )
7878 }
7979
8080 void " should bypass cache check if update command issued" () {
You can’t perform that action at this time.
0 commit comments