Enforce semver management in git repositories
Project description
Semver Git Hook
Install
Works with python 3.6+
First, install the tool using python ecosystem :
pip install --user semver-git-hook
Use
Then set the hook in your current folder git repository :
semver-git-hook --init
That is all. Now on commit a release version type is asked interactively.
On commit some version change will be saved in a .version file. It is automatically added to the current commit.
With this enabled you have your project version set in the .version file that it is possible to dynamically load to your dev environment versionning settings.
For exemple in python the setup.py can look like
# setup.py
with open('.version') as f:
version = f.read()
setup(
#...
version=version,
#...
)
and javascript
//That can be a version.js file that is triggered in .git/hooks/pre-commit
const f = require('fs')
const version = f.readFileSync('.version', 'utf-8')
const package = JSON.parse(f.readFileSync('package.json', 'utf-8'))
package.version = version
f.writeFileSync('package.json', JSON.stringify(package, null, 4))
Options
It is possible to change .version file location by setting a prefix in it's path. The file will be located at SEMVER_HOOK_PATH_PREFIX.version where SEMVER_HOOK_PATH_PREFIX is an environment variable.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semver-git-hook-1.0.5.tar.gz.
File metadata
- Download URL: semver-git-hook-1.0.5.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
557d85d8920468da849e44a7b40f14e160620f82d8903df47d08816ec68ac448
|
|
| MD5 |
14481bac4c18b6edbd2ad2c1fa01e1a1
|
|
| BLAKE2b-256 |
7f8f0ccf8601680c36bd665836cf5912191825ffd4740e7e358c23556f782a99
|
File details
Details for the file semver_git_hook-1.0.5-py2.py3-none-any.whl.
File metadata
- Download URL: semver_git_hook-1.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40ac544918e5e56c6a1fefff6fe76b7c42d59425201b7705c370755096c1d471
|
|
| MD5 |
347c032839ab7a041dafbde2b5ea4ed1
|
|
| BLAKE2b-256 |
28f673ba67acbfc604d15f749a51d084b7c32eb55eafef18cf4ac5724c591a1d
|