When obeying (or trying to obey) Semantic Versioning it’s convenient to have tools which let you see the current version and keep you right when transitioning between versions. None of the existing tools did exactly what I needed, so I wrote another one…
Previously, SparkSeat used the SemVer gem to manage our version information.
This creates a YAML file in the root directory of the project called .semver
which the provided command-line tool reads and writes. From the README:
% semver init
% semver inc minor # => v0.1.0
% semver special 'alpha.45' # => v0.1.0-alpha.45
% semver format "%M.%m" # => 0.1
% git tag -a `semver tag`
We’ve used this heavily across all our components, but as many of our components
are written in frameworks which already have versioning (think package.json
),
it became difficult to keep them in sync. (Besides, repeating the information
is wasteful or… something)
The solution seemed clear – the command-line tool should read and manipulate existing sources of version information, and only fallback to creating its own file to keep state where none is available.
Introducing YAVM
YAVM, or Yet Another Version Manager (sigh) does exactly this – it uses modular “stores” which each know how to query and manipulate one source of version information.
There is currently support for:
- npm
- bower
- ruby gemspecs
- semver (fallback)
YAVM will allow a similar interface as SemVer to all of these stores, will ensure they are kept in sync, and offer suggestions when they are not. It also has a ruby interface for programmatic access to version information from your ruby application.