Giter Site home page Giter Site logo

semanticreleases's Introduction

SemanticReleases

The SemanticReleases contains utilities to help maintain semantic release versions.

Versioning()

Encapsulates functionality around bumping version numbers. Versioning::gerIncreasedVersion() Will accept a current version and increase it depending on it being a major, minor or fix change.

Example usage:

$versioning = new \SemanticReleases\Util\Versioning();
$versioning->getIncreasedVersion('1.0.0'); // $increaseType defaults to major bump 2.0.0
$versioning->getIncreasedVersion('1.0.0', \SemanticReleases\Util\Versioning::MINOR); // 1.1.0
$versioning->getIncreasedVersion('1.0.0', \SemanticReleases\Util\Versioning::FIX); // 1.0.1

You can view the unit tests to see every possible combination you can throw at the getIncreasedVersion() method.

Bad version values

To facilitate conversion from one format to another getIncreasedVersion() will do a lot of work to try and convert the passed version to a semantic format.

In the event that a version passed does not follow major.minor.fix or is just completely wrong, the getIncreasedVersion() method will fix it at best or at worst just give you back a 1.0.0 version.

Examples of non standard input:

$versioning = new \SemanticReleases\Util\Versioning();
$versioning->getIncreasedVersion(1); // 2.0.0
$versioning->getIncreasedVersion(1.1); // 2.0.0
$versioning->getIncreasedVersion('a'); // 1.0.0
$versioning->getIncreasedVersion('a.b'); // 1.0.0
$versioning->getIncreasedVersion('a.b.c'); // 1.0.0

To summarise, you will get a correct major.minor.fix version number, regardless what you throw at it. Now, if that is the value you wanted is a different matter.

Empty version

In the event of an empty version we convert it to 0 so the returned version will be 1.0.0. Useful if you are initialising versions.

semanticreleases's People

Contributors

neilmasters avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.