Skip to content
Compare semver versions using semantic expressions similar to ones from npm's semver implementation
Crystal
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
spec
src
.drone.yml
LICENSE
README.md
shard.yml

README.md

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.0.4 || <2.0.0 || ~1.2.1" #=> true

License

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

You can’t perform that action at this time.