This script provides a simple interface around viewing and manipulating project version metadata. It may be used to either bump, set, or view the version information for the project in a given directory. It is written with semantic versioning in mind.
It currently does it's best to determine whether the given directory contains a NodeJS, Erlang, or Ansible package before just settling on keeping the version in a file named version
. If a NodeJS project is discovered then the package.json
will be edited. If an Ansible project is discovered then no files will be modified but the tags will still be handled. The Erlang detection is limited to OTP apps, and avakas
will attempt to edit a rebar style foo.app.src
.
The avakas tool makes a few assumptions
- There is only one logical project in each directory.
- The directory is somewhere in a git repository. You can have multiple projects per repository by using the
--tag-prefix
option. - For the protection of the user the git workspace must not be dirty.
The avakas tool supports the following types of version files
- NodeJS
package.json
- Erlang/OTP and rebar
foo.app.src
- Plain ol'
version
file
This mode will return the current version for a given project. The following will show the current Public API version. This operation supports an additional --build
argument, which will cause it to extend the version set in source control with build-time metadata. It also supports the --pre-build
argument, which does the same thing on top of the prerelease field, because all kinds of package management systems do not actually support the build semantic version component.
avakas show $HOME/projects/hal9000
This mode will set an explicit version. Note that the string must be a valid semantic version.
avakas set $HOME/projects/hal9000 2.0.0
This mode will automatically update the version based on the input provided. It has four modes of operation.
major
will update the major (left) version component.minor
will update the minor (middle) version component.patch
will update the patch (right) version component.pre
will update the prerelase (to the right, separated by a-
)
This will result in nothing being pushed to upstream git sources.
The branch to use when updating git.
The remote to push tags and version updates.
This prefix will be added to the version string when creating a git tag.
The avakas tool was created by Jonathan Freedman.