Skip to content

Commit

Permalink
Fix Homebrew unbound variable warning (#223)
Browse files Browse the repository at this point in the history
[It was
highlighted](#222 (review))
that a warning was logged:
> packages/brew/functions.sh: line 10: $2: unbound variable

- This should've been an error, not a warning - hence `set -u`
- The function is clearly designed for `$2` to be optional, so we should
support that

Warning [no longer
logged](https://github.com/hazelcast/hazelcast-packaging/actions/runs/10395262076/job/28786894660).
  • Loading branch information
JackPGreen committed Aug 14, 2024
1 parent fb20ff3 commit a18e824
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/brew/brew_functions.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/env bash

set -euo pipefail ${RUNNER_DEBUG:+-x}

function alphanumCamelCase {
echo "$1"| sed -r 's/(-)/\./g' | tr '[:upper:]' '[:lower:]' | sed "s/\b\(.\)/\u\1/g" | sed 's+\.++g'
}

# The class name used in formula must not have dots nor hyphens and must be alphanumCamelCased
function brewClass {
basename=$(alphanumCamelCase "$1")
version=$(alphanumCamelCase "$2")
version=$(alphanumCamelCase "${2:-}")
if [ -n "${version}" ]; then
version="AT${version}"
fi
Expand Down

0 comments on commit a18e824

Please sign in to comment.