'Semantic Versioning V2.0.0' Parser

Tools and functions for parsing, rendering and operating on semantic version strings. Semantic versioning is a simple set of rules and requirements that dictate how version numbers are assigned and incremented as outlined at < http://semver.org>.


CRAN version Travis build status Appveyor build status Coverage
CRAN version Build Status AppVeyor Build Status codecov

You can install semver from github with:

# install.packages("devtools")
devtools::install_github("johndharrison/semver")

Introduction

The semver package provides tools and functions for parsing, rendering and operating on semantic version strings. Semantic versioning is a simple set of rules and requirements that dictate how version numbers are assigned and incremented as outlined at http://semver.org.

A basic summary of how semantic versioning operates is given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards-compatible manner, and
  3. PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

semver package

The semver package provides a wrapper for the C++14 semantic versioning parser written by Marko Živanović. The project is currently hosted on github. The Rcpp package was used to provide R bindings. Some changes were made on the C++ side as currently CRAN does not accept packages compiling under C++14 (R version 3.4.0 should allow this in future).

Examples

semver <- parse_version(c("1.2.3", "1.2.4", "1.0.0", "1.2.4-beta", "2.1.3-alpha", "1.9.4"))
max(semver)
ver124a <- semver[semver > "1.2.4-alpha"]
sort(ver124a)
# compare versions
semver[[1]] < semver[[2]]

# compare against a version
semver > semver[1]

# compare against a character string
semver > "1.7.2"

# sort versions
sort(semver)
order(semver)
rank(semver)

# get summary statistics
min(semver)
max(semver)
range(semver)

# coerce versions
as.character(semver)
as.data.frame(semver)

For more detail see the vignette semver: Basics

News

semver 0.1.5

  • Update basics vignette detailing new methods

semver 0.1.4

  • Added an increment_version method to increment the fields of semantic version objects
  • Added tests for increment_version.

semver 0.1.3

  • Added tests for set_version.
  • Added a reset_version method to reset the fields of semantic version objects
  • Added tests for reset_version.

semver 0.1.2

  • Add set_ptr, reset_ptr and increment_ptr c++ level functions to act on version fields.
  • Version fields can be set via $<- for svptr class
  • Added a set_version method to set the fields of semantic version objects

semver 0.1.1

  • Rename version c++ namespace to sv_version due to conflicts with some OS system headers (Solaris x86).
  • Add #include as some OS had issues (windows server 2008)

semver 0.1.0

  • Initial release to CRAN

semver 0.0.4

  • Added tests for render_version and misc
  • Added basic vignette

semver 0.0.3

  • Internal function render_ptr now returns a list rather than a character vector
  • Added a render_version method for svptr and svlist classes

semver 0.0.2

  • Added a shim to the underlying c++ code to compile under c++11.
  • Added tests

semver 0.0.1

  • Added a NEWS.md file to track changes to the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("semver")

0.2.0 by John Harrison, a year ago


https://github.com/johndharrison/semver


Report a bug at https://github.com/johndharrison/semver/issues


Browse source code at https://github.com/cran/semver


Authors: John Harrison [aut, cre] (R package semantic), Marko Živanović [aut, cph] (semver cpp library, https://github.com/zmarko/semver)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp, assertthat, utils

Suggests testthat, covr, knitr, rmarkdown

Linking to Rcpp

System requirements: C++11


Imported by binman, wdman.


See at CRAN