Module GitVersionBump
In: lib/git-version-bump.rb
lib/git-version-bump/version.rb

Methods

Classes and Modules

Class GitVersionBump::VersionUnobtainable

Constants

DEVNULL = Gem.win_platform? ? "NUL" : "/dev/null"
VERSION = GVB.version
MAJOR_VERSION = GVB.major_version
MINOR_VERSION = GVB.minor_version
PATCH_VERSION = GVB.patch_version
INTERNAL_REVISION = GVB.internal_revision
DATE = GVB.date

Public Class methods

Calculate a version number based on the date of the most recent git commit.

Return a version format string of the form `"0.YYYYMMDD.N"`, where `YYYYMMDD` is the date of the "top-most" commit in the tree, and `N` is the number of other commits also made on that date.

This version format is not recommented for general use. It has benefit only in situations where the principles of Semantic Versioning have no real meaning, such as packages where there is little or no concept of "backwards compatibility" (eg packages which only contain images and other assets), or where the package can, for reasons outside that of the package itself, never break backwards compatibility (definitions of binary-packed structures shared amongst multiple systems).

The format of this commit-date-based version format allows for a strictly monotonically-increasing version number, aligned with the progression of the underlying git commit log.

One limitation of the format is that it doesn‘t deal with the issue of package builds made from multiple divergent trees. Unlike `git-describe`-based output, there is no "commit hash" identity included in the version string. This is because of (ludicrous) limitations of the Rubygems format definition — the moment there‘s a letter in the version number, the package is considered a "pre-release" version. Since hashes are hex, we‘re boned. Sorry about that. Don‘t make builds off a branch, basically.

[Validate]