This is a utility to manage versions in all necessary files in one place.(see,update, etc.)
Sometimes there are too many files in the project which contains project version. For example you would be having files such as bower.json and setup.py on same version in your project. Whenever the version is wanted be to upgraded, all files were updated one by one; now all implemented files can be update simply at once. It will find your versioning files and update them one by one.
This is installed into your python environment and the commands below can be access from command-line directly.
Python 2.7
orpypy2
$ (sudo) pip install version-manager --upgrade
To see current version of files.
$ versionmanager --status
Any version can be set.
$ versionmanager --set 1.1.1
This is new functionality to upgrade version without knowing whole version string. It simply upgrade version as major, minor or patch as it is defined in SemVer.
$ versionmanager --bump major
$ versionmanager --bump minor
$ versionmanager --bump patch
- setup.py
- bower.json
- package.json
- pom.xml
- conf.py (sphinx documentation config)
- setup.py - GREEN
- conf.py (version) (sphinx) - BLUE
- conf.py (release) (sphinx) - BLUE
- package.json - RED
- bower.json - YELLOW
- pom.xml - MAGENTA
Any file implementation can be added simply. version-manager
reads extra config from .vmrc
file under your current directory(project folder maybe) or your user home directory.
Here is a simple example of .vmrc
$ vi ~/.vmrc
or
$ vi /path/to/your_project/.vmrc
{
"default_groups" :[
"staging"
],
"groups": {
"eu_prod": {
"files": [
{
"names": [
"*-prod-eu.properties"
],
"parser": "regexp",
"color": "yellow",
"kwargs": {
"regex": "(?P<match_left>my_version=)(?P<version>\\d+\\.\\d+\\.\\d+)(?P<match_right>\\n)"
}
},
{
"names": [
"*-prod-eu-1.sql",
"*-prod-eu-2.sql"
],
"version_separator": "x",
"parser": "regexp",
"color": "lightyellow_ex",
"kwargs": {
"regex": "(?P<match_left>dependent_silo_eu_v)(?P<version>\\d+x\\d+x\\d+)(?P<match_right>_HIVE)"
}
}
]
},
"us_prod": {
"files": [
{
"names": [
"*-prod-eu.properties"
],
"parser": "regexp",
"color": "yellow",
"kwargs": {
"regex": "(?P<match_left>my_version=)(?P<version>\\d+\\.\\d+\\.\\d+)(?P<match_right>\\n)"
}
},
{
"names": [
"*-prod-us-1.sql",
"*-prod-us-2.sql",
"*-prod-us-3.sql"
],
"version_separator": "x",
"parser": "regexp",
"color": "lightyellow_ex",
"kwargs": {
"regex": "(?P<match_left>dependent_silo_us_v)(?P<version>\\d+x\\d+x\\d+)(?P<match_right>_HIVE)"
}
}
]
},
"staging": {
"files": [
{
"names": [
"*-staging-*.properties"
],
"parser": "regexp",
"color": "yellow",
"kwargs": {
"regex": "(?P<match_left>my_version=)(?P<version>\\d+\\.\\d+\\.\\d+)(?P<match_right>\\n)"
}
},
{
"names": [
"*-staging-*-1.sql",
"*-staging-*-2.sql"
],
"version_separator": "x",
"parser": "regexp",
"color": "lightyellow_ex",
"kwargs": {
"regex": "(?P<match_left>dependent_silo_staging_v)(?P<version>\\d+x\\d+x\\d+)(?P<match_right>_HIVE)"
}
}
]
}
}
}
Any famous file formats can be demanded as built-in by opening an issue. Feel free to demand it :-)
To run a command for specific group;
$ # To check files specific to eu_prod and staging
$ versionmanager --groups eu_prod,staging --status
$ # To check files specific to all prod environments
$ versionmanager --groups "*_prod" --status
- Improvement - Support overriding default groups in .vmrc
- Improvement - Print outputs in tabular format
- Improvement - Support giving the group which is demanded to be used. Multiple group names can be given. Wildcard is also supported
- Improvement - Support being able to define different groups for custom version files
- Improvement - Support wildcard for file names in .vmrc
- Improvement - Support defining multiple file names for single regex in .vmrc
- Improvement -
current_version
andupdate_version
are merged as subcomment underversionmanager
consolescript.versionmanager --status
,versionmanager --set <version>
andversionmanager --bump <level>
are available instead ofcurrent_version
andupdate_version <version>
. - Improvement - SemVer support is added for bump versioning.
versionmanager --bump <level>
which level is one among (major
,``minor``,``patch``)
- Improvement -
pypy
support is added. - Bug - When there is multiple regex config for same file, one of them was being applied. It is fixed. (version and relase in Sphinx conf.py)
- Improvement -
Sphinx
conf.py
support is added. - Improvement - README file is in rst format now.
MIT