Package: nabla-hooks
nabla-hooksNabla custom git hooksThis project intend to be uses by all Nabla productsTable of contentsRequirementsInstall nabla-hooks as a developerUsing virtualenvInstall nabla-hooks to use itUsing PipFrom SourceAdd .pre-commit-config.yaml in you git projectOverride global environement variableLoginThe Templates DirectoriesLocalGlobalPackage nabla-hooks as a developerBuild a source distribution (a tar archive of all the files needed to build and install the package):Upload a source distributionTest nabla-hooks as a developershell usageTestVisual CodeUpdate README.md Table of ContentsRequirementsThis hooks requires the following to run:jiraSee requirements.txt for mandatory packages.This pre-commit hooks requires the following to run:pre-commitInstall nabla-hooks as a developerUsing virtualenvInstall python 3.8 and virtualenvvirtualenv--no-site-packages/opt/ansible/env38-ppython3.8source/opt/ansible/env38/bin/activate```bash
pip3.8install-rhooks/requirements.txt-rrequirements.testing.txtInstall nabla-hooks to use itUsing Pippip install nabla-hooksFrom Sourcepip install git+https://github.com/AlbanAndrieu/nabla-hooks.gitAdd .pre-commit-config.yaml in you git projectcreate .pre-commit-config.yaml in you git projectexample .pre-commit-config.yaml as following:-repo:https://github.com/AlbanAndrieu/nabla-hooks.gitrev:v1.0.0hooks:-id:git-branches-checkTesting locally-repo:localhooks:-id:git-branches-checkname:GIT branches checkdescription:Check for old stale and already merged branches from the current repo with user friendly messages and colorsentry:pre_commit_hooks/git-branches-check.shlanguage:scripttypes:[shell]always_run:trueverbose:trueargs:[--max=1,--verbose]$pre-commit try-repo . git-branches-check --verboseInstall in your repoRunpre-commit installpre-commit install -f --install-hooksenjoy itRunpre-commit run --all-filesRunSKIP=flake8 git commit -am 'Add key'Rungit commit -am 'Add key' --no-verifyOverride global environement variableLoginSeejiraWith user/passexportJIRA_USER=aandrieuexportJIRA_PASSWORD=XXXexportJIRA_URL=https://localhost/jiraexportJIRA_CERT_PATH=/etc/ssl/certs/NABLA-CA-1.crtexportJIRA_CERT_PATH=/etc/ssl/certs/ca-certificates.crt#### With email/token```bashexportJIRA_USER=alban.andrieu@free.frexportJIRA_PASSWORD=XXX# the token you generatedexportJIRA_URL==https://localhost/jiraexportJENKINS_URL=https://localhost/jenkins/exportJENKINS_USER=aandrieuexportJENKINS_USER_TOKEN=XXXThe Templates DirectoriesSeegit-hooks-using-pythonLocalFirst time runcp-rhooks/*.git/hooks/`or`rm-Rf./.git/hooks/&&ln-s../hooks./.git/hooks&&gitcheckoutthisrepohooks/GlobalWe have two directories that interest us:The/usr/share/git-core/templates/directory on Linux andC:/Program Files (x86)/Git/share/git-core/templates/directory on Windows (Note that on 32bit machines msysGit is installed by default on 'C:/Program Files/…') in which the default hooks are being copied from. If you installed Git using another configuration the installation might reside in a different folder. Adjust the path accordingly.The.git/hooks/directory is the directory in which the hooks templates are being copied to.The hooked are being copied from the[...]/share/git-core/templates/directory.  There are other types of templates but they are out of scope for this post.Note:  If you change the templates directory the hooks directory  must be a subdirectory of the templates directory. Do not set the templates directory to the desired hooks directory instead.Rungitconfig--globalinit.templatedir/workspace/users/albandrieu30/nabla-hooks/Package nabla-hooks as a developerSeesetup-cfgBuild a source distribution (a tar archive of all the files needed to build and install the package):python3 setup.py sdistBuilds wheels:python3 setup.py bdist_wheelBuild from source:python3 setup.py buildAnd install:/opt/ansible/env38/bin/python3 setup.py installsudo python setup.py developpip install .pip install -e ./Upload a source distributionSeeapi-tokenspython3 setup.py sdist bdist_wheel nano $HOME/.pypirc python3 -m twine upload --repository testpypi dist/*Uploadednabla-hooksTest nabla-hooks as a developershell usagepythonfrom hooks import get_msg match_msgTesttox--notest
tox-epy# Run tox using the version of Python in PATHtoxpy38From root directoryexportPYTHONPATH=hooks
pytest--cache-clear--setup-showtest/test_pytest.pyVisual CodeAdd PYTHONPATH=hooks for pytest when inside visual studioexportPYTHONPATH=hooksecho$PYTHONPATHcode.Update README.md Table of Contentsgithub-markdown-tocWithgithub-markdown-tocnpm install --save markdown-tocgithub-markdown-tocbrew install github-markdown-toc gh-md-toc --insert README.md