Skip to content

A Ruby utility for working with software version numbers as specified by Semantic Versioning (semver.org). Ruby classes to represent versions and sorted sets of versions. No funny business. Updated as the SemVer spec develops.

License

Notifications You must be signed in to change notification settings

joecorcoran/semantic_versioning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SemanticVersioning

Utility for working with software versions as specified by Semantic Versioning 2.0.0-rc.1.

Build status

SemanticVersioning::Version

Create a version object from a SemVer-formatted string.

version = SemanticVersioning::Version.new('1.2.0-pre.1+b.42')
version.major
  # => 1
version.build
  # => "b.42"

Increment version identifiers.

version.increment(:major)
version
  # => "2.0.0"

Compare versions.

current = SemanticVersioning::Version.new('1.2.0-pre.1')
previous = SemanticVersioning::Version.new('1.1.12')
current > previous
  # => true

SemanticVersioning::VersionSet

Work with sorted version sets.

versions = SemanticVersioning::VersionSet.new(['1.2.0-pre.3', '1.3.0'])
  # => #<SemanticVersioning::VersionSet: {1.2.0-pre.3, 1.3.0}>
versions << SemanticVersioning::Version.new('1.1.12')
  # => #<SemanticVersioning::VersionSet: {1.1.12, 1.2.0-pre.3, 1.3.0}>
versions.where(:>=, '1.1.13')
  # => #<SemanticVersioning::VersionSet: {1.2.0-pre.3, 1.3.0}>

License

Released under an MIT license (see LICENSE.txt).

http://blog.joecorcoran.co.uk

About

A Ruby utility for working with software version numbers as specified by Semantic Versioning (semver.org). Ruby classes to represent versions and sorted sets of versions. No funny business. Updated as the SemVer spec develops.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages