More scripts support

This commit is contained in:
DarkFeather 2022-09-18 21:34:48 -05:00
parent f9a8c19066
commit 39c2229a1e
Signed by: DarkFeather
GPG Key ID: 1CC1E3F4ED06F296
5 changed files with 41 additions and 16 deletions

View File

@ -4,5 +4,8 @@
if [ -d venv ]; then if [ -d venv ]; then
source venv/bin/activate source venv/bin/activate
elif [ -f requirements.txt ]; then
python3 -m venv venv
venv/bin/python3 -m pip install -r requirements.txt
fi fi
python3 -m pytest python3 -m pytest

View File

@ -2,11 +2,6 @@
# Sourced from https://github.com/git/git/blob/master/templates/hooks--pre-commit.sample # Sourced from https://github.com/git/git/blob/master/templates/hooks--pre-commit.sample
if egrep -irl '\s\+$' .; then
echo The above lines have trailing whitespace. Run "sed -i 's/\s\+$//'" on the affected files.
exit 1
fi
if git rev-parse --verify HEAD >/dev/null 2>&1 if git rev-parse --verify HEAD >/dev/null 2>&1
then then
against=HEAD against=HEAD
@ -18,6 +13,9 @@ fi
# Redirect output to stderr. # Redirect output to stderr.
exec 1>&2 exec 1>&2
# If there are whitespace errors, print the offending file names and fail. # If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against -- git diff-index --check --cached $against --
if [ $? -ne 0 ]; then
echo The above lines have trailing whitespace. Run "sed -i 's/\s\+$//'" on the affected files.
exit 1
fi

View File

@ -1,26 +1,30 @@
installdir = ${pkgdir}/opt/aninix/Uniglot/ installdir = ${pkgdir}/opt/aninix/Uniglot/
targets = Bash C CSharp Hooks targets = Bash C CSharp Hooks
compile: compile:
@echo Nothing to compile. @echo Nothing to compile.
install: compile install: compile
mkdir -p ${installdir} mkdir -p ${installdir}
for target in ${targets}; do rsync -avzzl "$$target" ${installdir}; done for target in ${targets}; do rsync -avzzl "$$target" ${installdir}; done
mkdir "${installdir}/pacman/"
cp PKGBUILD "${installdir}/pacman/"
mkdir "${installdir}/make/"
cp Makefile "${installdir}/make/"
mkdir -p ${pkgdir}/usr/local/bin mkdir -p ${pkgdir}/usr/local/bin
install -m 0755 -o root -g root bin/uniglot-clone ${pkgdir}/usr/local/bin find bin/ -type f -exec install -m 0755 -o root -g root {} "${pkgdir}/usr/local/bin" \;
make checkperm make checkperm
clean: clean:
for i in `cat .gitignore`; do rm -Rf $$i; done git clean -fdX
uninstall:
rm -Rf ${installdir}
test: uninstall:
rm -Rf ${installdir}
test:
python3 -m pytest python3 -m pytest
checkperm: checkperm:
chmod -R 0755 ${installdir} ${pkgdir}/usr/local/bin/uniglot-clone chmod -R 0755 ${installdir} ${pkgdir}/usr/local/bin/uniglot-clone
chown root:root ${installdir} ${pkgdir}/usr/local/bin/uniglot-clone chown root:root ${installdir} ${pkgdir}/usr/local/bin/uniglot-clone

View File

@ -1,3 +1,14 @@
This repo holds all our standard functions that all our services should use. We include a folder for each language -- files are broken down by their inclusion method. Please follow our [development best practices](https://foundation.aninix.net/AniNIX/Wiki/src/branch/master/Operation/Development_Best_Practices.md) when contributing. This repo holds all our standard functions that all our services should use. We include a folder for each language -- files are broken down by their inclusion method. Please follow our [development best practices](https://foundation.aninix.net/AniNIX/Wiki/src/branch/master/Operation/Development_Best_Practices.md) when contributing.
These functions are not intended to be invoked directly, so the package created from this repo will only provide files on disk. Some other functions served by this repo are included below.
# Example Packaging
This repo does have some example packaging for use in downstream projects. The `Makefile` and `PKGBUILD` are standards the AniNIX should maintain throughout their projects.
# Executables
The following executables are available:
* `uniglot-clone` ensures that when repos are cloned, they are attached to the standard Uniglot hooks.
* `home-git` is support for [User Support Repositories](https://aninix.net/AniNIX/Wiki/src/branch/main/Articles/User_Support_Repositories.md).

View File

@ -38,6 +38,11 @@ if [ `basename "$0"` == "uniglot-clone" ]; then
esac esac
done done
if [ -n "$target" ]; then
uniglotClone "$target"
cd "$(basename "$target" | sed 's/.git$//')"
fi
# Sanity # Sanity
if [ ! -d .git ]; then if [ ! -d .git ]; then
echo "This should be run from the root of the clone." echo "This should be run from the root of the clone."
@ -45,9 +50,13 @@ if [ `basename "$0"` == "uniglot-clone" ]; then
fi fi
# Standardizations # Standardizations
# If the repo is Uniglot...
if git config remote.origin.url | grep -q AniNIX/Uniglot; then if git config remote.origin.url | grep -q AniNIX/Uniglot; then
# Set the hooks to the local directory
git config core.hooksPath $PWD/Hooks git config core.hooksPath $PWD/Hooks
else else
# Otherwise set it to the global hooks
git config core.hooksPath /opt/aninix/Uniglot/Hooks git config core.hooksPath /opt/aninix/Uniglot/Hooks
fi fi
fi fi