Project

sem_ver

0.0
No commit activity in last 3 years
No release in over 3 years
Semantic Version parser
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

SemVer Build Status

SemVer is a very simple semantic version parser in Ruby. It takes a string and returns an object that can be validated and compared.

Examples

require 'sem_ver'

SemVer.parse('0.0.10').valid?                       # true
SemVer.parse('v1.0.10').valid?                      # true
SemVer.parse('X.10').valid?                         # false

SemVer.parse('1.0.0') >  SemVer.parse('0.9.9')      # true
SemVer.parse('1.0.1') >= SemVer.parse('1.0.0')      # true
SemVer.parse('1.0.1') >= SemVer.parse('1.1.0')      # false
SemVer.parse('1.0.0') == SemVer.parse('1.0.0-pre1') # false
SemVer.parse('1.0.0') >  SemVer.parse('1.0.0-pre1') # true

...

Alternatives

If you need more advanced things, versionomy looks great.

Credits

Copyright © 2012 Sergio Gil, released under the MIT license