No commit activity in last 3 years
No release in over 3 years
A ruby gem library for that offers utilities, version constraint parsing and validation.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0
~> 5.0
>= 0.35.0, ~> 0.35
>= 1.3.1, ~> 1.3
~> 0.10
 Project Readme

PHP Composer Semver Ruby Gem

A ruby gem library for that offers utilities, version constraint parsing and validation.

This is a ruby port of the Composer Semver Library for PHP.

Installation / Usage

Add this line to your application's Gemfile:

gem 'php-composer-semver'

And then execute:

$ bundle

Or install it yourself as:

$ gem install php-composer-semver

Basic usage

Comparator

The ::Composer::Semver::Comparator class provides the following methods for comparing versions:

  • greater_than?(v1, v2)
  • greater_than_or_equal_to?(v1, v2)
  • less_than?(v1, v2)
  • less_than_or_equal_to?(v1, v2)
  • equal_to?(v1, v2)
  • not_equal_to?(v1, v2)

Each function takes two version strings as arguments. For example:

import Composer::Semver::Comparator

Comparator::greater_than?('1.25.0', '1.24.0') # 1.25.0 > 1.24.0

Semver

The ::Composer::Semver::Semver class provides the following methods:

  • satisfies?(version, constraints)
  • satisfied_by(constraint, versions)
  • sort(versions)
  • rsort(versions)

Authors

Ioannis Kappas - ikappas@devworks.gr

License

PHP Composer Semver Ruby Gem is licensed under the MIT License - see the LICENSE file for details

Contributing

  1. Fork it ( https://github.com/ikappas/php-composer-semver/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request