Semantic Versioning

Definición

A versioning policy is merely a set of simple rules governing how version numbers are allocated.

  1. It can be very simple (e.g. the version number is a single number starting with 1 and incremented for each successive version),
  2. or it can be really strange (Knuth’s TeX project had version numbers: 3, 3.1, 3.14, 3.141, 3.1415; each successive version added another digit to PI).

Por que usar Semantic Versioning

The RubyGems team urges gem developers to follow the Semantic Versioning standard for their gem’s versions.

  1. The RubyGems library itself does not enforce a strict versioning policy, but using an irrational policy will only be a disservice to those in the community who use your gems.

Ejemplo

  1. Suppose you have a stack gem that holds a Stack class with both push and pop functionalty.

    Your CHANGELOG90.1 might look like this if you use semantic versioning:

    Version 0.0.1: The initial Stack class is released.
    Version 0.0.2: Switched to a linked list implementation because it is cooler.
    Version 0.1.0: Added a depth method.
    Version 1.0.0: Added top and made pop return nil (pop used to return the old top item).
    Version 1.1.0: push now returns the value pushed (it used to return nil).
    Version 1.1.1: Fixed a bug in the linked list implementation.
    Version 1.1.2: Fixed a bug introduced in the last fix.
    

Resumen

  1. Semantic versioning boils down to:

    1. PATCH level 0.0.x: changes for implementation level detail changes, such as small bug fixes
    2. MINOR level 0.x.0 changes for any backwards compatible API changes, such as new functionality/features
    3. MAJOR level x.0.0 changes for backwards incompatible API changes, such as changes that will break existing users code if they update

Ejercicio

Ejercicio 90.12.1   ¿Porqué el cambio en el pop produce un cambio en el MAJOR level y el cambio en el push sólo produce un cambio en el MINOR level en este CHANGELOG?
Version 0.0.1: The initial Stack class is released.
Version 0.0.2: Switched to a linked list implementation because it is cooler.
Version 0.1.0: Added a depth method.
Version 1.0.0: Added top and made pop return nil (pop used to return the old top item).
Version 1.1.0: push now returns the value pushed (it used to return nil).
Version 1.1.1: Fixed a bug in the linked list implementation.
Version 1.1.2: Fixed a bug introduced in the last fix.

Véase

  1. Véase en http://semver.org/ la definición completa del estandard



Subsecciones
Casiano Rodriguez León 2015-01-07