Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update test-init.sh #623

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions scripts/test-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,29 @@ url="https://kanaries-app.s3.ap-northeast-1.amazonaws.com/public-datasets/bike_s
dir="./tests"

# Create the directory if it doesn't exist
mkdir -p "$dir"
mkdir -p "$dir" || {
echo "Error: could not create directory '$dir'" >&2
exit 1
}

# Download the file using curl
if command -v curl >/dev/null; then
curl "$url" -o "$dir/bike_sharing_dc.csv"
curl -f "$url" -o "$dir/bike_sharing_dc.csv" || {
echo "Error: could not download file from '$url'" >&2
exit 1
}
elif command -v wget >/dev/null; then
wget "$url" -O "$dir/bike_sharing_dc.csv"
wget -q --show-progress "$url" -O "$dir/bike_sharing_dc.csv" || {
echo "Error: could not download file from '$url'" >&2
exit 1
}
else
echo "Error: could not find curl or wget to download the file" >&2
exit 1
fi
fi

# Check if the file was downloaded successfully
if [ ! -f "$dir/bike_sharing_dc.csv" ]; then
echo "Error: file '$dir/bike_sharing_dc.csv' was not downloaded successfully" >&2
exit 1
fi
Loading