Coder Social home page Coder Social logo

bump's Introduction

Bump - Semantic Versioning

build codecov Current Version License

Bump is a library for working with semantic versioning following the Semantic Versioning 2.0.0 specification. It supports validation, precedence comparison, and increasing version numbers.

A SemVer object representing the version can be created by supplying arguments for the version, preRelease and buildMetaData parts to the constructor or by supplying a string which will be parsed by the SemVerParser using parser combinators.

Installation

Bump is published for Scala 2.11, 2.12, and 2.13. To start using it add the following to your build.sbt:

resolvers += Resolver.bintrayRepo("gn0s1s", "releases")

libraryDependencies += "nl.gn0s1s" %% "bump" % "0.1.3"

Example usage

import nl.gn0s1s.bump._

val version = SemVer(1, 0, 1, Some("alpha"), Some("20180329")) // version: nl.gn0s1s.bump.SemVer = 1.0.1-alpha+20180329

version.nextMinor.withoutPreRelease.withoutBuildMetadata // res0: nl.gn0s1s.bump.SemVer = 1.1.0

val version2 = SemVer("2.0.0").get // version2: nl.gn0s1s.bump.SemVer = 2.0.0

version < version2 // res1: Boolean = true

version2.nextPatch // res2: nl.gn0s1s.bump.SemVer = 2.0.1

val invalidVersion = SemVer("3.0") // invalidVersion: Option[nl.gn0s1s.bump.SemVer] = None

Methods

The following methods are available on a SemVer object:

  • toString - returns the semantic versioning 2.0.0 string
  • compare - compares the precedence to the supplied SemVer
  • nextMajor/bumpMajor - returns a new SemVer with an incremented major and reset (0) minor and patch version numbers
  • nextMinor/bumpMinor - returns a new SemVer with an incremented minor and a reset (0) patch version number
  • nextPatch/bumpPatch - returns a new SemVer with an incremented patch version number
  • nextStable - returns a new SemVer without pre-release information or an incremented patch version number
  • withMajor - returns a new SemVer with the supplied major version number
  • withMinor - returns a new SemVer with the supplied minor version number
  • withPatch - returns a new SemVer with the supplied patch version number
  • withPreRelease - returns a new SemVer with the supplied preRelease string
  • withoutPreRelease - returns a new SemVer without pre-release information
  • withBuildMetadata - returns a new SemVer with the supplied buildMetadata string
  • withoutBuildMetadata - returns a new SemVer without build metadata

Links

License

The code is available under the MIT license.

bump's People

Contributors

philippus avatar scala-steward 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.