-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Enable debug - print commands | ||
#set -x | ||
|
||
# Check if needed programms are installe | ||
yq version >/dev/null || { | ||
echo "yq needs to be installed" | ||
exit 1 | ||
} | ||
|
||
tmpDir="/tmp/parsed-formula" | ||
|
||
# TODO: Use search for symlinks and delete instead of plain rm | ||
echo "Delete symlinks in Alaises folder" | ||
rm -f Alises/*.rb | ||
|
||
echo "Generating Aliases from provided config:" | ||
for formulaVersionsFile in $(ls -l1 "$tmpDir"/*.yaml); do | ||
echo "- $(basename "$formulaVersionsFile") ($(yq 'length' "$formulaVersionsFile") versions found)" | ||
echo "TODO: Do magic and create the Alias symlink files" | ||
# ln -s foo bar | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# Enable debug - print commands | ||
#set -x | ||
|
||
tmpDir="/tmp/parsed-formula" | ||
|
||
if [[ -d "$tmpDir" ]]; then | ||
echo "$tmpDir already exists, deleting! => Should happen only locally..." | ||
rm -rf "$tmpDir" | ||
fi | ||
|
||
mkdir "$tmpDir" | ||
|
||
echo "Sort Formula:" | ||
for formulaFile in $(ls -la1 Formula); do | ||
if [[ "$formulaFile" =~ ^\. ]]; then | ||
echo -e "- $formulaFile\t| Skipping file as it starts with a dot" | ||
continue | ||
elif [[ ! "$formulaFile" =~ .+\.rb$ ]]; then | ||
echo -e "- $formulaFile\t| Skipping as files does not end with .rb" | ||
continue | ||
fi | ||
|
||
# Remove .rb suffix | ||
formula=${formulaFile%.rb} | ||
|
||
if [[ ! "$formula" =~ ^[a-z0-9-]{2,}@([0-9]+)(\.[0-9]+)?(\.[0-9]+)?(-.+)?$ ]]; then | ||
# https://regex101.com/r/DSC7cM/1 | ||
echo -e "- $formula\t| Skipping Formula as it doesn't seem to versioned" | ||
continue | ||
fi | ||
echo -e "- $formula\t| Processing..." | ||
fName=$(sed -rn 's/^([a-z0-9-]{2,})@([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(-.+)?$/\1/p' <<<"$formula") | ||
fMajor=$(sed -rn 's/^([a-z0-9-]{2,})@([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(-.+)?$/\2/p' <<<"$formula") | ||
fMinor=$(sed -rn 's/^([a-z0-9-]{2,})@([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(-.+)?$/\4/p' <<<"$formula") | ||
fBugfix=$(sed -rn 's/^([a-z0-9-]{2,})@([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(-.+)?$/\6/p' <<<"$formula") | ||
fBuildtag=$(sed -rn 's/^([a-z0-9-]{2,})@([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(-.+)?$/\7/p' <<<"$formula") | ||
|
||
echo -e "- $formula\t| Found values: '$fName' '$fMajor' '$fMinor' '$fBugfix' '$fBuildtag'" | ||
|
||
cat <<EOF >> "$tmpDir/$fName.yaml" | ||
- major: '$fMajor' | ||
minor: '$fMinor' | ||
bugfix: '$fBugfix' | ||
builtag: '$fBuildtag' | ||
EOF | ||
done | ||
|
||
echo "Config files wrote to $tmpDir:" | ||
( | ||
cd "$tmpDir" | ||
ls -la1 *.yaml | ||
) || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Run checks and tests | ||
run-name: Run checks and tests ⚡️ | ||
on: [push] | ||
jobs: | ||
shellcheck: | ||
name: Shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Run ShellCheck | ||
uses: ludeeus/action-shellcheck@master | ||
with: | ||
scandir: './ci-scripts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.