Skip to content

Commit

Permalink
πŸ’„ Add tool to double check distribution files are declared
Browse files Browse the repository at this point in the history
  • Loading branch information
krakrjak committed Sep 8, 2023
1 parent 605bfe9 commit dbb1324
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tools/checkembeddedfiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Check that all files embedded with file-embed are declared in extra-source-files
## Borrowed from hledger, uses ripgrep

set -e
rg="rg --sort=path"
$rg --version >/dev/null

echo "Checking embedded file declarations:"
status=0
for f in $($rg -I '^ +\$\(embedFileRelative "([^"]+)"' -or '$1'); do
if output=$($rg -l "$f" -- */package.yaml); then
printf '%-40s\tdeclared in %s\n' "$f" "$output"
else
printf '%-40s\tUNDECLARED\n' "$f"
status=1
fi;
done
if [[ $status != 0 ]]; then echo FAIL; else echo ok; fi
exit $status

0 comments on commit dbb1324

Please sign in to comment.