Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Provides a more reasonable versioning scheme then the rebar standard 'git' vsn extension
Erlang
tag: v0.0.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.gitignore
Makefile
README.md
rebar.config

README.md

rebar_vsn_plugin

TLDR

This plugin will make accurate semver compatible version strings for your Erlang OTP Apps as long as you are doing semver style versioning with tags 'v'.

Use

Add the following dep specification to the deps tuple of your rebar.config:

{rebar_vsn_plugin, "",
     {git, "https://github.com/erlware/rebar_vsn_plugin.git",
      {tag, "master"}}},

Then inform rebar that you want this to be used as a plugin like so:

{plugins, [rebar_vsn_plugin]}.

Then add the semver version to the <app-name>.app.src file. It should go from something like

{application, rebar_vsn_plugin,
   [{description, "Correct version manipulation for rebar"},
    {vsn, git},
    {modules, []},
    {registered, []},
    {applications, [kernel, stdlib]}]}.

to this:

{application, rebar_vsn_plugin,
   [{description, "Correct version manipulation for rebar"},
    {vsn, semver},
    {modules, []},
    {registered, []},
    {applications, [kernel, stdlib]}]}.

The key change is the {vsn, "semver"} change. This tells the plugin that it needs to replace the version in this app with the tag + ref version it employs.

Explanation

This plugin is designed to take the latest semver compatible tag and turn it into a semver compatible version for the OTP Application. One of the key things it does (aside from making sure that semver is respected) is insure that there is a unique monotonically increasing version for each commit built. It does this by creating a version from both the latest tag, the epoch timestamp and the ref. The ref is actually only there to make the version human readable.

So lets say you have a repository with the tag v0.0.1 and the epoch 1348518514 on the latest commit identified by 26ff3c6 then you would end up with the version 0.0.1+build.1348518514.26ff3c6. While that version string is long, it is perfectly accurate, semver compatible, and works well with OTP. This solves many of the current versioning problems with rebar and erlang OTP Apps.

Something went wrong with that request. Please try again.