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.
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
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
The ::Composer::Semver::Semver
class provides the following methods:
- satisfies?(version, constraints)
- satisfied_by(constraint, versions)
- sort(versions)
- rsort(versions)
Ioannis Kappas - [email protected]
PHP Composer Semver Ruby Gem is licensed under the MIT License - see the LICENSE file for details
- Fork it ( https://github.com/ikappas/php-composer-semver/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request