lib/omnibus/build_version.rb
def semver
      build_tag = version_tag

      # PRERELEASE VERSION
      if prerelease_version?
        # ensure all dashes are dots per precedence rules (#12) in Semver
        # 2.0.0-rc.1
        prerelease = prerelease_tag.tr("-", ".")
        build_tag << "-" << prerelease
      end

      # BUILD VERSION
      # Follows SemVer conventions and the build version begins with a '+'.
      build_version_items = []

      # By default we will append a timestamp to every build. This behavior can
      # be overriden by setting the OMNIBUS_APPEND_TIMESTAMP environment
      # variable to a 'falsey' value (ie false, f, no, n or 0).
      #
      # format: YYYYMMDDHHMMSS example: 20130131123345
      if Config.append_timestamp
        build_version_items << build_start_time
      end

      # We'll append the git describe information unless we are sitting right
      # on an annotated tag.
      #
      # format: git.COMMITS_SINCE_TAG.GIT_SHA example: git.207.694b062
      unless commits_since_tag == 0
        build_version_items << ["git", commits_since_tag, git_sha_tag].join(".")
      end

      unless build_version_items.empty?
        build_tag << "+" << build_version_items.join(".")
      end

      build_tag
    end
def semver
      build_tag = version_tag

      # PRERELEASE VERSION
      if prerelease_version?
        # ensure all dashes are dots per precedence rules (#12) in Semver
        # 2.0.0-rc.1
        prerelease = prerelease_tag.tr("-", ".")
        build_tag << "-" << prerelease
      end

      # BUILD VERSION
      # Follows SemVer conventions and the build version begins with a '+'.
      build_version_items = []

      # By default we will append a timestamp to every build. This behavior can
      # be overriden by setting the OMNIBUS_APPEND_TIMESTAMP environment
      # variable to a 'falsey' value (ie false, f, no, n or 0).
      #
      # format: YYYYMMDDHHMMSS example: 20130131123345
      if Config.append_timestamp
        build_version_items << build_start_time
      end

      # We'll append the git describe information unless we are sitting right
      # on an annotated tag.
      #
      # format: git.COMMITS_SINCE_TAG.GIT_SHA example: git.207.694b062
      unless commits_since_tag == 0
        build_version_items << ["git", commits_since_tag, git_sha_tag].join(".")
      end

      unless build_version_items.empty?
        build_tag << "+" << build_version_items.join(".")
      end

      build_tag
    end
Create a new BuildVersion

 @param [String] path
   Path from which to read git version information
 @!group Version Generator Methods
 Generate a {http://semver.org/ SemVer 2.0.0-rc.1 compliant}
 version string for an Omnibus project.

 This relies on the Omnibus project being a Git repository, as
 well as having tags named according to SemVer conventions
 (specifically, the `MAJOR.MINOR.PATCH-PRERELEASE` aspects)

 The specific format of the version string is:

     MAJOR.MINOR.PATCH-PRERELEASE+TIMESTAMP.git.COMMITS_SINCE.GIT_SHA

 By default, a timestamp is incorporated into the build component of
 version string (see {Omnibus::BuildVersion::TIMESTAMP_FORMAT}). This
 option is configurable via the {Config}.

 @example 11.0.0-alpha.1+20121218164140.git.207.694b062
 @return [String]
 @see #git_describe
 @todo Issue a warning or throw an exception if the tags of the
   repository are not themselves SemVer-compliant?
 @todo Consider making the {#build_start_time} method public, as
   its function influences how build timestamps are generated,
   and can be influenced by users.