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 ptyhon 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))
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
semver-git-hook-1.0.1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for semver_git_hook-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a1c47199597b0049334c03d7ef5dc849b96e65283b9dc9fd6c984034547c860 |
|
MD5 | c4635c70009290e80b546266fe394805 |
|
BLAKE2b-256 | b33c220dfe82d03bafb29385f0ed7296c23b4fe9a3e048dee8c8667d85c4aad7 |