semantic_compare

Compare semver versions using semantic expressions
0.5.1 Latest release released

SemanticCompare

Build Status ISC

Compare semver versions using semantic expressions.

Most of the npm's semver implementation expressions are supported.

This library is based on stdlib's SemanticVersion.

Documentation

https://j8r.github.io/semantic_compare

Installation

Add the dependency to your shard.yml:

dependencies:
  semantic_compare:
    github: j8r/semantic_compare

Usage

Compare with simple expressions

require "semantic_compare"

semantic_version = SemanticVersion.new "1.2.3"

SemanticCompare.simple_expression semantic_version, "<1.5.0"        #=> true
SemanticCompare.simple_expression semantic_version, "1.2.0 - 1.4.0" #=> true

Compare with complex expressions, which can include 'or' || signs

require "semantic_compare"

# Compare with simple expressions
semantic_version = SemanticVersion.new "1.2.3"

SemanticCompare.complex_expression semantic_version, ">1.2.3 <2.0.0"               #=> true
SemanticCompare.complex_expression semantic_version, ">=1.0.4 || <2.0.0 || ~1.2.1" #=> true

License

Copyright (c) 2017-2020 Julien Reichardt - ISC License

semantic_compare:
  github: j8r/semantic_compare
  version: ~> 0.5.1
License ISC
Crystal none

Authors

Dependencies 0

Development Dependencies 0

Dependents 1

Last synced .
search fire star recently