2017 © Pedro Peláez
 

library versionmatcher

image

codecounter/versionmatcher

  • Wednesday, January 21, 2015
  • by codecounter
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

VersionMatcher

Build Status, (*1)

Compare versions with logic opertation. (Actually, it's a project to test ci/cd), (*2)

Installation

  1. With composer
{
    ...
    "require": {
        "codecounter/versionmatcher": "0.1.0"
    }
}
  1. Without composer
require "/path/to/VersionMatcher/autoload.php"

Usage

  1. Compare 2 version strings
// produce `false`
\CodeCounter\VersionMatcher::test('ver >= 1.2.0', array(
    'ver' => '1.1.0'
));
  1. Compare with logic
// produce `true`
\CodeCounter\VersionMatcher::test('ver >= 1.2.0 && ver < 1.6.0', array(
    'ver' => '1.3.0'
));
  1. Persisted object
$matcher = new \CodeCounter\VersionMatcher(array(
    'android' => '1.3.0',
    'ios' => ''
));
// produce `true`
$matcher->match('ios >= 1.4.0 || android >= 1.3.0');
// produce `false`
$matcher->match('ios >= 1.4.0 || android < 1.2.0');

For detailed usage, please view tests directory., (*3)

Develop

  • Clone repository
  • cd dev
  • cp docker-compose.example.yml docker-compose.yml, modify it if necessary
  • docker-compose up -d
  • docker-compose exec php bash, ssh to the container
  • cd /var/www

then, you can run unit test by phpunit, or code sniffer by phpcs., (*4)

php tests/coverage-check.php after phpunit, this script can exit stdout with 1 when coverage < 90%, for ci notification., (*5)

License

This library is under MIT license., (*6)

The Versions

21/01 2015

dev-master

9999999-dev https://github.com/codecounter/VersionMatcher

  Sources   Download

MIT

The Requires

  • php >=5.3.0