0.02
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Semi Semantic d6001f
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.0.0.rc
 Project Readme

semi-semantic

Build Status

A Ruby library for parsing/formatting/comparing semi-semantic versions.

Why not just use Semantic Versioning?

The purpose of this library is to support, but not require semantic versioning.

How is this different than Semantic Versioning?

Unlike SemVer, Semi-Semantic does not define exactly how it must be used.

Semi-Semantic...

  • Allows unlimited version segment components separated by periods (accessed by array index).
    • Does not have named concept of 'major', 'minor', or 'patch' versions.
  • Supports underscores, to allow compatibility with ruby gem conventions and timestamps.

Usage

require 'semi_semantic/version'
...
version_string = '1.0.2-alpha.1+build.10'
version = SemiSemantic::Version.parse(version_string)

p version.release.to_s
# '1.0.2'

p version.pre_release.to_s
# 'alpha.1'

p version.post_release.to_s
# 'build.10'

# increment post-release number
p SemiSemantic::Version.new(version.release, version.pre_release, version.post_release.increment)
# '1.0.2-alpha.1+build.11'

# increment pre-release number
p SemiSemantic::Version.new(version.release, version.pre_release.increment)
# '1.0.2-alpha.2'

# increment release number
p SemiSemantic::Version.new(version.release.increment)
# '1.0.3'

# increment 'major' release number
p SemiSemantic::Version.new(version.release.increment(0))
# '2.0.0'

# increment 'minor' release number
p SemiSemantic::Version.new(version.release.increment(1))
# '1.1.0'

# increment second most least significant release number
p SemiSemantic::Version.new(version.release.increment(-2))
# '1.1.0'