More scripts support
This commit is contained in:
parent
f9a8c19066
commit
39c2229a1e
@ -4,5 +4,8 @@
|
||||
|
||||
if [ -d venv ]; then
|
||||
source venv/bin/activate
|
||||
elif [ -f requirements.txt ]; then
|
||||
python3 -m venv venv
|
||||
venv/bin/python3 -m pip install -r requirements.txt
|
||||
fi
|
||||
python3 -m pytest
|
||||
|
@ -2,11 +2,6 @@
|
||||
|
||||
# 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
|
||||
then
|
||||
against=HEAD
|
||||
@ -18,6 +13,9 @@ fi
|
||||
# Redirect output to stderr.
|
||||
exec 1>&2
|
||||
|
||||
|
||||
# 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
|
||||
|
8
Makefile
8
Makefile
@ -7,12 +7,16 @@ compile:
|
||||
install: compile
|
||||
mkdir -p ${installdir}
|
||||
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
|
||||
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
|
||||
|
||||
clean:
|
||||
for i in `cat .gitignore`; do rm -Rf $$i; done
|
||||
git clean -fdX
|
||||
|
||||
uninstall:
|
||||
rm -Rf ${installdir}
|
||||
|
13
README.md
13
README.md
@ -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.
|
||||
|
||||
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).
|
||||
|
@ -38,6 +38,11 @@ if [ `basename "$0"` == "uniglot-clone" ]; then
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$target" ]; then
|
||||
uniglotClone "$target"
|
||||
cd "$(basename "$target" | sed 's/.git$//')"
|
||||
fi
|
||||
|
||||
# Sanity
|
||||
if [ ! -d .git ]; then
|
||||
echo "This should be run from the root of the clone."
|
||||
@ -45,9 +50,13 @@ if [ `basename "$0"` == "uniglot-clone" ]; then
|
||||
fi
|
||||
|
||||
# Standardizations
|
||||
|
||||
# If the repo is Uniglot...
|
||||
if git config remote.origin.url | grep -q AniNIX/Uniglot; then
|
||||
# Set the hooks to the local directory
|
||||
git config core.hooksPath $PWD/Hooks
|
||||
else
|
||||
# Otherwise set it to the global hooks
|
||||
git config core.hooksPath /opt/aninix/Uniglot/Hooks
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user