Skip to content

Commit baf524e

Browse files
committed
🔧 Chore: update tools scripts
1 parent 3888c5e commit baf524e

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

scripts/coverageReport.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
COVERAGE_FILE="coverage.out"
4+
HTML_REPORT="coverage.html"
5+
6+
echo "Executing tests and generating coverage report"
7+
go test -coverprofile="$COVERAGE_FILE"
8+
9+
if [[ $? -eq 0 ]]; then
10+
echo "Generating HTML file..."
11+
12+
go tool cover -html=$COVERAGE_FILE -o $HTML_REPORT
13+
14+
if command -v xdg-open &>/dev/null; then
15+
xdg-open $HTML_REPORT # Linux
16+
elif command -v open &>/dev/null; then
17+
open $HTML_REPORT # macOS
18+
else
19+
echo "Cannot open report automatically. Open the file $HTML_REPORT in your browser ."
20+
fi
21+
else
22+
echo "An error occurred while trying to generate the coverage report."
23+
fi

scripts/loadEnv.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /bin/bash
2+
3+
export "$(grep -v '^#' .env | xargs)"

scripts/swagger.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
sudo docker run -i yousan/swagger-yaml-to-html < swagger/swagger.yml > doc/api.html
3+
sudo docker run --rm -i yousan/swagger-yaml-to-html < swagger/swagger.yml | sudo tee doc/api.html > /dev/null

0 commit comments

Comments
 (0)