From 3538b44a20fe8f07eb8fe48a2290d40987469602 Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Thu, 9 Oct 2025 09:59:46 -0500 Subject: [PATCH] New hooks: find-data-files to ensure that data files are not added make-sure-hooks-synced to ensure that hooks are committed consistently to checker. Updates to README.md to document standard directories Adding Resources as standard files for all repos to consume. --- Hooks/scripts.d/find-data-files | 10 ++++++++++ Hooks/scripts.d/make-sure-hooks-synced | 4 ++++ README.md | 8 ++++++++ Resources/ascii.txt | 24 ++++++++++++++++++++++++ Resources/{AniNIX.png => logo.png} | Bin Resources/public.gpg | 16 ++++++++++++++++ 6 files changed, 62 insertions(+) create mode 100755 Hooks/scripts.d/find-data-files create mode 100755 Hooks/scripts.d/make-sure-hooks-synced create mode 100644 Resources/ascii.txt rename Resources/{AniNIX.png => logo.png} (100%) create mode 100644 Resources/public.gpg diff --git a/Hooks/scripts.d/find-data-files b/Hooks/scripts.d/find-data-files new file mode 100755 index 0000000..b454d26 --- /dev/null +++ b/Hooks/scripts.d/find-data-files @@ -0,0 +1,10 @@ +#!/bin/bash + +# We don't want to commit data files, with the exceptions being our GPG public key and organization logo in PNG & ASCII format. +result="$(git ls-files | xargs -n 1 file | grep -Ev ASCII\ text\|JSON\|empty\|Unicode\ text | grep -vE '^Resources/logo.png|^Resources/ascii.txt|^Resources/public.gpg')" +if [ -n "$result" ]; then + echo "These files need to be evaluated -- generally, don't commit data files to Git." + echo "$result" + exit 1 +fi +exit 0 diff --git a/Hooks/scripts.d/make-sure-hooks-synced b/Hooks/scripts.d/make-sure-hooks-synced new file mode 100755 index 0000000..fe56b3a --- /dev/null +++ b/Hooks/scripts.d/make-sure-hooks-synced @@ -0,0 +1,4 @@ +if [ `git ls-files -m | grep -E '^Hooks/scripts.d|^precommit-hooks/' | wc -l` != '0' ]; then + echo 'Hooks have changed and need to be added. Run `git add precommit-hooks`' + exit 1 +fi diff --git a/README.md b/README.md index a598b29..66a5df8 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,14 @@ The Hooks folder includes a standard pre-commit and pre-receive that will be enf Notably, each repo that subscribes to this enforcement can also commit their own standards in addition to global standards. Python tests should go in a folder called `tests/` and scripts in a folder called `precommit-hooks/`. These will be run in addition to the global hooks. +### Consumed Directories + +When used with `uniglot-clone`, there are several directories at which AniNIX/Uniglot's hooks will look. + +* the `rss/` directory will be used by `Hooks/scripts.d/generate-rss-snippet` on a webserver to publish snippets. See [/AniNIX/Kapisi/src/branch/main/roles/Foundation/files/custom/public/assets/js/aninix.js#L2](aninix.js#L2) for options to consume these snippets in a webpage. This allows each repo to publish new updates in one place and webpages to show it in addition to [https://singularity.aninix.net](AniNIX/Singularity) and other readers. +* The `tests/` directory will be used by `Hooks/scripts.d/pytest` to run Python unit tests on a repo. Any code should be wrapped with automated regressions. +* The `precommit-hooks` directory will be used by `Hooks/scripts.d/local-hooks`. This allows individual repos to use our general hooks and then add on specific tests on top, such as lint checkers or consistency checkers. + ## Standard Libraries Each language for which we have libraries should have its own folder. Breakdown within each of these may be broken up by line count or topic, at the author's discretion. Once an include standard has been set, though, it should be preserved. For example, if functions in [the Bash header](./Bash/header) are to be broken out into subordinate files, then the Bash header should include these files that contain functions formally in itself. diff --git a/Resources/ascii.txt b/Resources/ascii.txt new file mode 100644 index 0000000..3b9f58e --- /dev/null +++ b/Resources/ascii.txt @@ -0,0 +1,24 @@ +........................................... +........................................... +.....................4HHH................... +..................4HHHHHHHHH................ +...............4HHHHHHHHHHHHHH.............. +...........4HHHHHHHH.....4HHHHHHHH........... +........4HHHHHHHH...........4HHHHHHHH........ +.......4HHHHHH.................4HHHHHH....... +.......4HHHH.....................4HHHH....... +.......4HHHH....4HHH....#.........4HHHH....... +.......4HHHH....4HHH.....###......4HHHH....... +.......4HHHH....4HHH........##....4HHHH....... +.......4HHHH....4HHH........##....4HHHH....... +.......4HHHH....4HHH.....###......4HHHH....... +.......4HHHH....4HHH....#.........4HHHH....... +.......4HHHH.....................4HHHH....... +.......4HHHHHH.................4HHHHHH....... +........4HHHHHHHH...........4HHHHHHHH........ +...........4HHHHHHHH......4HHHHHHHH.......... +.............4HHHHHHHH.4HHHHHHHH............. +.................4HHHHHHHHHH................ +....................4HHHH................... +........................................... +........................................... diff --git a/Resources/AniNIX.png b/Resources/logo.png similarity index 100% rename from Resources/AniNIX.png rename to Resources/logo.png diff --git a/Resources/public.gpg b/Resources/public.gpg new file mode 100644 index 0000000..2177e41 --- /dev/null +++ b/Resources/public.gpg @@ -0,0 +1,16 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEXODEBRYJKwYBBAHaRw8BAQdAfb/AxMT/BxuZ3YxVZvzGeHamqApB4Cm7mrol +N/KdMxa0MERhcmtGZWF0aGVyIDxpcmNzOi8vYW5pbml4Lm5ldDo2Njk3L0RhcmtG +ZWF0aGVyPoiQBBMWCAA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEkE3m +J1V5y1idhXIMHMHj9O0G8pYFAl4NpXUACgkQHMHj9O0G8pZGsgEAu29Fj+vDSnUF +jsDwTgSAZRSiEMIzO0hSTOL//uwaSgQA/iESpuKyfUUoteJhSvwI6PTt0D23F4AR +vXWh0f5LqTgLiJAEExYIADgWIQSQTeYnVXnLWJ2FcgwcweP07QbylgUCXg2A8QIb +AwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRAcweP07QbylvaeAQDvnhvFK3Qt +BNLGwwV2w85SCm2ITFK6l4ClmO/EcreNzAEAlNHSEquQRaFwKQD7IUbj1dPllOPY +RUsFyqZetReWlAG4OARc4MQFEgorBgEEAZdVAQUBAQdA/TfytUcx/gmKbkMLF1hd +49FZIyoq2MKMrjFEHWI/KykDAQgHiHgEGBYIACACGwwWIQSQTeYnVXnLWJ2Fcgwc +weP07QbylgUCXg2ltwAKCRAcweP07Qbylo3PAP0W5BOTL8YMwLbwYzNlxFpiNSCn +GHXfxI5/3QRB8Q5kCgD+Og0Y0Nve58yZj+DkqFCpI0TJReKj+bavK7TJ9ElL8wo= +=VnrT +-----END PGP PUBLIC KEY BLOCK-----