Skip to content

Commit ca2fef1

Browse files
committed
Reformat flush feature and cleanup.
1 parent 9f2d9de commit ca2fef1

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ mongo.json
1818
out/
1919
sdkman-cli.iml
2020
target/
21-
bin/test/

src/main/bash/sdkman-flush.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,26 @@ function __sdk_flush() {
4747

4848
function __sdkman_cleanup_folder() {
4949
local folder="$1"
50+
local sdkman_cleanup_dir
51+
local sdkman_cleanup_disk_usage
52+
local sdkman_cleanup_count
53+
5054
sdkman_cleanup_dir="${SDKMAN_DIR}/${folder}"
5155
sdkman_cleanup_disk_usage=$(du -sh "$sdkman_cleanup_dir")
5256
sdkman_cleanup_count=$(ls -1 "$sdkman_cleanup_dir" | wc -l)
5357

54-
rm -rf "${SDKMAN_DIR}/${folder}"
55-
mkdir "${SDKMAN_DIR}/${folder}"
58+
rm -rf "$sdkman_cleanup_dir"
59+
mkdir "$sdkman_cleanup_dir"
5660

5761
__sdkman_echo_green "${sdkman_cleanup_count} archive(s) flushed, freeing ${sdkman_cleanup_disk_usage}."
5862
}
5963

60-
function __sdkman_cleanup_broadcast {
61-
if [[ -f "${SDKMAN_DIR}/var/broadcast_id" ]]; then
62-
rm "${SDKMAN_DIR}/var/broadcast_id"
63-
rm "${SDKMAN_DIR}/var/broadcast"
64-
__sdkman_echo_green "Broadcast has been flushed."
65-
else
66-
__sdkman_echo_no_colour "No prior broadcast found so not flushed."
67-
fi
64+
function __sdkman_cleanup_broadcast() {
65+
if [[ -f "${SDKMAN_DIR}/var/broadcast_id" ]]; then
66+
rm "${SDKMAN_DIR}/var/broadcast_id"
67+
rm "${SDKMAN_DIR}/var/broadcast"
68+
__sdkman_echo_green "Broadcast has been flushed."
69+
else
70+
__sdkman_echo_no_colour "No prior broadcast found so not flushed."
71+
fi
6872
}
69-

src/test/resources/features/flush.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Feature: Flush
44
Given the internet is reachable
55
And an initialised environment
66
And the system is bootstrapped
7-
7+
88
Scenario: Clear out the cached archives and the temporary storage
99
Given the archive "grails-1.3.9.zip" has been cached
1010
And the file "res-1.2.0.zip" in temporary storage

0 commit comments

Comments
 (0)